[Insight-users] now my dicom series reader seg faults with the changes

John Drozd john.drozd at gmail.com
Thu Dec 3 18:54:55 EST 2009


Hi Bill,

Thanks.  Of course, try this when you find time.  That's fine.

BUT BEFORE YOU DO ANYTHING, give me a day to download the latest Slicer and
CVS and 3.16 to retest my code.

The ITK that my dicom series reader code worked with was ITK 3.14 that came
with Slicer 3.4.

The ITK that my dicom series reader code seg faults with is the ITK that
came with the 3D Slicer 3.5 alpha download that I downloaded on 2009-12-02
15:43.  I believe that this version of Slicer that I downloaded has ITK 3.16
with the fix that you did to establish the correct orientation, because with
this version of ITK, I get the correct orientation from my segmentation code
that I sent a few days ago.

I've also tested the CVS that I downloaded on 2009-12-01 12:07 and my dicom
series reader code seg faults as well.

Thanks,
john


On Thu, Dec 3, 2009 at 4:46 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> I'll take a look, but it won't be for a few days... Can you clarify
> what version of itk you are referring to? Is it 3.16? If not, is it
> the current cvs? There was a bug introduced in the current cvs
> yesterday. It has been removed. That's why we must know clearly which
> version you are talking about.
>
> Bill
>
> On Thu, Dec 3, 2009 at 3:35 PM, John Drozd <john.drozd at gmail.com> wrote:
> > Hi Bill,
> >
> > Sorry, but it's getting more complicated with itkGDCMIMageIO.cxx.
> >
> > With the previous ITK (the version prior to the rev 1.162 change that you
> > did to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the
> > correct orientation):
> >
> > With this previous ITK, I had code working that read two dicom series and
> > wrote them to a 3d dicom single file volume.
> >
> > Now with the revised ITK (the version with the re 1.162 change that you
> did
> > to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the
> > correct orientation):
> >
> > With this revised ITK, my code that reads two dicom series and writes
> them
> > to a 3d dicom single file volume.
> > seg faults.
> >
> > Could you check this for me please.
> >
> > Ideally, I would like my previous segmentation code to output the correct
> > dicom orientation, and my code that reads dicom series to both work with
> the
> > same version of ITK.
> >
> > Thanks,
> > john
> >
> > You can download my dicom series data as compressed tar.gz from the
> > following links:
> >
> > http://www.apmaths.uwo.ca/~jdrozd/datasubject.tar.gz<http://www.apmaths.uwo.ca/%7Ejdrozd/datasubject.tar.gz>
> >
> > and
> >
> > http://www.apmaths.uwo.ca/~jdrozd/datasubject4.tar.gz<http://www.apmaths.uwo.ca/%7Ejdrozd/datasubject4.tar.gz>
> >
> > (Prior to running the below code, untar and unzip these two compressed
> files
> > and have them in the same directory as the code executable)
> >
> > Below is my code:
> >
> > /* to run ReadAtlasDicomSeriesAndReadSubjectDicomSeries.cxx, compile and
> > type:
> > ./ReadAtlasDicomSeriesAndReadSubjectDicomSeries "datasubject"
> >
> "datasubject4/136_S_0429/MPR__GradWarp__B1_Correction__N3__Scaled/2007-06-18_13_28_06.0/S33724/70809234826766_S33724_I66806_Dicom"
> > */
> >
> > #if defined(_MSC_VER)
> > #pragma warning ( disable : 4786 )
> > #endif
> >
> > #include "itkImageFileReader.h"
> > #include "itkImageFileWriter.h"
> > #include "itkOrientedImage.h"
> > #include "itkGDCMImageIO.h"
> > #include "itkGDCMSeriesFileNames.h"
> > #include "itkImageSeriesReader.h"
> >
> > int main(int argc, char *argv[])
> > {
> >
> >   typedef short InputPixelType;
> >   const unsigned int   InputDimension = 3;
> >
> >   typedef itk::Image< InputPixelType, InputDimension > InputImageType;
> >
> >   typedef itk::ImageSeriesReader< InputImageType > AtlasReaderSeriesType;
> >
> >   typedef itk::ImageSeriesReader< InputImageType >
> SubjectReaderSeriesType;
> >
> >   AtlasReaderSeriesType::Pointer movingatlasfilter =
> > AtlasReaderSeriesType::New();
> >
> >   SubjectReaderSeriesType::Pointer fixedsubjectfilter =
> > SubjectReaderSeriesType::New();
> >
> >  typedef itk::GDCMImageIO           ImageIOType;
> >
> >   ImageIOType::Pointer gdcmImageIOAtlas = ImageIOType::New();
> >
> >   ImageIOType::Pointer gdcmImageIOSubject = ImageIOType::New();
> >
> >   fixedsubjectfilter->SetImageIO( gdcmImageIOSubject );
> >
> >   movingatlasfilter->SetImageIO( gdcmImageIOAtlas );
> >
> > typedef itk::GDCMSeriesFileNames AtlasNamesGeneratorType;
> >   AtlasNamesGeneratorType::Pointer AtlasnameGenerator =
> > AtlasNamesGeneratorType::New();
> >
> > typedef itk::GDCMSeriesFileNames SubjectNamesGeneratorType;
> >   SubjectNamesGeneratorType::Pointer SubjectnameGenerator =
> > SubjectNamesGeneratorType::New();
> >
> >   SubjectnameGenerator->SetUseSeriesDetails( true );
> >   SubjectnameGenerator->AddSeriesRestriction("0008|0021" );
> >
> >   SubjectnameGenerator->SetDirectory( argv[2] );
> >
> >   AtlasnameGenerator->SetUseSeriesDetails( true );
> >   AtlasnameGenerator->AddSeriesRestriction("0008|0021" );
> >
> >   AtlasnameGenerator->SetDirectory( argv[1] );
> >
> > try
> >     {
> >     std::cout << std::endl << "The directory: " << std::endl;
> >     std::cout << std::endl << argv[1] << std::endl << std::endl;
> >     std::cout << "Contains the following Atlas DICOM Series: ";
> >     std::cout << std::endl << std::endl;
> >
> > typedef std::vector< std::string >    AtlasSeriesIdContainer;
> >
> >     const AtlasSeriesIdContainer & AtlasseriesUID =
> > AtlasnameGenerator->GetSeriesUIDs();
> >
> >     AtlasSeriesIdContainer::const_iterator AtlasseriesItr =
> > AtlasseriesUID.begin();
> >     AtlasSeriesIdContainer::const_iterator AtlasseriesEnd =
> > AtlasseriesUID.end();
> >     while( AtlasseriesItr != AtlasseriesEnd )
> >       {
> >       std::cout << AtlasseriesItr->c_str() << std::endl;
> >       AtlasseriesItr++;
> >       }
> >
> > std::string AtlasseriesIdentifier;
> >
> >     if( argc > 4 ) // If no optional series identifier
> >       {
> >       AtlasseriesIdentifier = argv[3];
> >       }
> >     else
> >       {
> >       AtlasseriesIdentifier = AtlasseriesUID.begin()->c_str();
> >       }
> >
> > std::cout << std::endl << std::endl;
> >     std::cout << "Now reading Atlas series: " << std::endl << std::endl;
> >     std::cout << AtlasseriesIdentifier << std::endl;
> >     std::cout << std::endl << std::endl;
> >
> > typedef std::vector< std::string >   AtlasFileNamesContainer;
> >     AtlasFileNamesContainer AtlasfileNames;
> >
> >     AtlasfileNames = AtlasnameGenerator->GetFileNames(
> AtlasseriesIdentifier
> > );
> >
> >     movingatlasfilter->SetFileNames( AtlasfileNames );
> >
> >
> >     try
> >       {
> >       movingatlasfilter->Update();
> >       std::cout << "Atlas read successfully"  << std::endl;
> >       }
> >     catch (itk::ExceptionObject &ex)
> >       {
> >       std::cout << ex << std::endl;
> >       return EXIT_FAILURE;
> >       }
> >
> >       typedef itk::ImageFileWriter< InputImageType >
> AtlasWriterSubjectType;
> >
> >   AtlasWriterSubjectType::Pointer movingatlasfilterwriter =
> > AtlasWriterSubjectType::New();
> >
> >
> >   movingatlasfilterwriter->UseInputMetaDataDictionaryOff();
> >   movingatlasfilterwriter->SetImageIO( gdcmImageIOAtlas );
> >
> >
> > movingatlasfilterwriter->SetFileName( "atlasout.dcm" );
> >
> > movingatlasfilterwriter->SetInput( movingatlasfilter->GetOutput() );
> >
> >
> > try
> >       {
> >       movingatlasfilterwriter->Update();
> >       }
> >     catch (itk::ExceptionObject &ex)
> >       {
> >       std::cout << ex << std::endl;
> >       return EXIT_FAILURE;
> >       }
> >     }
> >   catch (itk::ExceptionObject &ex)
> >     {
> >     std::cout << ex << std::endl;
> >     return EXIT_FAILURE;
> >     }
> >
> >     try
> >     {
> >     std::cout << std::endl << "The directory: " << std::endl;
> >     std::cout << std::endl << argv[2] << std::endl << std::endl;
> >     std::cout << "Contains the following Subject DICOM Series: ";
> >     std::cout << std::endl << std::endl;
> >
> > typedef std::vector< std::string >    SubjectSeriesIdContainer;
> >
> >     const SubjectSeriesIdContainer & SubjectseriesUID =
> > SubjectnameGenerator->GetSeriesUIDs();
> >
> >     SubjectSeriesIdContainer::const_iterator SubjectseriesItr =
> > SubjectseriesUID.begin();
> >     SubjectSeriesIdContainer::const_iterator SubjectseriesEnd =
> > SubjectseriesUID.end();
> >     while( SubjectseriesItr != SubjectseriesEnd )
> >       {
> >       std::cout << SubjectseriesItr->c_str() << std::endl;
> >       SubjectseriesItr++;
> >       }
> >
> > std::string SubjectseriesIdentifier;
> >
> >     if( argc > 4 ) // If no optional series identifier
> >       {
> >       SubjectseriesIdentifier = argv[2];
> >       }
> >     else
> >       {
> >       SubjectseriesIdentifier = SubjectseriesUID.begin()->c_str();
> >       }
> >
> > std::cout << std::endl << std::endl;
> >     std::cout << "Now reading Subject series: " << std::endl <<
> std::endl;
> >     std::cout << SubjectseriesIdentifier << std::endl;
> >     std::cout << std::endl << std::endl;
> >
> > typedef std::vector< std::string >   SubjectFileNamesContainer;
> >     SubjectFileNamesContainer SubjectfileNames;
> >
> >     SubjectfileNames = SubjectnameGenerator->GetFileNames(
> > SubjectseriesIdentifier );
> >
> >     fixedsubjectfilter->SetFileNames( SubjectfileNames );
> >
> >     try
> >       {
> >       fixedsubjectfilter->Update();
> >       std::cout << "Subject read successfully"  << std::endl;
> >       }
> >     catch (itk::ExceptionObject &ex)
> >       {
> >       std::cout << ex << std::endl;
> >       return EXIT_FAILURE;
> >       }
> >
> >       typedef itk::ImageFileWriter< InputImageType >
> > SubjectWriterSubjectType;
> >
> >   SubjectWriterSubjectType::Pointer fixedsubjectfilterwriter =
> > SubjectWriterSubjectType::New();
> >
> >   fixedsubjectfilterwriter->UseInputMetaDataDictionaryOff();
> >   fixedsubjectfilterwriter->SetImageIO( gdcmImageIOSubject );
> >
> >   fixedsubjectfilterwriter->SetFileName( "subjectout.dcm" );
> >
> >   fixedsubjectfilterwriter->SetInput( fixedsubjectfilter->GetOutput() );
> >
> >
> > try
> >       {
> >       fixedsubjectfilterwriter->Update();
> >       }
> >     catch (itk::ExceptionObject &ex)
> >       {
> >       std::cout << ex << std::endl;
> >       return EXIT_FAILURE;
> >       }
> >       }
> >   catch (itk::ExceptionObject &ex)
> >     {
> >     std::cout << ex << std::endl;
> >     return EXIT_FAILURE;
> >     }
> >
> >
> >
> > return EXIT_SUCCESS;
> > }
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091203/5fe3df4c/attachment-0001.htm>


More information about the Insight-users mailing list