[Dcmlib] Question about dicom imaging not being read correctly

Neerav Patel neeravpatel at hotmail.com
Sun Jan 20 06:16:09 CET 2008


Hi,
Using GDCM I have loaded up the raw byte array but the problem is whenI show the image the really white areas seem to be corrupted and haveturned black.  Is there a setting that I havent set or something.
Here is the code i have wrote:
       f = GDCM_NAME_SPACE::File::New();
       f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ);       f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSHADOW);       f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW);       f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSHADOWSEQ);
       f->SetFileName( filename );
       bool res = f->Load();       if ( !res ) {               f->Delete();               MessageBox( NULL, "DICOM NOT LOADED", NULL, MB_OK );               f = NULL;       }
       if (!f->IsReadable()) {               MessageBox( NULL, "Sorry, not a Readable DICOM / ACR File", NULL, MB_OK  );               f->Delete();               f = NULL;               return;       }
       fh = GDCM_NAME_SPACE::FileHelper::New(f);       fh->SetKeepOverlays(false);
       int nZ, sPP, planarConfig;       std::string pixelType;
       imageWidth = f->GetXSize();       imageHeight = f->GetYSize();       nZ = f->GetZSize();
       pixelType    = f->GetPixelType();       sPP          = f->GetSamplesPerPixel();       planarConfig = f->GetPlanarConfiguration();
       int numberOfScalarComponents=f->GetNumberOfScalarComponents();
       dataSize  = fh->GetImageDataRawSize();   imageData = fh->GetImageDataRaw();  // somewhat important : Loadsthe Pixels in memory !
       if ( imageData == 0 ) {     MessageBox( NULL, "Was unable to read pixels ", NULL, MB_OK );         f = NULL;         return;  }
 
Any help would be greatly appreciated.
 
Thanks
 
Neerav
_________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/dcmlib/attachments/20080120/5881681c/attachment.html>


More information about the Dcmlib mailing list