[Insight-users] use itk::ImageFileReader to read a dicom file without extension ???

Iván Macía imacia at vicomtech.org
Mon Mar 2 10:15:36 EST 2009


> -----Mensaje original-----
> De: insight-users-bounces at itk.org [mailto:insight-users-
> bounces at itk.org] En nombre de Mathieu Malaterre
> Enviado el: lunes, 02 de marzo de 2009 14:12
> Para: wassim_belhadj at topnet.tn
> CC: insight-users at itk.org
> Asunto: Re: [Insight-users] use itk::ImageFileReader to read a dicom
> file without extension ???
> 
> On Mon, Mar 2, 2009 at 12:12 PM,  <wassim_belhadj at topnet.tn> wrote:
> > hi
> > How to use itk::ImageFileReader to read a dicom file without
> extension
> >
> >
> >   typedef   unsigned char                      InternalPixelType;
> >   typedef   unsigned char                      OutputPixelType;
> >   const     unsigned int                       Dimension = 2;
> >
> >   typedef itk::Image< InternalPixelType, Dimension >
> InternalImageType;
> >   typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
> >
> >    typedef  itk::ImageFileReader< InternalImageType > ReaderType;
> >    typedef  itk::ImageFileWriter<  OutputImageType  > WriterType;
> >
> >    ReaderType::Pointer reader = ReaderType::New();
> >    WriterType::Pointer writer = WriterType::New();
> >
> >    ReaderType::Pointer reader = ReaderType::New();
> >    WriterType::Pointer writer = WriterType::New();
> >
> >
> >    reader->SetFileName("IMG0045");
> >
> >    writer->SetFileName( "Res");
> >
> >   .....
> >
> > It does not work -It works when i use The File Extension  like
> IMG0045.dcm
> > and Res. dcm -
> 
> 
> By default itk::GDCMImageIO will properly detects valid DICOM file
> (ref: PS 3.10-2008 from standard) even when no extension is specifiied
> (.dcm is not required by the standard). So your file is not a valid
> DICOM file, it is missing at least the magic number 'DICM' (at Offset
> 128) to properly be detected.
> If this is correct, check with your vendor on how to obtain proper
> (valid) DICOM files.
> 
> 2cts
> --
> Mathieu
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

Hi Mathieu,

Didn't read your answer, Outlook does not properly group conversations :(

A week ago we had exactly the same problem because no ImageIO was
recognizing our extensionless DICOM. Either there is a bug or incorrect
DICOM files are more common than expected. 

We had to force usage of GDCM with SetImageIO(). The problem is I don't
remember which file exactly, I will try to reproduce this.

Regards 

Ivan








More information about the Insight-users mailing list