[Dcmlib] Writing Dicom to Raw
Clemens M. Hentschke
husky22 at web.de
Wed Dec 13 03:21:16 CET 2006
Jean-Pierre Roux schrieb:
> 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
>>
>>
>>
>
>
Thank you, the GetImageDataRaw() works fine!
I couldnt solve the ITK Problem. I am working with the standard ITK
Version 2.8.1 and the Current gdcm version. However, with using an
external GDCM version in ITK the ITK build process failed and with the
integrated version (1.2) there was missing a class (DataEntry).
However, gdcm has all the methods i need (to read the dicom header and
the pixel information), and because of that i dont need ITK anymore in
my project and i dont have to handle with it, so all that i want works fine.
Thanks for the help!
-Clemens
More information about the Dcmlib
mailing list