[Dcmlib] Writing Dicom to Raw
Jean-Pierre Roux
jpr at creatis.insa-lyon.fr
Tue Dec 12 11:15:02 CET 2006
Clemens Hentschke wrote:
>Hello,
>
>i have a DICOM and just want to convert this into a image-raw-format (without image header), just the pixel-values as they are in the dicom.
>
>My code is:
>file = gdcm::File::New( );
> file->SetLoadMode ( gdcm::LD_ALL );
> file->SetFileName("test.dcm");
>
> bool res = file->Load();
> if (!res) {
> std::cerr << "Sorry, " << " not a gdcm-readable " << "DICOM / ACR File" << std::endl;
> file->Delete();
> return -1;
> }
>
>
OK.
Probablely the name 'Load' confused you.
The method load the *header*, not the image pixels.
Just add
fh->GetImageDataRaw();
to load the pixels.
(using
fh->GetImageData(); would convert any image with a LUT into an RGB image.
For 'gray level images', GetImageData() and GetImageDataRaw() are
equivalent)
> gdcm::FileHelper *fh = gdcm::FileHelper::New(file);
> fh->SetWriteModeToRaw();
> fh->WriteRawData("Neu.IMG");
> but there is always the error: Error: In /usr/gdcm/src/gdcmFileHelper.cxx, line 603, function bool gdcm::FileHelper::WriteRawData(const std::string&)
>Nothing written.
>
>where is my error? I have the cvs version of gdcm, downloaded about two weeks ago
>
>
By the way, did you solve your compile time ITK problem?
Just tell me : you dowloaded gdcm (version 1.3.1) and you work with a
standard version of ITK, right?
ITK uses dgcm1.2.x, nad prbabely, this confuses the complier.
Actually, I don't know waht you wanted to do is possible?
Mathieu, any comment?
(maybe you told Clemens to convert his data into Raw images?)
Jean-Pierre Roux
>Thanks
> -Clemens
>
>______________________________________________________________________________
>"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
>Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!
>
>
>_______________________________________________
>Dcmlib mailing list
>Dcmlib at creatis.insa-lyon.fr
>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
>
>
>
More information about the Dcmlib
mailing list