<div>Hi Bill,</div>
<div> </div>
<div>You don&#39;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">&lt;<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>&gt;</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&#39;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&#39;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">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</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&#39;ll take a look, but it won&#39;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&#39;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 &lt;<a href="mailto:john.drozd@gmail.com" target="_blank">john.drozd@gmail.com</a>&gt; wrote:<br>&gt; Hi Bill,<br>&gt;<br>&gt; Sorry, but it&#39;s getting more complicated with itkGDCMIMageIO.cxx.<br>
&gt;<br>&gt; With the previous ITK (the version prior to the rev 1.162 change that you<br>&gt; did to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the<br>&gt; correct orientation):<br>&gt;<br>&gt; With this previous ITK, I had code working that read two dicom series and<br>
&gt; wrote them to a 3d dicom single file volume.<br>&gt;<br>&gt; Now with the revised ITK (the version with the re 1.162 change that you did<br>&gt; to itkGDCMIMageIO.cxx so my outputted 3d dicom volume would be in the<br>
&gt; correct orientation):<br>&gt;<br>&gt; With this revised ITK, my code that reads two dicom series and writes them<br>&gt; to a 3d dicom single file volume.<br>&gt; seg faults.<br>&gt;<br>&gt; Could you check this for me please.<br>
&gt;<br>&gt; Ideally, I would like my previous segmentation code to output the correct<br>&gt; dicom orientation, and my code that reads dicom series to both work with the<br>&gt; same version of ITK.<br>&gt;<br>&gt; Thanks,<br>
&gt; john<br>&gt;<br>&gt; You can download my dicom series data as compressed tar.gz from the<br>&gt; following links:<br>&gt;<br>&gt; <a href="http://www.apmaths.uwo.ca/~jdrozd/datasubject.tar.gz" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/datasubject.tar.gz</a><br>
&gt;<br>&gt; and<br>&gt;<br>&gt; <a href="http://www.apmaths.uwo.ca/~jdrozd/datasubject4.tar.gz" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/datasubject4.tar.gz</a><br>&gt;<br>&gt; (Prior to running the below code, untar and unzip these two compressed files<br>
&gt; and have them in the same directory as the code executable)<br>&gt;<br>&gt; Below is my code:<br>&gt;<br>&gt; /* to run ReadAtlasDicomSeriesAndReadSubjectDicomSeries.cxx, compile and<br>&gt; type:<br>&gt; ./ReadAtlasDicomSeriesAndReadSubjectDicomSeries &quot;datasubject&quot;<br>
&gt; &quot;datasubject4/136_S_0429/MPR__GradWarp__B1_Correction__N3__Scaled/2007-06-18_13_28_06.0/S33724/70809234826766_S33724_I66806_Dicom&quot;<br>&gt; */<br>&gt;<br>&gt; #if defined(_MSC_VER)<br>&gt; #pragma warning ( disable : 4786 )<br>
&gt; #endif<br>&gt;<br>&gt; #include &quot;itkImageFileReader.h&quot;<br>&gt; #include &quot;itkImageFileWriter.h&quot;<br>&gt; #include &quot;itkOrientedImage.h&quot;<br>&gt; #include &quot;itkGDCMImageIO.h&quot;<br>&gt; #include &quot;itkGDCMSeriesFileNames.h&quot;<br>
&gt; #include &quot;itkImageSeriesReader.h&quot;<br>&gt;<br>&gt; int main(int argc, char *argv[])<br>&gt; {<br>&gt;<br>&gt;   typedef short InputPixelType;<br>&gt;   const unsigned int   InputDimension = 3;<br>&gt;<br>&gt;   typedef itk::Image&lt; InputPixelType, InputDimension &gt; InputImageType;<br>
&gt;<br>&gt;   typedef itk::ImageSeriesReader&lt; InputImageType &gt; AtlasReaderSeriesType;<br>&gt;<br>&gt;   typedef itk::ImageSeriesReader&lt; InputImageType &gt; SubjectReaderSeriesType;<br>&gt;<br>&gt;   AtlasReaderSeriesType::Pointer movingatlasfilter =<br>
&gt; AtlasReaderSeriesType::New();<br>&gt;<br>&gt;   SubjectReaderSeriesType::Pointer fixedsubjectfilter =<br>&gt; SubjectReaderSeriesType::New();<br>&gt;<br>&gt;  typedef itk::GDCMImageIO           ImageIOType;<br>&gt;<br>
&gt;   ImageIOType::Pointer gdcmImageIOAtlas = ImageIOType::New();<br>&gt;<br>&gt;   ImageIOType::Pointer gdcmImageIOSubject = ImageIOType::New();<br>&gt;<br>&gt;   fixedsubjectfilter-&gt;SetImageIO( gdcmImageIOSubject );<br>
&gt;<br>&gt;   movingatlasfilter-&gt;SetImageIO( gdcmImageIOAtlas );<br>&gt;<br>&gt; typedef itk::GDCMSeriesFileNames AtlasNamesGeneratorType;<br>&gt;   AtlasNamesGeneratorType::Pointer AtlasnameGenerator =<br>&gt; AtlasNamesGeneratorType::New();<br>
&gt;<br>&gt; typedef itk::GDCMSeriesFileNames SubjectNamesGeneratorType;<br>&gt;   SubjectNamesGeneratorType::Pointer SubjectnameGenerator =<br>&gt; SubjectNamesGeneratorType::New();<br>&gt;<br>&gt;   SubjectnameGenerator-&gt;SetUseSeriesDetails( true );<br>
&gt;   SubjectnameGenerator-&gt;AddSeriesRestriction(&quot;0008|0021&quot; );<br>&gt;<br>&gt;   SubjectnameGenerator-&gt;SetDirectory( argv[2] );<br>&gt;<br>&gt;   AtlasnameGenerator-&gt;SetUseSeriesDetails( true );<br>&gt;   AtlasnameGenerator-&gt;AddSeriesRestriction(&quot;0008|0021&quot; );<br>
&gt;<br>&gt;   AtlasnameGenerator-&gt;SetDirectory( argv[1] );<br>&gt;<br>&gt; try<br>&gt;     {<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; &quot;The directory: &quot; &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; argv[1] &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&gt;     std::cout &lt;&lt; &quot;Contains the following Atlas DICOM Series: &quot;;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;<br>&gt; typedef std::vector&lt; std::string &gt;    AtlasSeriesIdContainer;<br>
&gt;<br>&gt;     const AtlasSeriesIdContainer &amp; AtlasseriesUID =<br>&gt; AtlasnameGenerator-&gt;GetSeriesUIDs();<br>&gt;<br>&gt;     AtlasSeriesIdContainer::const_iterator AtlasseriesItr =<br>&gt; AtlasseriesUID.begin();<br>
&gt;     AtlasSeriesIdContainer::const_iterator AtlasseriesEnd =<br>&gt; AtlasseriesUID.end();<br>&gt;     while( AtlasseriesItr != AtlasseriesEnd )<br>&gt;       {<br>&gt;       std::cout &lt;&lt; AtlasseriesItr-&gt;c_str() &lt;&lt; std::endl;<br>
&gt;       AtlasseriesItr++;<br>&gt;       }<br>&gt;<br>&gt; std::string AtlasseriesIdentifier;<br>&gt;<br>&gt;     if( argc &gt; 4 ) // If no optional series identifier<br>&gt;       {<br>&gt;       AtlasseriesIdentifier = argv[3];<br>
&gt;       }<br>&gt;     else<br>&gt;       {<br>&gt;       AtlasseriesIdentifier = AtlasseriesUID.begin()-&gt;c_str();<br>&gt;       }<br>&gt;<br>&gt; std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; &quot;Now reading Atlas series: &quot; &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&gt;     std::cout &lt;&lt; AtlasseriesIdentifier &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;<br>&gt; typedef std::vector&lt; std::string &gt;   AtlasFileNamesContainer;<br>&gt;     AtlasFileNamesContainer AtlasfileNames;<br>
&gt;<br>&gt;     AtlasfileNames = AtlasnameGenerator-&gt;GetFileNames( AtlasseriesIdentifier<br>&gt; );<br>&gt;<br>&gt;     movingatlasfilter-&gt;SetFileNames( AtlasfileNames );<br>&gt;<br>&gt;<br>&gt;     try<br>&gt;       {<br>
&gt;       movingatlasfilter-&gt;Update();<br>&gt;       std::cout &lt;&lt; &quot;Atlas read successfully&quot;  &lt;&lt; std::endl;<br>&gt;       }<br>&gt;     catch (itk::ExceptionObject &amp;ex)<br>&gt;       {<br>&gt;       std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>
&gt;       return EXIT_FAILURE;<br>&gt;       }<br>&gt;<br>&gt;       typedef itk::ImageFileWriter&lt; InputImageType &gt; AtlasWriterSubjectType;<br>&gt;<br>&gt;   AtlasWriterSubjectType::Pointer movingatlasfilterwriter =<br>
&gt; AtlasWriterSubjectType::New();<br>&gt;<br>&gt;<br>&gt;   movingatlasfilterwriter-&gt;UseInputMetaDataDictionaryOff();<br>&gt;   movingatlasfilterwriter-&gt;SetImageIO( gdcmImageIOAtlas );<br>&gt;<br>&gt;<br>&gt; movingatlasfilterwriter-&gt;SetFileName( &quot;atlasout.dcm&quot; );<br>
&gt;<br>&gt; movingatlasfilterwriter-&gt;SetInput( movingatlasfilter-&gt;GetOutput() );<br>&gt;<br>&gt;<br>&gt; try<br>&gt;       {<br>&gt;       movingatlasfilterwriter-&gt;Update();<br>&gt;       }<br>&gt;     catch (itk::ExceptionObject &amp;ex)<br>
&gt;       {<br>&gt;       std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;       return EXIT_FAILURE;<br>&gt;       }<br>&gt;     }<br>&gt;   catch (itk::ExceptionObject &amp;ex)<br>&gt;     {<br>&gt;     std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>
&gt;     return EXIT_FAILURE;<br>&gt;     }<br>&gt;<br>&gt;     try<br>&gt;     {<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; &quot;The directory: &quot; &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; argv[2] &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&gt;     std::cout &lt;&lt; &quot;Contains the following Subject DICOM Series: &quot;;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;<br>&gt; typedef std::vector&lt; std::string &gt;    SubjectSeriesIdContainer;<br>
&gt;<br>&gt;     const SubjectSeriesIdContainer &amp; SubjectseriesUID =<br>&gt; SubjectnameGenerator-&gt;GetSeriesUIDs();<br>&gt;<br>&gt;     SubjectSeriesIdContainer::const_iterator SubjectseriesItr =<br>&gt; SubjectseriesUID.begin();<br>
&gt;     SubjectSeriesIdContainer::const_iterator SubjectseriesEnd =<br>&gt; SubjectseriesUID.end();<br>&gt;     while( SubjectseriesItr != SubjectseriesEnd )<br>&gt;       {<br>&gt;       std::cout &lt;&lt; SubjectseriesItr-&gt;c_str() &lt;&lt; std::endl;<br>
&gt;       SubjectseriesItr++;<br>&gt;       }<br>&gt;<br>&gt; std::string SubjectseriesIdentifier;<br>&gt;<br>&gt;     if( argc &gt; 4 ) // If no optional series identifier<br>&gt;       {<br>&gt;       SubjectseriesIdentifier = argv[2];<br>
&gt;       }<br>&gt;     else<br>&gt;       {<br>&gt;       SubjectseriesIdentifier = SubjectseriesUID.begin()-&gt;c_str();<br>&gt;       }<br>&gt;<br>&gt; std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; &quot;Now reading Subject series: &quot; &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&gt;     std::cout &lt;&lt; SubjectseriesIdentifier &lt;&lt; std::endl;<br>&gt;     std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>&gt;<br>&gt; typedef std::vector&lt; std::string &gt;   SubjectFileNamesContainer;<br>
&gt;     SubjectFileNamesContainer SubjectfileNames;<br>&gt;<br>&gt;     SubjectfileNames = SubjectnameGenerator-&gt;GetFileNames(<br>&gt; SubjectseriesIdentifier );<br>&gt;<br>&gt;     fixedsubjectfilter-&gt;SetFileNames( SubjectfileNames );<br>
&gt;<br>&gt;     try<br>&gt;       {<br>&gt;       fixedsubjectfilter-&gt;Update();<br>&gt;       std::cout &lt;&lt; &quot;Subject read successfully&quot;  &lt;&lt; std::endl;<br>&gt;       }<br>&gt;     catch (itk::ExceptionObject &amp;ex)<br>
&gt;       {<br>&gt;       std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;       return EXIT_FAILURE;<br>&gt;       }<br>&gt;<br>&gt;       typedef itk::ImageFileWriter&lt; InputImageType &gt;<br>&gt; SubjectWriterSubjectType;<br>
&gt;<br>&gt;   SubjectWriterSubjectType::Pointer fixedsubjectfilterwriter =<br>&gt; SubjectWriterSubjectType::New();<br>&gt;<br>&gt;   fixedsubjectfilterwriter-&gt;UseInputMetaDataDictionaryOff();<br>&gt;   fixedsubjectfilterwriter-&gt;SetImageIO( gdcmImageIOSubject );<br>
&gt;<br>&gt;   fixedsubjectfilterwriter-&gt;SetFileName( &quot;subjectout.dcm&quot; );<br>&gt;<br>&gt;   fixedsubjectfilterwriter-&gt;SetInput( fixedsubjectfilter-&gt;GetOutput() );<br>&gt;<br>&gt;<br>&gt; try<br>&gt;       {<br>
&gt;       fixedsubjectfilterwriter-&gt;Update();<br>&gt;       }<br>&gt;     catch (itk::ExceptionObject &amp;ex)<br>&gt;       {<br>&gt;       std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;       return EXIT_FAILURE;<br>
&gt;       }<br>&gt;       }<br>&gt;   catch (itk::ExceptionObject &amp;ex)<br>&gt;     {<br>&gt;     std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;     return EXIT_FAILURE;<br>&gt;     }<br>&gt;<br>&gt;<br>&gt;<br>&gt; return EXIT_SUCCESS;<br>
&gt; }<br>&gt;<br>&gt;<br></div></div></blockquote></div><br></div></div></blockquote></div><br>