<div>Hi Bill,</div>
<div> </div>
<div>You don't have to test my code anymore. Everything is fine now.</div>
<div>There was an error in my CMakeLists.txt file that was causing the seg fault.</div>
<div>I updated my 3DSlicer which updated its ITK and now both my dicom series reader code and my segmentation code works.</div>
<div> </div>
<div>Thanks,</div>
<div>john<br><br></div>
<div class="gmail_quote">On Thu, Dec 3, 2009 at 6:54 PM, John Drozd <span dir="ltr"><<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi Bill,<br><br>Thanks. Of course, try this when you find time. That's fine.<br><br>BUT BEFORE YOU DO ANYTHING, give me a day to download the latest Slicer and CVS and 3.16 to retest my code.<br>
<br>The ITK that my dicom series reader code worked with was ITK 3.14 that came with Slicer 3.4.<br><br>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.<br>
<br>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.<br><br>Thanks,<br><font color="#888888">john</font>
<div>
<div></div>
<div class="h5"><br><br><br>
<div class="gmail_quote">On Thu, Dec 3, 2009 at 4:46 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">I'll take a look, but it won't be for a few days... Can you clarify<br>what version of itk you are referring to? Is it 3.16? If not, is it<br>
the current cvs? There was a bug introduced in the current cvs<br>yesterday. It has been removed. That's why we must know clearly which<br>version you are talking about.<br><font color="#888888"><br>Bill<br></font>
<div>
<div></div>
<div><br>On Thu, Dec 3, 2009 at 3:35 PM, John Drozd <<a href="mailto:john.drozd@gmail.com" target="_blank">john.drozd@gmail.com</a>> wrote:<br>> Hi Bill,<br>><br>> Sorry, but it's getting more complicated with itkGDCMIMageIO.cxx.<br>
><br>> With the previous ITK (the version prior to the rev 1.162 change that you<br>> did to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the<br>> correct orientation):<br>><br>> With this previous ITK, I had code working that read two dicom series and<br>
> wrote them to a 3d dicom single file volume.<br>><br>> Now with the revised ITK (the version with the re 1.162 change that you did<br>> to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the<br>
> correct orientation):<br>><br>> With this revised ITK, my code that reads two dicom series and writes them<br>> to a 3d dicom single file volume.<br>> seg faults.<br>><br>> Could you check this for me please.<br>
><br>> Ideally, I would like my previous segmentation code to output the correct<br>> dicom orientation, and my code that reads dicom series to both work with the<br>> same version of ITK.<br>><br>> Thanks,<br>
> john<br>><br>> You can download my dicom series data as compressed tar.gz from the<br>> following links:<br>><br>> <a href="http://www.apmaths.uwo.ca/~jdrozd/datasubject.tar.gz" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/datasubject.tar.gz</a><br>
><br>> and<br>><br>> <a href="http://www.apmaths.uwo.ca/~jdrozd/datasubject4.tar.gz" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/datasubject4.tar.gz</a><br>><br>> (Prior to running the below code, untar and unzip these two compressed files<br>
> and have them in the same directory as the code executable)<br>><br>> Below is my code:<br>><br>> /* to run ReadAtlasDicomSeriesAndReadSubjectDicomSeries.cxx, compile and<br>> type:<br>> ./ReadAtlasDicomSeriesAndReadSubjectDicomSeries "datasubject"<br>
> "datasubject4/136_S_0429/MPR__GradWarp__B1_Correction__N3__Scaled/2007-06-18_13_28_06.0/S33724/70809234826766_S33724_I66806_Dicom"<br>> */<br>><br>> #if defined(_MSC_VER)<br>> #pragma warning ( disable : 4786 )<br>
> #endif<br>><br>> #include "itkImageFileReader.h"<br>> #include "itkImageFileWriter.h"<br>> #include "itkOrientedImage.h"<br>> #include "itkGDCMImageIO.h"<br>> #include "itkGDCMSeriesFileNames.h"<br>
> #include "itkImageSeriesReader.h"<br>><br>> int main(int argc, char *argv[])<br>> {<br>><br>> typedef short InputPixelType;<br>> const unsigned int InputDimension = 3;<br>><br>> typedef itk::Image< InputPixelType, InputDimension > InputImageType;<br>
><br>> typedef itk::ImageSeriesReader< InputImageType > AtlasReaderSeriesType;<br>><br>> typedef itk::ImageSeriesReader< InputImageType > SubjectReaderSeriesType;<br>><br>> AtlasReaderSeriesType::Pointer movingatlasfilter =<br>
> AtlasReaderSeriesType::New();<br>><br>> SubjectReaderSeriesType::Pointer fixedsubjectfilter =<br>> SubjectReaderSeriesType::New();<br>><br>> typedef itk::GDCMImageIO ImageIOType;<br>><br>
> ImageIOType::Pointer gdcmImageIOAtlas = ImageIOType::New();<br>><br>> ImageIOType::Pointer gdcmImageIOSubject = ImageIOType::New();<br>><br>> fixedsubjectfilter->SetImageIO( gdcmImageIOSubject );<br>
><br>> movingatlasfilter->SetImageIO( gdcmImageIOAtlas );<br>><br>> typedef itk::GDCMSeriesFileNames AtlasNamesGeneratorType;<br>> AtlasNamesGeneratorType::Pointer AtlasnameGenerator =<br>> AtlasNamesGeneratorType::New();<br>
><br>> typedef itk::GDCMSeriesFileNames SubjectNamesGeneratorType;<br>> SubjectNamesGeneratorType::Pointer SubjectnameGenerator =<br>> SubjectNamesGeneratorType::New();<br>><br>> SubjectnameGenerator->SetUseSeriesDetails( true );<br>
> SubjectnameGenerator->AddSeriesRestriction("0008|0021" );<br>><br>> SubjectnameGenerator->SetDirectory( argv[2] );<br>><br>> AtlasnameGenerator->SetUseSeriesDetails( true );<br>> AtlasnameGenerator->AddSeriesRestriction("0008|0021" );<br>
><br>> AtlasnameGenerator->SetDirectory( argv[1] );<br>><br>> try<br>> {<br>> std::cout << std::endl << "The directory: " << std::endl;<br>> std::cout << std::endl << argv[1] << std::endl << std::endl;<br>
> std::cout << "Contains the following Atlas DICOM Series: ";<br>> std::cout << std::endl << std::endl;<br>><br>> typedef std::vector< std::string > AtlasSeriesIdContainer;<br>
><br>> const AtlasSeriesIdContainer & AtlasseriesUID =<br>> AtlasnameGenerator->GetSeriesUIDs();<br>><br>> AtlasSeriesIdContainer::const_iterator AtlasseriesItr =<br>> AtlasseriesUID.begin();<br>
> AtlasSeriesIdContainer::const_iterator AtlasseriesEnd =<br>> AtlasseriesUID.end();<br>> while( AtlasseriesItr != AtlasseriesEnd )<br>> {<br>> std::cout << AtlasseriesItr->c_str() << std::endl;<br>
> AtlasseriesItr++;<br>> }<br>><br>> std::string AtlasseriesIdentifier;<br>><br>> if( argc > 4 ) // If no optional series identifier<br>> {<br>> AtlasseriesIdentifier = argv[3];<br>
> }<br>> else<br>> {<br>> AtlasseriesIdentifier = AtlasseriesUID.begin()->c_str();<br>> }<br>><br>> std::cout << std::endl << std::endl;<br>> std::cout << "Now reading Atlas series: " << std::endl << std::endl;<br>
> std::cout << AtlasseriesIdentifier << std::endl;<br>> std::cout << std::endl << std::endl;<br>><br>> typedef std::vector< std::string > AtlasFileNamesContainer;<br>> AtlasFileNamesContainer AtlasfileNames;<br>
><br>> AtlasfileNames = AtlasnameGenerator->GetFileNames( AtlasseriesIdentifier<br>> );<br>><br>> movingatlasfilter->SetFileNames( AtlasfileNames );<br>><br>><br>> try<br>> {<br>
> movingatlasfilter->Update();<br>> std::cout << "Atlas read successfully" << std::endl;<br>> }<br>> catch (itk::ExceptionObject &ex)<br>> {<br>> std::cout << ex << std::endl;<br>
> return EXIT_FAILURE;<br>> }<br>><br>> typedef itk::ImageFileWriter< InputImageType > AtlasWriterSubjectType;<br>><br>> AtlasWriterSubjectType::Pointer movingatlasfilterwriter =<br>
> AtlasWriterSubjectType::New();<br>><br>><br>> movingatlasfilterwriter->UseInputMetaDataDictionaryOff();<br>> movingatlasfilterwriter->SetImageIO( gdcmImageIOAtlas );<br>><br>><br>> movingatlasfilterwriter->SetFileName( "atlasout.dcm" );<br>
><br>> movingatlasfilterwriter->SetInput( movingatlasfilter->GetOutput() );<br>><br>><br>> try<br>> {<br>> movingatlasfilterwriter->Update();<br>> }<br>> catch (itk::ExceptionObject &ex)<br>
> {<br>> std::cout << ex << std::endl;<br>> return EXIT_FAILURE;<br>> }<br>> }<br>> catch (itk::ExceptionObject &ex)<br>> {<br>> std::cout << ex << std::endl;<br>
> return EXIT_FAILURE;<br>> }<br>><br>> try<br>> {<br>> std::cout << std::endl << "The directory: " << std::endl;<br>> std::cout << std::endl << argv[2] << std::endl << std::endl;<br>
> std::cout << "Contains the following Subject DICOM Series: ";<br>> std::cout << std::endl << std::endl;<br>><br>> typedef std::vector< std::string > SubjectSeriesIdContainer;<br>
><br>> const SubjectSeriesIdContainer & SubjectseriesUID =<br>> SubjectnameGenerator->GetSeriesUIDs();<br>><br>> SubjectSeriesIdContainer::const_iterator SubjectseriesItr =<br>> SubjectseriesUID.begin();<br>
> SubjectSeriesIdContainer::const_iterator SubjectseriesEnd =<br>> SubjectseriesUID.end();<br>> while( SubjectseriesItr != SubjectseriesEnd )<br>> {<br>> std::cout << SubjectseriesItr->c_str() << std::endl;<br>
> SubjectseriesItr++;<br>> }<br>><br>> std::string SubjectseriesIdentifier;<br>><br>> if( argc > 4 ) // If no optional series identifier<br>> {<br>> SubjectseriesIdentifier = argv[2];<br>
> }<br>> else<br>> {<br>> SubjectseriesIdentifier = SubjectseriesUID.begin()->c_str();<br>> }<br>><br>> std::cout << std::endl << std::endl;<br>> std::cout << "Now reading Subject series: " << std::endl << std::endl;<br>
> std::cout << SubjectseriesIdentifier << std::endl;<br>> std::cout << std::endl << std::endl;<br>><br>> typedef std::vector< std::string > SubjectFileNamesContainer;<br>
> SubjectFileNamesContainer SubjectfileNames;<br>><br>> SubjectfileNames = SubjectnameGenerator->GetFileNames(<br>> SubjectseriesIdentifier );<br>><br>> fixedsubjectfilter->SetFileNames( SubjectfileNames );<br>
><br>> try<br>> {<br>> fixedsubjectfilter->Update();<br>> std::cout << "Subject read successfully" << std::endl;<br>> }<br>> catch (itk::ExceptionObject &ex)<br>
> {<br>> std::cout << ex << std::endl;<br>> return EXIT_FAILURE;<br>> }<br>><br>> typedef itk::ImageFileWriter< InputImageType ><br>> SubjectWriterSubjectType;<br>
><br>> SubjectWriterSubjectType::Pointer fixedsubjectfilterwriter =<br>> SubjectWriterSubjectType::New();<br>><br>> fixedsubjectfilterwriter->UseInputMetaDataDictionaryOff();<br>> fixedsubjectfilterwriter->SetImageIO( gdcmImageIOSubject );<br>
><br>> fixedsubjectfilterwriter->SetFileName( "subjectout.dcm" );<br>><br>> fixedsubjectfilterwriter->SetInput( fixedsubjectfilter->GetOutput() );<br>><br>><br>> try<br>> {<br>
> fixedsubjectfilterwriter->Update();<br>> }<br>> catch (itk::ExceptionObject &ex)<br>> {<br>> std::cout << ex << std::endl;<br>> return EXIT_FAILURE;<br>
> }<br>> }<br>> catch (itk::ExceptionObject &ex)<br>> {<br>> std::cout << ex << std::endl;<br>> return EXIT_FAILURE;<br>> }<br>><br>><br>><br>> return EXIT_SUCCESS;<br>
> }<br>><br>><br></div></div></blockquote></div><br></div></div></blockquote></div><br>