[Insight-users] dicom series read

G G greenlander1986 at gmail.com
Tue Mar 29 03:21:14 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110329/72be0438/attachment.htm>


More information about the Insight-users mailing list