dicomwrite to save dicom image with window level setting
Afficher commentaires plus anciens
Any one can help me?
I want to save my dicom images as dicom in right contrast.
I wrote like this
R = dicomread('1.dcm');
The image like below

then I wrote
T = imshow(R, [0 1844]);

then I want to save as new image, i wrote
dicomwrite(T, 'S.dcm');
But got ERROR
Error using dicom_prep_ImagePixel>getPixelStorage (line 204)
Invalid datatype for image pixels.
Error in dicom_prep_ImagePixel (line 13)
[ba, bs, hb, pr] = getPixelStorage(X, txfr, useExistingBitDepths, metadata,
dictionary);
Error in dicom_prep_metadata (line 51)
metadata = dicom_prep_ImagePixel(metadata, X, map, txfr,
useMetadataBitDepths, dictionary);
Error in dicom_create_IOD (line 26)
metadata = dicom_prep_metadata(IOD_UID, metadata, X, map, options.txfr,
options.usemetadatabitdepths, dictionary);
Error in dicomwrite>write_message (line 275)
[attrs, status] = dicom_create_IOD(SOP_UID, X, map, ...
Error in dicomwrite (line 211)
[status, options] = write_message(X, filename, map, metadata, options);
ANYONE KNOW HOW TO SAVE IMAGE DICOM AS 2ND PICTURE ???
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 18 Août 2021
T = imshow(R, [0 1844]);
the result of imshow() is a handle to a graphics image() object. You cannot write a graphics handle as an image.
You should use rescale(); older MATLAB would have to use the obscurely-named mat2gray()
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

