Save binary image into .dcm
显示 更早的评论
Hi
I have segmented an organ from a CT scan (original image given in DICOM) and I would like to save the segmented image (binary one) as .dcm due to I need to use it after in other software that only read .dcm. Could someone explain me how I can do that?
Thank you in advance.
7 个评论
Geoff Hayes
2014-8-19
dicomwrite(X, filename) writes the binary, grayscale, or truecolor image X to the file filename, where filename is a string specifying the name of the Digital Imaging and Communications in Medicine (DICOM) file to create.
Geoff Hayes
2014-8-20
Isabel - what do you mean by flipped? Is the image transposed or flipped left to right? And is the origin different?
To avoid the warning message, you can probably just convert the data to 8-bit unsigned integers and multiply by 255 (since the binary data is just 0s or 1s). Something like
seg17 = 255*uint8(seg17);
Why are you doing the reshape, and so adding the extra dimension?
Isabel
2014-8-22
Geoff Hayes
2014-8-22
Isabel - I'm not sure why that would be happening. Out of curiosity, if you read the file back in to MATLAB (with dicomread) are the images upside down? Is the meta data (as obtained with dicominfo) the same as the original, or has it been changed too?
dicomwrite(flipud(reshape(seg17,[512 512 1 268])), 'ct_seg.dcm', info, 'CreateMode', 'copy');
You could also check the status of the dicomwrite as
status = dicomwrite(flipud(reshape(seg17,[512 512 1 268])), ...
'ct_seg.dcm', info, 'CreateMode', 'copy');
Isabel
2014-8-26
Geoff Hayes
2014-8-26
Glad that you were able to get everything working, Isabel!
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Read and Write Image Data from Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!