I have a DICOM RT STRUCTURE file (attached) with 1 structure set. I tried dicomread(filename) but it returned an empty array. Are there any scripts to read DICOM RT STRUCTURE file with Matlab?

 채택된 답변

Thomas
Thomas 2014년 3월 4일
편집: Thomas 2014년 3월 4일

4 개 추천

or try
RSInfo=dicominfo('RS.ZZ_YUNINN_.dcm');
dicomwrite(1, 'RSDicomOut.dcm', RSInfo, 'CreateMode', 'Copy');
Then read
X=dicomread('RSDicomOut.dcm');

댓글 수: 13

Yun Inn
Yun Inn 2014년 3월 4일
Hi Thomas,
I tried the code and it returned a single number?
Yun
Thomas
Thomas 2014년 3월 4일
편집: Thomas 2014년 3월 4일
hmmm. here is why-
RSInfo
RSInfo =
Filename: [1x55 char]
FileModDate: '04-Mar-2014 05:50:52'
FileSize: 1899490
Format: 'DICOM'
FormatVersion: 3
Width: []
Height: []
BitDepth: []
The image you attached is not being read correctly by matlab.. no width , height or bit depth..
are you sure your Dicom RT file is valid..
I have another dicom-rt image and this is how the output of dicominfo looks like..
info1=dicominfo('image_0.dcm')
info1 =
Filename: [1x52 char]
FileModDate: '11-Jan-2012 07:42:44'
FileSize: 525444
Format: 'DICOM'
FormatVersion: 3
Width: 512
Height: 512
BitDepth: 16
ColorType: 'grayscale'
Yun Inn
Yun Inn 2014년 3월 5일
Hi Thomas,
Finally figured out what was wrong. The RTStructure.dcm file does not have any width, height, or bit depth information. The information is contained in the CTimage.dcm file. The GitHub link with codes provided by Ulrik is very helpful. Thank you very much!
Yun Inn
Yun Inn 2014년 5월 18일
Hi Zahra,
The RTstructure.dcm is related to the set of CTimage.dcm files. Without the CTimage.dcm, the RTstructure.dcm will be meaningless.
In order for the correct readout of the structures, the RTstructure.dcm and the whole set of CTimage.dcm (all axial slices) must be in the same folder. Subsequently, you can use the codes provided by Ulrik on Github (https://github.com/ulrikls/dicomrt2matlab) to read and convert the structure into binary image in matlab. To display the outline of structure, you can try using the bwtraceboundary function.
If you have more than 1 structures, you can browse the structure from the output under: contours(?,?).Segmentation;
Hope you can see this reply and it would be helpful to you.
zahra
zahra 2014년 5월 18일
Dear Yun,
Thank you for your help and guides. I gather all of the CT images with the structure file in one folder and run the following function: >> dicomrt2matlab('RTSTRUCT_NAGHDI MAHBANOO_S1_C1')
but finally get these errors, I don't know what is the header and what should I do to fix this error, Do you have any idea?
error: Reading image headers... Converting RT structures... ??? Reference to non-existent element of a cell array.
Error in ==> getAffineXfm at 7 dr = headers{1}.PixelSpacing(1);
Error in ==> readRTstructures at 4 xfm = getAffineXfm(imgheaders);
Error in ==> dicomrt2matlab at 26 contours = readRTstructures(rtssheader, imageheaders); %#ok<NASGU>
Bests
Yun Inn
Yun Inn 2014년 5월 18일
Hi Zahra,
Check that you have these functions from the Github download: (1) scanDir.m (2) dicomrt2matlab.m (3) loadDicomImageInfo.m (4) readRTstructures.m (5) getAffinexfm.m
Then put all the dicom files (RTstructure.dcm and all CTimage.dcm) in one folder (e.g. FolderA), and just run these 2 lines:
% Specify the path of the folder
directory='/Users/xxxx/Desktop/FolderA;
% Output into the same folder
files_out = scanDir(directory);
You should see the .mat file saved in the same folder. It could take a few minutes to get the output depending on the number of CT slices and structures.
Hope it works for you!
Hi,
Thank you very much. I do your suggestions but finally get this:
Converting C:\Users\zahra si\Documents\MATLAB\brachy\patient2\RTSTRUCT_NAGHDI MAHBANOO_S1_C1.dcm
and the files_out is just: files_out =
{}
I really don't know what is the problem!
Bests,
zahra
zahra 2014년 5월 19일
Excuse me, I mean that no .mat file was created.
Bests, Zahra
zahra
zahra 2014년 5월 20일
Dear Yun,
Finally I can have a .mat file in that folder after running the codes, but can you see your structures on the CTs? If yes would you please let me know how? I can't do it by imshow.
Bests, Zahra
Yun Inn
Yun Inn 2014년 5월 21일
편집: Walter Roberson 2018년 5월 25일
Hi Zahra,
I haven't tried that but you should be able to. If you are seeing all black on the CT image, then its the windowing. You can set the window limits.
imshow(Im, [LowLim UpLim])
To display the structure, you have to specify which structure first. Example:
Str1=contours(1,1).Segmentation; % (1,1) is just an example.
Choose your own structure of interest. Then
imshow(Str1)
If you want only the outline, you have to trace the boundary first, bwtraceboundary. To superimpose, use 'hold on'.
Hello Zahra, Can you describe how you solved the problem with
files_out =
{} ?
Any help is much appreciated, Tom
manuela
manuela 2014년 9월 3일
Hello Zahra, I have the same problem as Thomas, Please let me know how you solved the problem files_out = {} Thank you very much, Manuela
zahra
zahra 2014년 9월 3일
Hi Thomas, Excuse me I see your question now. I just did what Yun said put all of my CTs and structures to a single folder and run the code as : % Specify the path of the folder
directory='/Users/xxxx/Desktop/FolderA;
% Output into the same folder
files_out = scanDir(directory); Bests.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

MARIA LIZONDO
MARIA LIZONDO 2016년 12월 22일

0 개 추천

Hi all,
I have tried to use this code but I have problems to view the structure...
imshow(Str1)
Error using images.internal.imageDisplayValidateParams>validateCData (line 115)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 222)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Thanks in advance!
Maria

댓글 수: 2

Mengxiao Wang
Mengxiao Wang 2018년 5월 25일
Hi Maria, Can you solve the problem to view the structure? Thank you very much. Megan
Walter Roberson
Walter Roberson 2018년 5월 25일
편집: Walter Roberson 2018년 5월 25일
What shows up for size(Str1) and class(Str1) ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 DICOM Format에 대해 자세히 알아보기

태그

질문:

2014년 3월 4일

답변:

2020년 9월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by