Save binary image into .dcm
Mostrar comentarios más antiguos
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 comentarios
Geoff Hayes
el 19 de Ag. de 2014
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
el 20 de Ag. de 2014
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
el 22 de Ag. de 2014
Geoff Hayes
el 22 de Ag. de 2014
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
el 26 de Ag. de 2014
Geoff Hayes
el 26 de Ag. de 2014
Glad that you were able to get everything working, Isabel!
Respuestas (0)
Categorías
Más información sobre Read and Write Image Data from Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!