dicom - DicomImage's writeBMP function produces unclear gray image -


i using dcmtk read , modify dicom images. have following code:

#include <iostream> #include <opencv\cv.h> #include <dcmtk\dcmimgle\dcmimage.h>  int main() {     try {         dicomimage* dicomimage = new dicomimage("c:/users/kriselle/documents/000004.dcm");         if ((dicomimage != null) && (dicomimage->ismonochrome())) {             dicomimage->writebmp("c:/users/kriselle/documents/z.bmp", 8);             std::cout << "z.bmp created" << std::endl;         }         else {             std::cout << "dicomimage null or not monochrome" << std::endl;         }     }     catch (cv::exception e) {         std::cerr << e.what() << std::endl;     }     return 0; } 

all did create dicomimage , write pixel data bmp file filename specified image returns gray image outline of original image barely recognized.

this should like: https://www.dropbox.com/s/6dw8nlae8hfvqf6/000004.jpg?dl=0 code produces: https://www.dropbox.com/s/fff2kch124bzjqy/z.bmp?dl=0

am missing in code or did not understand function does? can please enlighten me? thank much!

as can read in api documentation of dicomimage class, default no voi transformation enabled when rendering monochrome dicom images. in case, seems inappropriate, should specify more appropriate voi setting (e.g. min-max window) or use 1 of voi windows stored in dicom dataset (if any).

by way, after loading image in constructor, should check status of process using getstatus() method.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -