How I can create muli-frame DICOM from 3-D matrix

3 views (last 30 days)
Hello everybody ! :) I'm trying to combine a sequence of 2-D images in the form 3-D matrix to a DICOM , I don't care about the metadata , I just want one big file of .dcm I tried the following:
dicomwrite(Matrix,'checkMatrix.dcm','MultiframeSingleFile','true')
and I tried the file from:
https://www.mathworks.com/matlabcentral/fileexchange/23237-read-and-write-single-file-dicom-volumes
Can You Please Help me? I feel like I missing something vital from DICOM
  2 Comments
Rik
Rik on 25 Feb 2018
What errors are you getting? You should also be aware that many readers can't read 3D dicoms.
alon begin
alon begin on 25 Feb 2018
Hello :-) when I'm running
dicomwrite(Matrix,'checkMatrix.dcm','MultiframeSingleFile','true')
I'm getting the error:
" Operands to the and && operators must be convertible to logical scalar values.
Error in dicomwrite>checkArgConsistency (line 854) options.multiframesinglefile && ...
Error in dicomwrite>write_message (line 252) checkArgConsistency(options, SOP_UID, X);
Error in dicomwrite (line 208) [status, options] = write_message(X, filename, map, metadata, options); "
It's trying to check the if operation
if (isequal(options.createmode, 'create') && ... options.multiframesinglefile && ... (size(X,4) > 1) && ... ~isSC(SOPClassUID))
error(message('images:dicomwrite:multiFrameCreateMode'))
line 352 in dicomwrite.m

Sign in to comment.

Answers (1)

Rik
Rik on 25 Feb 2018
I didn't notice at first, but you supplied true as a string, so the syntax below should at least run without errors.
dicomwrite(Matrix,'checkMatrix.dcm','MultiframeSingleFile',true)
  5 Comments
alon begin
alon begin on 26 Feb 2018
Edited: alon begin on 26 Feb 2018
well ..
I tried to put my effective on certain meta_struct but it still has the same mistakes but now after changed the matrix to a 4-d according to Rik Wisselink: IM4D=permute(IM3D,[1 2 4 3]);
But now in the if operation:
if (size(X, 3) == 1)
line 70 in dicom_prep_ImagePixel.m
The X in dim 3 has the size of 2 , which also produce an error.. I tried on debug to change it to 1 and it prodouce a dicom that all it's frames are at values of 54 , (the number of frames)... :-\
Walter Roberson
Walter Roberson on 26 Feb 2018
The permute Rik showed should transform the 476 x 616 x 54 into 476 x 616 x 1 x 54 which should be acceptable. It should not somehow be making the third dimension into length 2.

Sign in to comment.

Categories

Find more on DICOM Format in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!