MATLAB Answers

How to extract a 1D dose at certain depth in x,y or z-direction from a 3D array?

4 views (last 30 days)
Thomas Ndaro Bulenga
Thomas Ndaro Bulenga on 28 Jul 2020
Answered: KSSV on 29 Jul 2020
Hi everyone,
I first confess that am very begginer in coding which I find to be very useful in my academic area.
Currently, I have a 3D dose array calculated by Monte Carlo in a phantom as a function of xyz direction. The z-direction also represent depths of the phantom in which the dose was calculated. I want to extract and analyze this 3D dose data in individual directions, say in x or y (profiles) at different depths and in z-direction (pdds).
Thank you.

  4 Comments

Show 1 older comment
Thomas Ndaro Bulenga
Thomas Ndaro Bulenga on 29 Jul 2020
Attached is the 3D dose data and respective directions of the volume. I wish to extract a vector data for individual directions to be able to plot lines ( say for all xdir at y = 0, z = 0 or for all z at x=0, y=0). Since the data comes from the volume, i assume at the end using individual data sets I can plot a 3D volume similar to the original. It sounds complicated but, I want to know if is doable and how.
Thank you for you help

Sign in to comment.

Answers (1)

KSSV
KSSV on 29 Jul 2020
I feel slice is your function....
load("xdim.mat") ;
load("ydim.mat") ;
load("zdim.mat") ;
load("3d_dose data.mat") ;
[X,Y,Z] = ndgrid(x,y,z) ;
D = permute(dose_3d,[2 1 3]) ;
% extract data
[xslice,yslice] = meshgrid(x) ;
yslice = 3*ones(size(xslice)) ;
zslice = zeros(size(xslice)) ;
slice(X,Y,Z,D,xslice,yslice,zslice)
Play around with that.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!