<div>Hi again,</div>
<div> </div>
<div>I was at home and I just figured out how to provide you this link to my data remotely,</div>
<div>so I provide it now instead of on the weekend:</div>
<div> </div>
<div>Here is a link to my data (3D dicom volume):</div>
<div> </div>
<div>input volume for my ConnectedThresholdFilter code: </div>
<div><a href="http://www.apmaths.uwo.ca/~jdrozd/correctedsubject5.dcm">http://www.apmaths.uwo.ca/~jdrozd/correctedsubject5.dcm</a></div>
<div> </div>
<div>output volume from my ConnectedThresholdFilter code:</div>
<div><a href="http://www.apmaths.uwo.ca/~jdrozd/outsubject5.dcm">http://www.apmaths.uwo.ca/~jdrozd/outsubject5.dcm</a></div>
<div> </div>
<div>If you need my CMakeLists.txt file, just let me know.</div>
<div> </div>
<div>to run the code type:<br>./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm 103 142 95 17100 17300<br></div>
<div>and here is my code below:</div>
<div> </div>
<div> </div>
<div> </div>
<div>Below is my uncommented code:</div>
<div>/*<br>to run type:<br>./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm 103 142 95 17100 17300<br>*/</div>
<div>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif</div>
<div>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif</div>
<div><br>#include "itkConnectedThresholdImageFilter.h"</div>
<div>#include "itkImage.h"<br>#include "itkCastImageFilter.h"</div>
<div>#include "itkCurvatureFlowImageFilter.h"</div>
<div>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"</div>
<div>#include "itkGDCMImageIO.h"</div>
<div>#include "itkVersion.h"</div>
<div>#include "itkOrientedImage.h"<br>#include "itkMinimumMaximumImageFilter.h"</div>
<div>#include "itkGDCMImageIO.h"<br>#include "itkGDCMSeriesFileNames.h"<br>#include "itkNumericSeriesFileNames.h"</div>
<div>#include "itkImageSeriesReader.h"<br>#include "itkImageSeriesWriter.h"</div>
<div>#include "itkResampleImageFilter.h"<br>#include "itkShiftScaleImageFilter.h"</div>
<div>#include "itkIdentityTransform.h"<br>#include "itkLinearInterpolateImageFunction.h"</div>
<div>#include <itksys/SystemTools.hxx></div>
<div>#include "gdcm/src/gdcmFile.h"<br>#include "gdcm/src/gdcmUtil.h"</div>
<div>#include <string></div>
<div>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 upperThreshold" << std::endl;</div>
<div> return 1;<br> }</div>
<div> typedef float InternalPixelType;<br> <br> const unsigned int Dimension = 3;</div>
<div> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;</div>
<div> typedef signed short OutputPixelType;</div>
<div> 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;</div>
<div> typedef itk::Image< PixelType, ImageDimension > FixedImageType;<br> typedef itk::Image< float, ImageDimension > FloatImageType;</div>
<div> typedef itk::ImageFileReader< FixedImageType > ReaderType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br> typedef itk::ImageFileWriter< FloatImageType > WriterType2;</div>
<div> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> WriterType2::Pointer writer2 = WriterType2::New();</div>
<div> typedef itk::GDCMImageIO ImageIOTypefixed;<br> ImageIOTypefixed::Pointer gdcmImageIOfixed = ImageIOTypefixed::New();<br> reader->SetImageIO( gdcmImageIOfixed );</div>
<div> typedef itk::GDCMImageIO ImageIOTypefixed2;<br> ImageIOTypefixed2::Pointer gdcmImageIOfixed2 = ImageIOTypefixed2::New();</div>
<div> reader->SetFileName( argv[1] );</div>
<div> reader->Update();</div>
<div> typedef itk::CurvatureFlowImageFilter< InternalImageType, InternalImageType ><br> CurvatureFlowImageFilterType;<br> <br> CurvatureFlowImageFilterType::Pointer smoothing = <br> CurvatureFlowImageFilterType::New();</div>
<div> typedef itk::ConnectedThresholdImageFilter< InternalImageType, <br> InternalImageType > ConnectedFilterType;</div>
<div> ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();</div>
<div> typedef signed short InputAPixelType;<br> typedef float OutputBPixelType;</div>
<div> typedef itk::Image< InputAPixelType, 3 > InputAImageType;<br> typedef itk::Image< OutputBPixelType, 3 > OutputBImageType; </div>
<div> typedef itk::CastImageFilter< InputAImageType, OutputBImageType > CastFilterType;</div>
<div> CastFilterType::Pointer castFilter = CastFilterType::New();</div>
<div><br> castFilter->SetInput( reader->GetOutput() );<br> </div>
<div> connectedThreshold->SetInput( castFilter->GetOutput() );</div>
<div> caster->SetInput( connectedThreshold->GetOutput() );</div>
<div><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 );</div>
<div> 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] );</div>
<div> std::cout << index << std::endl;</div>
<div> // Software Guide : BeginCodeSnippet<br> connectedThreshold->SetSeed( index );<br> <br> //obtain a 5 x 5 bounding region of seeds<br> int ii, jj, kk;</div>
<div> ii = index[0];<br> jj = index[1];<br> kk = index[2];</div>
<div> 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> }</div>
<div> 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> }</div>
<div> connectedThreshold->Print(std::cout,17100);</div>
<div><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() );</div>
<div> 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>
}</div>
<div> return 0;<br></div>
<div class="gmail_quote">On Fri, Nov 27, 2009 at 12:31 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">
<div>Hi all,</div>
<div> </div>
<div>I originally have a dicom series of 2d slices which I had converted to a 3D dicom volume for processing.</div>
<div>I'll try processing the dicom series and then write the output to a dicom series of 2d slices, to see if I can circumvent this problem.</div>
<div>I'll let you know if this works?</div>
<div> </div>
<div>I'll provide a link to my data as well, but it probably won't be until the weekend.</div>
<div> </div>
<div>Thanks,</div>
<div>john<font color="#888888"><br><br></font></div>
<div>
<div></div>
<div class="h5">
<div class="gmail_quote">On Fri, Nov 27, 2009 at 12:23 PM, Mathieu Malaterre <span dir="ltr"><<a href="mailto:mathieu.malaterre@gmail.com" target="_blank">mathieu.malaterre@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">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>
<div>
<div></div>
<div><br>On Fri, Nov 27, 2009 at 6:11 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> 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" target="_blank">john.drozd@gmail.com</a>> 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" target="_blank">bill.lorensen@gmail.com</a>> 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" target="_blank">john.drozd@gmail.com</a>> wrote:<br>>>>> Hi Luis,<br>>>>><br>>>>> I was getting a segmentation fault because I had forgotten to change 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 orientation when<br>>>>> processed through the pipeline, is the best approach to manually change the<br>>>>> orientation tag of the dictionary and then copy the revised 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></div></div>
<div>> _____________________________________<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></div>--<br><font color="#888888">Mathieu<br></font></blockquote>
</div><br></div></div></blockquote></div><br>