[Dcmlib] Writing Dicom to Raw

Emmanuel Olart eolart at theralys.com
Tue Dec 12 09:27:33 CET 2006


I clemens,

I think you just have to add the following line before writing anything :

fh->GetImageData();

This will actually load the image data into memory wo you can write it.

Best

Emmanuel

Clemens Hentschke a écrit :
> 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;
>    }
>  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
> 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
>   

-- 
Emmanuel OLART, IT Manager
*THERALYS*
Diagnostic & Therapeutic Image Analysis in Clinical Trials

Address : Bioparc, 60 av. Rockefeller, 69008 Lyon, France
+33 (0)4 26 23 05 05 (Phone)
+33 (0)4 26 23 05 06 (Fax)
Email : eolart at theralys.com <mailto:eolart at theralys.com>
THERALYS <http://www.theralys.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/dcmlib/attachments/20061212/0c47435a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Theralys_small.gif
Type: image/gif
Size: 3177 bytes
Desc: not available
URL: <http://www.creatis.insa-lyon.fr/pipermail/dcmlib/attachments/20061212/0c47435a/attachment.gif>


More information about the Dcmlib mailing list