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

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Mar 2 08:12:23 EST 2009


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


More information about the Insight-users mailing list