[Insight-users] dicom series read

G G greenlander1986 at gmail.com
Tue Mar 29 05:12:02 EDT 2011


I think yes, I open this dicom series in ITK-SNAP without problems
When I use only \Examples\IO\DicomSeriesReadSeriesWrite.cxx
everything works fine, but when I use in my code it is wrong...

2011/3/29 John Drescher <drescherjm at gmail.com>

> On Tue, Mar 29, 2011 at 3:21 AM, G G <greenlander1986 at gmail.com> wrote:
> > Hi I have so problem with dicom series read...
> >
> > I have this code for reading... I used this from
> > \Examples\IO\DicomSeriesReadSeriesWrite.cxx
> >
> >     typedef unsigned char /*signed short*/     PixelType;
> >     const unsigned int      InputDimension = 3;
> >
> >     typedef itk::Image< PixelType, InputDimension >      ImageType;
> >     typedef itk::ImageSeriesReader< ImageType >             ReaderType;
> >
> >     typedef itk::GDCMImageIO                        ImageIOType;
> >     typedef itk::GDCMSeriesFileNames                NamesGeneratorType;
> >
> >     ImageIOType::Pointer gdcmIO = ImageIOType::New();
> >     NamesGeneratorType::Pointer namesGenerator =
> NamesGeneratorType::New();
> >
> >     size_t found = path.find_last_of("/\\");
> >     std::string str = path.substr(0,found);
> >
> >     namesGenerator->SetInputDirectory( str.c_str() );
> >     const ReaderType::FileNamesContainer & filenames =
> > namesGenerator->GetInputFileNames();
> >
> >     ReaderType::Pointer reader = ReaderType::New();
> >     reader->SetImageIO( gdcmIO );
> >     reader->SetFileNames( filenames );
> >
> >     try
> >     {
> >         reader->Update();
> >     }
> >     catch (itk::ExceptionObject &e)
> >     {
> >         cerr << e << endl;
> >         return;
> >     }
> >
> >     typedef unsigned char /*signed short*/ /*float*/
> > PixelType2;
> >     const   unsigned int                      OutputDimension = 3;
> >     typedef itk::Image< PixelType2, OutputDimension >  OutputImageType;
> >
> >
> >
> >     typedef itk::ImageToVTKImageFilter< OutputImageType > ConnectorType;
> >
> >
> >     ConnectorType::Pointer connector = ConnectorType::New();
> >
> >     connector->SetInput(reader->GetOutput());
> >     // ... continue and display image in QvtkWidget
> >
> > but when I am trying load dicom series I get this
> >
> > WARNING: In ..\..\..\..\src\Insight\Code\IO\itkGDCMImageIO.cxx, line 348
> > GDCMImageIO (02B4A198): The DICOM file:
> > C:/InsightApplications-3.20.0/src/muj_test4/Release/neco2/image004.dcm
> does
> > not have a preamble.
> >
> > Could someone help me please?
> > Thanks a lot
> >
>
> Does that file have 128 bytes before the DICM header?
>
> http://www.leadtools.com/SDK/medical/dicom-spec1.htm
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110329/232a5c58/attachment-0001.htm>


More information about the Insight-users mailing list