Seperating a montage/mosaic of DICOM images in to individual slices

1 view (last 30 days)
HI,
I have a 3D matrix of 256 X 256 X 128 (means 128 images of 256 X 256 resolution). Within one of these images there are 10 slices which are each 64X64. I need to separate each of these slices. The way the images are displayed in each image is 4 in the first row, 4 in the second row and 2 in the 3rd row. So far I have written a loop that goes through all the 128 dicom images. Within that loop I have the start and end point pixel numbers on the x direction and y direction. They run from xbegin and ybegin=1,65,129,193 and xend and yend=64,128,192 and 256. Although the loop does run through it doesn't go further from the first slice in the first image. Please let me know what I am doing wrong. Thanks. Here is the code I have so far.
No_of_DICOM_Files=128;
Dimension_Slice_Side=64;
Data_Structure.Image___Matrix_3D(:,:,:)=The original image matrix of 256 by 256 in to 128 images
delta=256/64% size of original DICOM/side of individual slice
for index1=1:No_of_DICOM_Files
Matrix(:,:,:)=Data_Structure.Image___Matrix_3D(:,:,:);
for index2=1:delta
ybegin(index2)=(index2*Dimension_Slice_Side)-63;
yend(index2)=index2*Dimension_Slice_Side;
for index3=1:dx
xbegin(index3)=(index3*Dimension_Slice_Side)-63;
xend(index3)=index3*Dimension_Slice_Side;
for index4=1:16
Matrix22(xbegin:xend,ybegin:yend,:,index4) = Matrix(xbegin:xend,ybegin:yend,:);
end
disp(['The x direction (index3) :' ,sprintf(' %u' ,index3)]);
disp(['The y direction (index2) :' ,sprintf(' %u' ,index2)]);
disp(['Image Number (index1) :' ,sprintf(' %u' ,index1)]);
end
end

Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!