Uploading a DICOM image into Matlab and using imageBatchProcessor
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I've been trying to upload a DICOM image into Matlab and get it into a format to use in the image batch processor. I've managed to get the image of one slice but can't get the rest. I've tried using different methods to get each slice into individual images.
Here is the first method. It takes a long time to run because the data set is so big and makes Matlab unresponsive.
[X, map] = dicomread('R.G._20150923.dcm');
info = dicominfo('R.G._20150923.dcm');
X = dicomread(info);
imshow('R.G._20150923.dcm')
%Preallocate the image array.
nRows = 512;
nCols = 512;
nPlanes = 1;
nFrames = 199; %The number of files in the directory
Y = repmat(int16(0), [nRows, nCols, nPlanes, nFrames]);
%Read the series of images.
for p=1:nFrames
filename = sprintf('R.G._20150923.dcm',p);
Y(:,:,:,:,p) = dicomread(filename);
end
%Display the image stack
montage(Y, [])
Here is the second method. I found this on the Batch Processing Using the Image Batch Processor App Matlab web page. I keep getting this error when I run it: Reference to non-existent field 'D'.
mkdir('CTdata');
d = load('ct');;
image = squeeze(d.D);
for ind = 1:size(image,3)
fileName = sprintf('Slice%02d.jpg', ind);
imwrite(image(:,:,ind),fullfile('CTdata','R.G._20150923.dcm'));
end
Is there something wrong with my code or is a different way to go about this?
Thanks!
댓글 수: 2
Walter Roberson
2016년 8월 16일
What is the variable part of the file name? For example are the files R.G.1_20150923.dcm R.G.2_20150923.dcm R.G.3_20150923.dcm and so on? Or are all of the frames in the single R.G._20150923.dcm file?
Ashish Uthama
2016년 8월 17일
What is 'ct'? Is it a mat file? +1 to the comment above - let us know more about the format of the data you have now (I am assuming MxNXP volume in a single .dcm file, please confirm).
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 DICOM Format에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!