Hi Bill,<br><br>I installed the nightly build of 3D Slicer which includes Itk 3.16.<br><br>As you suggested I tried to compile my code with Itk 3.16, to see if the "upside down" problem prevailed, but a new bigger problem exists for me with using Itk 3.16.<br>
<br>I am perplexed that using Itk 3.16, my code segmenation faults when I invoke reader->Update(),<br>for a dicom series or a dicom volume, whereas previously with itk 3.14 it worked just fine.<br><br>I am currently trying to figure out how to set the "-g" compiler option for the CMakeLists.txt file so I can run the gdb debugger on it to find out where it segmentation faults.<br>
<br>I tried the command:<br>set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")<br>but so far that has not worked.<br><br>john <br><br><div class="gmail_quote">On Fri, Nov 27, 2009 at 4:48 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">John,<br>
<br>
Actually, Mathieu reported in response that updating to 3.16 may help.<br>
Can you try this first?<br>
<font color="#888888"><br>
Bill<br>
</font><div><div></div><div class="h5"><br>
On Fri, Nov 27, 2009 at 12:42 PM, John Drozd <<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>> wrote:<br>
> Hi again,<br>
><br>
> I was at home and I just figured out how to provide you this link to my data<br>
> remotely,<br>
> so I provide it now instead of on the weekend:<br>
><br>
> Here is a link to my data (3D dicom volume):<br>
><br>
> input volume for my ConnectedThresholdFilter code:<br>
> <a href="http://www.apmaths.uwo.ca/%7Ejdrozd/correctedsubject5.dcm" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/correctedsubject5.dcm</a><br>
><br>
> output volume from my ConnectedThresholdFilter code:<br>
> <a href="http://www.apmaths.uwo.ca/%7Ejdrozd/outsubject5.dcm" target="_blank">http://www.apmaths.uwo.ca/~jdrozd/outsubject5.dcm</a><br>
><br>
> If you need my CMakeLists.txt file, just let me know.<br>
><br>
> to run the code type:<br>
> ./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm 103<br>
> 142 95 17100 17300<br>
> and here is my code below:<br>
><br>
><br>
><br>
> Below is my uncommented code:<br>
> /*<br>
> to run type:<br>
> ./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm 103<br>
> 142 95 17100 17300<br>
> */<br>
> #if defined(_MSC_VER)<br>
> #pragma warning ( disable : 4786 )<br>
> #endif<br>
> #ifdef __BORLANDC__<br>
> #define ITK_LEAN_AND_MEAN<br>
> #endif<br>
> #include "itkConnectedThresholdImageFilter.h"<br>
> #include "itkImage.h"<br>
> #include "itkCastImageFilter.h"<br>
> #include "itkCurvatureFlowImageFilter.h"<br>
> #include "itkImageFileReader.h"<br>
> #include "itkImageFileWriter.h"<br>
> #include "itkGDCMImageIO.h"<br>
> #include "itkVersion.h"<br>
> #include "itkOrientedImage.h"<br>
> #include "itkMinimumMaximumImageFilter.h"<br>
> #include "itkGDCMImageIO.h"<br>
> #include "itkGDCMSeriesFileNames.h"<br>
> #include "itkNumericSeriesFileNames.h"<br>
> #include "itkImageSeriesReader.h"<br>
> #include "itkImageSeriesWriter.h"<br>
> #include "itkResampleImageFilter.h"<br>
> #include "itkShiftScaleImageFilter.h"<br>
> #include "itkIdentityTransform.h"<br>
> #include "itkLinearInterpolateImageFunction.h"<br>
> #include <itksys/SystemTools.hxx><br>
> #include "gdcm/src/gdcmFile.h"<br>
> #include "gdcm/src/gdcmUtil.h"<br>
> #include <string><br>
> int main( int argc, char *argv[])<br>
> {<br>
> if( argc < 7 )<br>
> {<br>
> std::cerr << "Missing Parameters " << std::endl;<br>
> std::cerr << "Usage: " << argv[0];<br>
> std::cerr << " inputImage outputImage seedX seedY seedZ lowerThreshold<br>
> upperThreshold" << std::endl;<br>
> return 1;<br>
> }<br>
> typedef float InternalPixelType;<br>
><br>
> const unsigned int Dimension = 3;<br>
> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br>
> typedef signed short OutputPixelType;<br>
> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
> typedef itk::Image< float, Dimension > OutputImageType2;<br>
> typedef itk::CastImageFilter< InternalImageType, OutputImageType ><br>
> CastingFilterType;<br>
> CastingFilterType::Pointer caster = CastingFilterType::New();<br>
><br>
> const unsigned int ImageDimension = 3;<br>
> typedef signed short PixelType;<br>
> typedef itk::Image< PixelType, ImageDimension > FixedImageType;<br>
> typedef itk::Image< float, ImageDimension > FloatImageType;<br>
> typedef itk::ImageFileReader< FixedImageType > ReaderType;<br>
> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br>
> typedef itk::ImageFileWriter< FloatImageType > WriterType2;<br>
> ReaderType::Pointer reader = ReaderType::New();<br>
> WriterType::Pointer writer = WriterType::New();<br>
> WriterType2::Pointer writer2 = WriterType2::New();<br>
> typedef itk::GDCMImageIO ImageIOTypefixed;<br>
> ImageIOTypefixed::Pointer gdcmImageIOfixed = ImageIOTypefixed::New();<br>
> reader->SetImageIO( gdcmImageIOfixed );<br>
> typedef itk::GDCMImageIO ImageIOTypefixed2;<br>
> ImageIOTypefixed2::Pointer gdcmImageIOfixed2 = ImageIOTypefixed2::New();<br>
> reader->SetFileName( argv[1] );<br>
> reader->Update();<br>
> typedef itk::CurvatureFlowImageFilter< InternalImageType,<br>
> InternalImageType ><br>
> CurvatureFlowImageFilterType;<br>
><br>
> CurvatureFlowImageFilterType::Pointer smoothing =<br>
> CurvatureFlowImageFilterType::New();<br>
> typedef itk::ConnectedThresholdImageFilter< InternalImageType,<br>
> InternalImageType > ConnectedFilterType;<br>
> ConnectedFilterType::Pointer connectedThreshold =<br>
> ConnectedFilterType::New();<br>
> typedef signed short InputAPixelType;<br>
> typedef float OutputBPixelType;<br>
> typedef itk::Image< InputAPixelType, 3 > InputAImageType;<br>
> typedef itk::Image< OutputBPixelType, 3 > OutputBImageType;<br>
> typedef itk::CastImageFilter< InputAImageType, OutputBImageType ><br>
> CastFilterType;<br>
> CastFilterType::Pointer castFilter = CastFilterType::New();<br>
> castFilter->SetInput( reader->GetOutput() );<br>
><br>
> connectedThreshold->SetInput( castFilter->GetOutput() );<br>
> caster->SetInput( connectedThreshold->GetOutput() );<br>
> smoothing->SetNumberOfIterations( 20 ); //was 5<br>
> smoothing->SetTimeStep( 0.125 );<br>
><br>
> const InternalPixelType lowerThreshold = atof( argv[6] );<br>
> const InternalPixelType upperThreshold = atof( argv[7] );<br>
><br>
> connectedThreshold->SetLower( lowerThreshold );<br>
> connectedThreshold->SetUpper( upperThreshold );<br>
><br>
> connectedThreshold->SetReplaceValue( 255 );<br>
> InternalImageType::IndexType index;<br>
><br>
> index[0] = atoi( argv[3] );<br>
> index[1] = atoi( argv[4] );<br>
><br>
> //added<br>
> index[2] = atoi( argv[5] );<br>
> std::cout << index << std::endl;<br>
> // Software Guide : BeginCodeSnippet<br>
> connectedThreshold->SetSeed( index );<br>
><br>
> //obtain a 5 x 5 bounding region of seeds<br>
> int ii, jj, kk;<br>
> ii = index[0];<br>
> jj = index[1];<br>
> kk = index[2];<br>
> for (int i = ii; i < ii + 5; i++)<br>
> for (int j = jj; j < jj + 5; j++)<br>
> for (int k = kk; k < kk + 5; k++)<br>
> {<br>
><br>
> index[0] = i;<br>
> index[1] = j;<br>
> index[2] = k;<br>
> connectedThreshold->AddSeed( index );<br>
> }<br>
> for (int i = ii; i > ii - 5; i--)<br>
> for (int j = jj; j > jj - 5; j--)<br>
> for (int k = kk; k > kk - 5; k--)<br>
> {<br>
><br>
> index[0] = i;<br>
> index[1] = j;<br>
> index[2] = k;<br>
> connectedThreshold->AddSeed( index );<br>
> }<br>
> connectedThreshold->Print(std::cout,17100);<br>
><br>
> typedef itk::MetaDataDictionary DictionaryType;<br>
><br>
> DictionaryType inputdict = reader->GetMetaDataDictionary();<br>
><br>
> writer->SetMetaDataDictionary( inputdict );<br>
><br>
> writer->SetFileName( argv[2] );<br>
><br>
> writer->SetInput( caster->GetOutput() );<br>
> try<br>
> {<br>
> writer->Update();<br>
> }<br>
> catch( itk::ExceptionObject & excep )<br>
> {<br>
> std::cerr << "Exception caught !" << std::endl;<br>
> std::cerr << excep << std::endl;<br>
> }<br>
> return 0;<br>
> On Fri, Nov 27, 2009 at 12:31 PM, John Drozd <<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> I originally have a dicom series of 2d slices which I had converted to a<br>
>> 3D dicom volume for processing.<br>
>> I'll try processing the dicom series and then write the output to a dicom<br>
>> series of 2d slices, to see if I can circumvent this problem.<br>
>> I'll let you know if this works?<br>
>><br>
>> I'll provide a link to my data as well, but it probably won't be until the<br>
>> weekend.<br>
>><br>
>> Thanks,<br>
>> john<br>
>><br>
>> On Fri, Nov 27, 2009 at 12:23 PM, Mathieu Malaterre<br>
>> <<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>> wrote:<br>
>>><br>
>>> This is a post ITK 3.16 feature I am afraid:<br>
>>><br>
>>> <a href="http://www.cmake.org/Bug/view.php?id=7748" target="_blank">http://www.cmake.org/Bug/view.php?id=7748</a><br>
>>><br>
>>> (0017626)<br>
>>> Mathieu.Malaterre (developer)<br>
>>> 2009-09-19 06:51<br>
>>><br>
>>> This will be post ITK 3.16.<br>
>>><br>
>>> Thanks for the patch ! Sorry for being so long to fix it.<br>
>>><br>
>>> On Fri, Nov 27, 2009 at 6:11 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>>> wrote:<br>
>>> > John,<br>
>>> ><br>
>>> > 3.16 will not help. This looks like a bug for sure.<br>
>>> ><br>
>>> > Can you provide a link to a dataset that we can use to reproduce the<br>
>>> > problem? We don't have much experience with 3D dicom files I'm afraid.<br>
>>> ><br>
>>> > Bill<br>
>>> ><br>
>>> > On Fri, Nov 27, 2009 at 11:59 AM, John Drozd <<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>><br>
>>> > wrote:<br>
>>> >> Hi Bill,<br>
>>> >><br>
>>> >> I am currently using the ITK 3.14 that is in the 3D Slicer 3.4<br>
>>> >> directory Slicer3-lib/Insight<br>
>>> >><br>
>>> >> If I upgrade to ITK 3.16, will this solve my problem?<br>
>>> >><br>
>>> >> I downloaded ITK 3.16 and noticed using the diff command that<br>
>>> >> itkGDCMIO.h has been modified from what it was in ITK 3.14.<br>
>>> >><br>
>>> >> But when I ran diff on gdcmOrientation.cxx in both versions of ITK,<br>
>>> >> diff showed no difference.<br>
>>> >><br>
>>> >> John<br>
>>> >><br>
>>> >> On Friday, November 27, 2009, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >>> John,<br>
>>> >>><br>
>>> >>> What version of itk are you using? Are you using the gdcm 1.x that is<br>
>>> >>> in the itk source tree or an external gdcm 2.x version?<br>
>>> >>><br>
>>> >>> Bill<br>
>>> >>><br>
>>> >>> On Thu, Nov 26, 2009 at 3:22 PM, John Drozd <<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>><br>
>>> >>> wrote:<br>
>>> >>>> Hi Luis,<br>
>>> >>>><br>
>>> >>>> I was getting a segmentation fault because I had forgotten to change<br>
>>> >>>> the<br>
>>> >>>> Dimension from 2 to 3 in DicomReadPrintTag.cxx.<br>
>>> >>>><br>
>>> >>>> For the input image, I have:<br>
>>> >>>> (0020|0037) Image Orientation (Patient) = 0.0\0.0\-1.0\0.0\1.0\0.0<br>
>>> >>>><br>
>>> >>>> For the output image, I have:<br>
>>> >>>> (0020|0037) Image Orientation (Patient) =<br>
>>> >>>> 0.000000\0.000000\1.000000\0.000000\1.000000\0.000000<br>
>>> >>>><br>
>>> >>>> There is a difference. Since the program is changing the<br>
>>> >>>> orientation when<br>
>>> >>>> processed through the pipeline, is the best approach to manually<br>
>>> >>>> change the<br>
>>> >>>> orientation tag of the dictionary and then copy the revised<br>
>>> >>>> dictionary to<br>
>>> >>>> the output file?<br>
>>> >>>><br>
>>> >>>> john<br>
>>> >>>><br>
>>> >>>> Below are the full tags:<br>
>>> >>>><br>
>>> >>>> [jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags<br>
>>> >>>> correctedsubject5.dcm<br>
>>> >>>> (0002|0000) Group Length =<br>
>>> >>>> 214<br>
>>> >>>> (0002|0001) File Meta Information Version =<br>
>>> >>>> AAE=<br>
>>> >>>> (0002|0002) Media Storage SOP Class UID =<br>
>>> >>>> 1.2.840.10008.5.1.4.1.1.2<br>
>>> >>>> (0002|0003) Media Storage SOP Instance UID =<br>
>>> >>>> 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811<br>
>>> >>>> (0002|0010) Transfer Syntax UID =<br>
>>> >>>> 1.2.840.10008.1.2.1<br>
>>> >>>> (0002|0012) Implementation Class UID =<br>
>>> >>>> 147.144.143.155<br>
>>> >>>> (0002|0013) Implementation Version Name = ITK/GDCM<br>
>>> >>>> 1.2.4<br>
>>> >>>> (0002|0016) Source Application Entity Title =<br>
>>> >>>> NOTSPECIFIED<br>
>>> >>>> (0008|0008) Image Type =<br>
>>> >>>> DERIVED\PRIMARY<br>
>>> >>>> (0008|0012) Instance Creation Date =<br>
>>> >>>> 20091029<br>
>>> >>>> (0008|0013) Instance Creation Time =<br>
>>> >>>> 135224<br>
>>> >>>> (0008|0016) SOP Class UID =<br>
>>> >>>> 1.2.840.10008.5.1.4.1.1.2<br>
>>> >>>> (0008|0018) SOP Instance UID =<br>
>>> >>>> 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811<br>
>>> >>>> (0008|0020) Study Date =<br>
>>> >>>> 20081030<br>
>>> >>>> (0008|0030) Study Time =<br>
>>> >>>> 164348.940<br>
>>> >>>> (0008|0050) Accession Number<br>
>>> >>>> =<br>
>>> >>>> (0008|0060) Modality =<br>
>>> >>>> CT<br>
>>> >>>> (0008|0064) Conversion Type =<br>
>>> >>>> WSD<br>
>>> >>>> (0008|0070) Manufacturer =<br>
>>> >>>> Manifacturer<br>
>>> >>>> (0008|0080) Institution Name = GDCM<br>
>>> >>>> Hospital<br>
>>> >>>> (0008|0090) Referring Physician's Name = Refering<br>
>>> >>>> Phisician<br>
>>> >>>> (0010|0010) Patient's Name = Patient<br>
>>> >>>> 188858520<br>
>>> >>>> (0010|0020) Patient ID =<br>
>>> >>>> 1747233212<br>
>>> >>>> (0010|0030) Patient's Birth Date =<br>
>>> >>>> 19500101<br>
>>> >>>> (0010|0040) Patient's Sex =<br>
>>> >>>> M<br>
>>> >>>> (0018|0088) Spacing Between Slices =<br>
>>> >>>> 1.207500<br>
>>> >>>> (0018|1164) Imager Pixel Spacing =<br>
>>> >>>> 0.945750\0.945750<br>
>>> >>>> (0020|000d) Study Instance UID =<br>
>>> >>>> 1.2.826.0.1.3680043.2.1125.1.53653479342656887425609263146205769<br>
>>> >>>> (0020|000e) Series Instance UID =<br>
>>> >>>> 1.2.826.0.1.3680043.2.1125.1.47155241092896696198844159625679986<br>
>>> >>>> (0020|0010) Study ID =<br>
>>> >>>> 1533117581<br>
>>> >>>> (0020|0011) Series Number =<br>
>>> >>>> 2135500125<br>
>>> >>>> (0020|0013) Instance Number =<br>
>>> >>>> 165<br>
>>> >>>> (0020|0020) Patient Orientation =<br>
>>> >>>> L\P<br>
>>> >>>> (0020|0032) Image Position (Patient) =<br>
>>> >>>> 199.237496852874\0.0\0.0<br>
>>> >>>> (0020|0037) Image Orientation (Patient) =<br>
>>> >>>> 0.0\0.0\-1.0\0.0\1.0\0.0<br>
>>> >>>> (0020|4000) Image Comments = NOT FOR CLINICAL<br>
>>> >>>> USE<br>
>>> >>>> (0028|0002) Samples per Pixel =<br>
>>> >>>> 1<br>
>>> >>>> (0028|0004) Photometric Interpretation =<br>
>>> >>>> MONOCHROME2<br>
>>> >>>> (0028|0008) Number of Frames =<br>
>>> >>>> 166<br>
>>> >>>> (0028|0010) Rows =<br>
>>> >>>> 256<br>
>>> >>>> (0028|0011) Columns =<br>
>>> >>>> 256<br>
>>> >>>> (0028|0030) Pixel Spacing =<br>
>>> >>>> 0.945750\0.945750<br>
>>> >>>> (0028|0034) Pixel Aspect Ratio =<br>
>>> >>>> 1\1<br>
>>> >>>> (0028|0100) Bits Allocated =<br>
>>> >>>> 16<br>
>>> >>>> (0028|0101) Bits Stored =<br>
>>> >>>> 16<br>
>>> >>>> (0028|0102) High Bit =<br>
>>> >>>> 15<br>
>>> >>>> (0028|0103) Pixel Representation =<br>
>>> >>>> 0<br>
>>> >>>> (0028|1052) Rescale Intercept =<br>
>>> >>>> 0.0<br>
>>> >>>> (0028|1053) Rescale Slope =<br>
>>> >>>> 1.0<br>
>>> >>>> (0028|1054) Rescale Type =<br>
>>> >>>> US<br>
>>> >>>> (7fe0|0000) Group Length =<br>
>>> >>>> 21757964<br>
>>> >>>> Patient's Name (0010|0010) is: Patient<br>
>>> >>>> 188858520<br>
>>> >>>> Performing Physician's Name (0008|1050): (No Value Found in<br>
>>> >>>> File)<br>
>>> >>>> PixelType:<br>
>>> >>>> scalar<br>
>>> >>>> Component Type: unsigned_short<br>
>>> >>>><br>
>>> >>>> [jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags<br>
>>> >>>> outsubject5.dcm<br>
>>> >>>> (0002|0000) Group Length =<br>
>>> >>>> 194<br>
>>> >>>> (0002|00<br>
>>> >><br>
>>> > _____________________________________<br>
>>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>> ><br>
>>> > Visit other Kitware open-source projects at<br>
>>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>> ><br>
>>> > Kitware offers ITK Training Courses, for more information visit:<br>
>>> > <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
>>> ><br>
>>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>> ><br>
>>> > Follow this link to subscribe/unsubscribe:<br>
>>> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Mathieu<br>
>><br>
><br>
><br>
</div></div></blockquote></div><br>