Filter löschen
Filter löschen

dicomwrite creates a black and white image, why?

1 Ansicht (letzte 30 Tage)
MYimage
MYimage am 1 Aug. 2012
Hi there,
I have a problem in writing and reading a dicom CT image , I explained in the code below, I think I miss something, would you please let me know what I miss. Thanks a lot.
x=dicomread('t3.dcm'); % a grayscale image
metadata=dicominfo('t3.dcm');
... process x data
imshow(x,[]); % a correct grayscale image
dicomwrite (x,'t1.dcm',metadata);
x1=dicomread('t1.dcm');
imshow(x1,[]); % it is a black and white image, why?

Antworten (2)

venkat vasu
venkat vasu am 1 Aug. 2012
info = dicominfo('CT-MONO2-16-ankle.dcm'); I = dicomread(info); dicomwrite(I,'ankle.dcm',info);
this code will help you...

Sean de Wolski
Sean de Wolski am 1 Aug. 2012
What is the class of x after you read it in?
class(x) %?
And after this:
max(x(:))
min(x(:))
I would guess you are writing the file out and not accounting for the class of the data, causing it to scale wierdly or saturate at the edges.
  1 Kommentar
MYimage
MYimage am 2 Aug. 2012
thank you for your answer, I corrected it by converting the data from double to uint16.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by