Hi Luis,<br><br>I was getting a segmentation fault because I had forgotten to change the 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) = 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 processed through the pipeline, is the best approach to manually change the orientation tag of the dictionary and then copy the revised dictionary to the output file?<br>
<br>john<br><br>Below are the full tags:<br><br>[jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags correctedsubject5.dcm <br>(0002|0000) Group Length = 214                                                            <br>
(0002|0001) File Meta Information Version = AAE=                                          <br>(0002|0002) Media Storage SOP Class UID = 1.2.840.10008.5.1.4.1.1.2                       <br>(0002|0003) Media Storage SOP Instance UID = 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811<br>
(0002|0010) Transfer Syntax UID = 1.2.840.10008.1.2.1                                                        <br>(0002|0012) Implementation Class UID = 147.144.143.155                                                       <br>
(0002|0013) Implementation Version Name = ITK/GDCM 1.2.4                                                     <br>(0002|0016) Source Application Entity Title = NOTSPECIFIED                                                   <br>
(0008|0008) Image Type = DERIVED\PRIMARY                                                                     <br>(0008|0012) Instance Creation Date = 20091029                                                                <br>
(0008|0013) Instance Creation Time = 135224                                                                  <br>(0008|0016) SOP Class UID = 1.2.840.10008.5.1.4.1.1.2                                                        <br>
(0008|0018) SOP Instance UID = 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811              <br>(0008|0020) Study Date = 20081030                                                                            <br>
(0008|0030) Study Time = 164348.940                                                                          <br>(0008|0050) Accession Number =                                                                               <br>
(0008|0060) Modality = CT                                                                                    <br>(0008|0064) Conversion Type = WSD                                                                            <br>
(0008|0070) Manufacturer = Manifacturer                                                                      <br>(0008|0080) Institution Name = GDCM Hospital                                                                 <br>
(0008|0090) Referring Physician&#39;s Name = Refering Phisician                                                  <br>(0010|0010) Patient&#39;s Name = Patient 188858520                                                               <br>
(0010|0020) Patient ID = 1747233212                                                                          <br>(0010|0030) Patient&#39;s Birth Date = 19500101                                                                  <br>
(0010|0040) Patient&#39;s Sex = M                                                                                <br>(0018|0088) Spacing Between Slices = 1.207500                                                                <br>
(0018|1164) Imager Pixel Spacing = 0.945750\0.945750                                                         <br>(0020|000d) Study Instance UID = 1.2.826.0.1.3680043.2.1125.1.53653479342656887425609263146205769            <br>
(0020|000e) Series Instance UID = 1.2.826.0.1.3680043.2.1125.1.47155241092896696198844159625679986           <br>(0020|0010) Study ID = 1533117581                                                                            <br>
(0020|0011) Series Number = 2135500125                                                                       <br>(0020|0013) Instance Number = 165                                                                            <br>
(0020|0020) Patient Orientation = L\P                                                                        <br>(0020|0032) Image Position (Patient) = 199.237496852874\0.0\0.0                                              <br>
(0020|0037) Image Orientation (Patient) = 0.0\0.0\-1.0\0.0\1.0\0.0                                           <br>(0020|4000) Image Comments = NOT FOR CLINICAL USE                                                            <br>
(0028|0002) Samples per Pixel = 1                                                                            <br>(0028|0004) Photometric Interpretation = MONOCHROME2                                                         <br>
(0028|0008) Number of Frames = 166                                                                           <br>(0028|0010) Rows = 256                                                                                       <br>
(0028|0011) Columns = 256                                                                                    <br>(0028|0030) Pixel Spacing = 0.945750\0.945750                                                                <br>
(0028|0034) Pixel Aspect Ratio = 1\1                                                                         <br>(0028|0100) Bits Allocated = 16                                                                              <br>
(0028|0101) Bits Stored = 16                                                                                 <br>(0028|0102) High Bit = 15                                                                                    <br>
(0028|0103) Pixel Representation = 0                                                                         <br>(0028|1052) Rescale Intercept = 0.0                                                                          <br>
(0028|1053) Rescale Slope = 1.0                                                                              <br>(0028|1054) Rescale Type = US                                                                                <br>
(7fe0|0000) Group Length = 21757964                                                                          <br>Patient&#39;s Name (0010|0010)  is: Patient 188858520                                                            <br>
Performing Physician&#39;s Name (0008|1050): (No Value Found in File)                                            <br>PixelType: scalar                                                                                            <br>
Component Type: unsigned_short    <br>                                                                           <br>[jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags outsubject5.dcm                    <br>
(0002|0000) Group Length = 194                                                                         <br>(0002|0001) File Meta Information Version = AAE=                                                       <br>(0002|0002) Media Storage SOP Class UID = 1.2.840.10008.5.1.4.1.1.7                                    <br>
(0002|0003) Media Storage SOP Instance UID = 1.2.826.0.1.3680043.2.1143.8995209879494441053058872310646575724<br>(0002|0010) Transfer Syntax UID = 1.2.840.10008.1.2.1                                                        <br>
(0002|0012) Implementation Class UID = 147.144.143.155                                                       <br>(0002|0013) Implementation Version Name = ITK/GDCM 1.2.4                                                     <br>
(0008|0012) Instance Creation Date = 20091126                                                                <br>(0008|0013) Instance Creation Time = 150853                                                                  <br>
(0008|0016) SOP Class UID = 1.2.840.10008.5.1.4.1.1.7                                                        <br>(0008|0018) SOP Instance UID = 1.2.826.0.1.3680043.2.1143.8995209879494441053058872310646575724              <br>
(0008|0020) Study Date = 20091126                                                                            <br>(0008|0030) Study Time = 150853                                                                              <br>
(0008|0050) Accession Number =                                                                               <br>(0008|0060) Modality = OT                                                                                    <br>
(0008|0064) Conversion Type = SYN                                                                            <br>(0008|0070) Manufacturer = GDCM Factory<br>(0008|0080) Institution Name = GDCM Hospital<br>(0008|0090) Referring Physician&#39;s Name =<br>
(0010|0010) Patient&#39;s Name = GDCM^Patient<br>(0010|0020) Patient ID = GDCM ID<br>(0010|0030) Patient&#39;s Birth Date =<br>(0010|0040) Patient&#39;s Sex =<br>(0018|0088) Spacing Between Slices = 1.207500<br>(0018|1164) Imager Pixel Spacing = 0.945750\0.945750<br>
(0020|000d) Study Instance UID = 1.2.826.0.1.3680043.2.1125.1.99663966693826559960117773595375861<br>(0020|000e) Series Instance UID = 1.2.826.0.1.3680043.2.1125.1.80656207154489419332286356071443484<br>(0020|0010) Study ID =<br>
(0020|0011) Series Number =<br>(0020|0013) Instance Number =<br>(0020|0020) Patient Orientation = H\P<br>(0020|0032) Image Position (Patient) = 199.237503\0.000000\0.000000<br>(0020|0037) Image Orientation (Patient) = 0.000000\0.000000\1.000000\0.000000\1.000000\0.000000<br>
(0028|0002) Samples per Pixel = 1<br>(0028|0004) Photometric Interpretation = MONOCHROME2<br>(0028|0008) Number of Frames = 166<br>(0028|0010) Rows = 256<br>(0028|0011) Columns = 256<br>(0028|0030) Pixel Spacing = 0.945750\0.945750<br>
(0028|0100) Bits Allocated = 16<br>(0028|0101) Bits Stored = 16<br>(0028|0102) High Bit = 15<br>(0028|0103) Pixel Representation = 1<br>(7fe0|0000) Group Length = 21757964<br>Patient&#39;s Name (0010|0010)  is: GDCM^Patient<br>
Performing Physician&#39;s Name (0008|1050): (No Value Found in File)<br>PixelType: scalar<br>Component Type: short<br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 2:44 PM, John Drozd <span dir="ltr">&lt;<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>&gt;</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;">Hi Luis:<br><br>Sorry for taking some time to get back to you. I took a break from my computer to refresh my mind so I did an hour of ice skating at our university hockey arena.  I only fell a few times.<br>
<br>Here is the output that you requested:<br>
<br>From the added std::cout statements to my code, I have:<br><br>output from reader-&gt;GetOutput()-&gt;GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>output from castFilter-&gt;GetOutput()-&gt;GetDirection()<br>0 0 1<br>

0 1 0<br>-1 0 0<br><br>output from connectedThreshold-&gt;GetOutput()-&gt;GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>output from caster-&gt;GetOutput()-&gt;GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>Also here are the tag statements from running that you requested:<br>

<i><b>(I get a segmentation fault when I run this program on the output image<br>and I&#39;m trying to figure out why it seg faults on the output image)</b></i><br><br> <br>[jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags correctedsubject5.dcm<br>

(0002|0000) Group Length = 214                                                           <br>(0002|0001) File Meta Information Version = AAE=                                         <br>(0002|0002) Media Storage SOP Class UID = 1.2.840.10008.5.1.4.1.1.2                      <br>

(0002|0003) Media Storage SOP Instance UID = 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811<br>(0002|0010) Transfer Syntax UID = 1.2.840.10008.1.2.1                                                        <br>

(0002|0012) Implementation Class UID = 147.144.143.155                                                       <br>(0002|0013) Implementation Version Name = ITK/GDCM 1.2.4                                                     <br>

(0002|0016) Source Application Entity Title = NOTSPECIFIED                                                   <br>(0008|0008) Image Type = DERIVED\PRIMARY                                                                     <br>

(0008|0012) Instance Creation Date = 20091029                                                                <br>(0008|0013) Instance Creation Time = 135224                                                                  <br>

(0008|0016) SOP Class UID = 1.2.840.10008.5.1.4.1.1.2                                                        <br>(0008|0018) SOP Instance UID = 1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811              <br>

(0008|0020) Study Date = 20081030                                                                            <br>(0008|0030) Study Time = 164348.940                                                                          <br>

(0008|0050) Accession Number =                                                                               <br>(0008|0060) Modality = CT                                                                                    <br>

(0008|0064) Conversion Type = WSD                                                                            <br>(0008|0070) Manufacturer = Manifacturer                                                                      <br>

(0008|0080) Institution Name = GDCM Hospital                                                                 <br>(0008|0090) Referring Physician&#39;s Name = Refering Phisician                                                  <br>

(0010|0010) Patient&#39;s Name = Patient 188858520                                                               <br>(0010|0020) Patient ID = 1747233212                                                                          <br>

(0010|0030) Patient&#39;s Birth Date = 19500101                                                                  <br>(0010|0040) Patient&#39;s Sex = M                                                                                <br>

(0018|0088) Spacing Between Slices = 1.207500<br>(0018|1164) Imager Pixel Spacing = 0.945750\0.945750<br>(0020|000d) Study Instance UID = 1.2.826.0.1.3680043.2.1125.1.53653479342656887425609263146205769<br>(0020|000e) Series Instance UID = 1.2.826.0.1.3680043.2.1125.1.47155241092896696198844159625679986<br>

(0020|0010) Study ID = 1533117581<br>(0020|0011) Series Number = 2135500125<br>(0020|0013) Instance Number = 165<br>(0020|0020) Patient Orientation = L\P<br>(0020|0032) Image Position (Patient) = 199.237496852874\0.0\0.0<br>

(0020|0037) Image Orientation (Patient) = 0.0\0.0\-1.0\0.0\1.0\0.0<br>(0020|4000) Image Comments = NOT FOR CLINICAL USE<br>(0028|0002) Samples per Pixel = 1<br>(0028|0004) Photometric Interpretation = MONOCHROME2<br>(0028|0008) Number of Frames = 166<br>

(0028|0010) Rows = 256<br>(0028|0011) Columns = 256<br>(0028|0030) Pixel Spacing = 0.945750\0.945750<br>(0028|0034) Pixel Aspect Ratio = 1\1<br>(0028|0100) Bits Allocated = 16<br>(0028|0101) Bits Stored = 16<br>(0028|0102) High Bit = 15<br>

(0028|0103) Pixel Representation = 0<br>(0028|1052) Rescale Intercept = 0.0<br>(0028|1053) Rescale Slope = 1.0<br>(0028|1054) Rescale Type = US<br>(7fe0|0000) Group Length = 21757964<br>Patient&#39;s Name (0010|0010)  is: Patient 188858520<br>

Performing Physician&#39;s Name (0008|1050): (No Value Found in File)<br>PixelType: scalar<br>Component Type: unsigned_short<br><br>[jdrozd@trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags outsubject5.dcm<br>Segmentation fault<br>

[jdrozd@trumpet DicomImageReadPrintTags]$<br><br>Thanks,<br><font color="#888888">john</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 1:27 PM, Luis Ibanez <span dir="ltr">&lt;<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>&gt;</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;">Hi John,<br>
<br>
Please use the program:<br>
<br>
    Insight/Examples/IO/DicomImageReadPrintTags.cxx<br>
<br>
To print the DICOM tags of both the input and output images.<br>
<br>
Look for the string:<br>
<br>
                  (0020|0037) Image Orientation (Patient)<br>
<br>
and post the values (for both images) to the mailing list.<br>
<br>
They should have a look similar to:<br>
<br>
(0020|0037) Image Orientation (Patient) =<br>
0.9983222\0.02102422\0.05395257\-0.02105488\0.9997783\1.490116e-08<br>
<br>
----<br>
<br>
<br>
Also add the following print out statements to your code:<br>
<br>
std::cout &lt;&lt; reader-&gt;GetOutput()-&gt;GetDirection() &lt;&lt; std::endl;<br>
std::cout &lt;&lt; casterFilter-&gt;GetOutput()-&gt;GetDirection() &lt;&lt; std::endl;<br>
std::cout &lt;&lt; connectedThreshold-&gt;GetOutput()-&gt;GetDirection() &lt;&lt; std::endl;<br>
std::cout &lt;&lt; caster-&gt;GetOutput()-&gt;GetDirection() &lt;&lt; std::endl;<br>
<br>
after the call to<br>
<br>
                writer-&gt;Update();<br>
<br>
<br>
In this way we could sort out at what level of the process<br>
the Direction information is being lost.<br>
<br>
<br>
     Thanks,<br>
<br>
<br>
            Luis<br>
<br>
<br>
----------------------------------------------------------------------------<br>
<div><div></div><div>On Thu, Nov 26, 2009 at 12:57 PM, John Drozd &lt;<a href="mailto:john.drozd@gmail.com" target="_blank">john.drozd@gmail.com</a>&gt; wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; Can anyone please tell me why my connect threshold segmentation code, where<br>
&gt; I input a 3d dicom brain volume and output a 3d dicom ventricle<br>
&gt; segmentation, gives me my segmentation &quot;upside down&quot; (relative to the<br>
&gt; original inputted image) when I view it in 3D Slicer?  When I output the<br>
&gt; code in any other format eg. .mhd, the segmentation is right side up.<br>
&gt;<br>
&gt; Thank you.<br>
&gt;<br>
&gt; john<br>
&gt;<br>
&gt; Below is my uncommented code:<br>
&gt;<br>
&gt; /*<br>
&gt; to run type:<br>
&gt; ./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm 103<br>
&gt; 142 95 17100 17300<br>
&gt; */<br>
&gt;<br>
&gt; #if defined(_MSC_VER)<br>
&gt; #pragma warning ( disable : 4786 )<br>
&gt; #endif<br>
&gt;<br>
&gt; #ifdef __BORLANDC__<br>
&gt; #define ITK_LEAN_AND_MEAN<br>
&gt; #endif<br>
&gt;<br>
&gt;<br>
&gt; #include &quot;itkConnectedThresholdImageFilter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkImage.h&quot;<br>
&gt; #include &quot;itkCastImageFilter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkCurvatureFlowImageFilter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkImageFileReader.h&quot;<br>
&gt; #include &quot;itkImageFileWriter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkGDCMImageIO.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkVersion.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkOrientedImage.h&quot;<br>
&gt; #include &quot;itkMinimumMaximumImageFilter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkGDCMImageIO.h&quot;<br>
&gt; #include &quot;itkGDCMSeriesFileNames.h&quot;<br>
&gt; #include &quot;itkNumericSeriesFileNames.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkImageSeriesReader.h&quot;<br>
&gt; #include &quot;itkImageSeriesWriter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkResampleImageFilter.h&quot;<br>
&gt; #include &quot;itkShiftScaleImageFilter.h&quot;<br>
&gt;<br>
&gt; #include &quot;itkIdentityTransform.h&quot;<br>
&gt; #include &quot;itkLinearInterpolateImageFunction.h&quot;<br>
&gt;<br>
&gt; #include &lt;itksys/SystemTools.hxx&gt;<br>
&gt;<br>
&gt; #include &quot;gdcm/src/gdcmFile.h&quot;<br>
&gt; #include &quot;gdcm/src/gdcmUtil.h&quot;<br>
&gt;<br>
&gt; #include &lt;string&gt;<br>
&gt;<br>
&gt; int main( int argc, char *argv[])<br>
&gt; {<br>
&gt;   if( argc &lt; 7 )<br>
&gt;     {<br>
&gt;     std::cerr &lt;&lt; &quot;Missing Parameters &quot; &lt;&lt; std::endl;<br>
&gt;     std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0];<br>
&gt;     std::cerr &lt;&lt; &quot; inputImage  outputImage seedX seedY seedZ lowerThreshold<br>
&gt; upperThreshold&quot; &lt;&lt; std::endl;<br>
&gt;<br>
&gt;     return 1;<br>
&gt;     }<br>
&gt;<br>
&gt;   typedef   float           InternalPixelType;<br>
&gt;<br>
&gt;   const     unsigned int    Dimension = 3;<br>
&gt;<br>
&gt;   typedef itk::Image&lt; InternalPixelType, Dimension &gt;  InternalImageType;<br>
&gt;<br>
&gt;   typedef signed short OutputPixelType;<br>
&gt;<br>
&gt;   typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br>
&gt;   typedef itk::Image&lt; float, Dimension &gt; OutputImageType2;<br>
&gt;   typedef itk::CastImageFilter&lt; InternalImageType, OutputImageType &gt;<br>
&gt;     CastingFilterType;<br>
&gt;   CastingFilterType::Pointer caster = CastingFilterType::New();<br>
&gt;<br>
&gt;   const    unsigned int    ImageDimension = 3;<br>
&gt;   typedef  signed short    PixelType;<br>
&gt;<br>
&gt;   typedef itk::Image&lt; PixelType, ImageDimension &gt;  FixedImageType;<br>
&gt;   typedef itk::Image&lt; float, ImageDimension &gt;  FloatImageType;<br>
&gt;<br>
&gt;   typedef  itk::ImageFileReader&lt; FixedImageType &gt; ReaderType;<br>
&gt;   typedef  itk::ImageFileWriter&lt;  OutputImageType  &gt; WriterType;<br>
&gt;   typedef  itk::ImageFileWriter&lt;  FloatImageType  &gt; WriterType2;<br>
&gt;<br>
&gt;   ReaderType::Pointer reader = ReaderType::New();<br>
&gt;   WriterType::Pointer writer = WriterType::New();<br>
&gt;   WriterType2::Pointer writer2 = WriterType2::New();<br>
&gt;<br>
&gt;   typedef itk::GDCMImageIO           ImageIOTypefixed;<br>
&gt;   ImageIOTypefixed::Pointer gdcmImageIOfixed = ImageIOTypefixed::New();<br>
&gt;   reader-&gt;SetImageIO( gdcmImageIOfixed );<br>
&gt;<br>
&gt;   typedef itk::GDCMImageIO           ImageIOTypefixed2;<br>
&gt;   ImageIOTypefixed2::Pointer gdcmImageIOfixed2 = ImageIOTypefixed2::New();<br>
&gt;<br>
&gt;   reader-&gt;SetFileName( argv[1] );<br>
&gt;<br>
&gt;   reader-&gt;Update();<br>
&gt;<br>
&gt;   typedef itk::CurvatureFlowImageFilter&lt; InternalImageType,<br>
&gt; InternalImageType &gt;<br>
&gt;     CurvatureFlowImageFilterType;<br>
&gt;<br>
&gt;   CurvatureFlowImageFilterType::Pointer smoothing =<br>
&gt;                          CurvatureFlowImageFilterType::New();<br>
&gt;<br>
&gt;   typedef itk::ConnectedThresholdImageFilter&lt; InternalImageType,<br>
&gt;                                     InternalImageType &gt; ConnectedFilterType;<br>
&gt;<br>
&gt;   ConnectedFilterType::Pointer connectedThreshold =<br>
&gt; ConnectedFilterType::New();<br>
&gt;<br>
&gt;   typedef signed short InputAPixelType;<br>
&gt;   typedef float OutputBPixelType;<br>
&gt;<br>
&gt;   typedef itk::Image&lt; InputAPixelType, 3 &gt; InputAImageType;<br>
&gt;   typedef itk::Image&lt; OutputBPixelType, 3 &gt; OutputBImageType;<br>
&gt;<br>
&gt;   typedef itk::CastImageFilter&lt; InputAImageType, OutputBImageType &gt;<br>
&gt; CastFilterType;<br>
&gt;<br>
&gt;   CastFilterType::Pointer castFilter = CastFilterType::New();<br>
&gt;<br>
&gt;<br>
&gt;   castFilter-&gt;SetInput( reader-&gt;GetOutput() );<br>
&gt;<br>
&gt;<br>
&gt;   connectedThreshold-&gt;SetInput( castFilter-&gt;GetOutput() );<br>
&gt;<br>
&gt;   caster-&gt;SetInput( connectedThreshold-&gt;GetOutput() );<br>
&gt;<br>
&gt;<br>
&gt;   smoothing-&gt;SetNumberOfIterations( 20 ); //was 5<br>
&gt;   smoothing-&gt;SetTimeStep( 0.125 );<br>
&gt;<br>
&gt;   const InternalPixelType lowerThreshold = atof( argv[6] );<br>
&gt;   const InternalPixelType upperThreshold = atof( argv[7] );<br>
&gt;<br>
&gt;   connectedThreshold-&gt;SetLower(  lowerThreshold  );<br>
&gt;   connectedThreshold-&gt;SetUpper(  upperThreshold  );<br>
&gt;<br>
&gt;   connectedThreshold-&gt;SetReplaceValue( 255 );<br>
&gt;<br>
&gt;   InternalImageType::IndexType  index;<br>
&gt;<br>
&gt;   index[0] = atoi( argv[3] );<br>
&gt;   index[1] = atoi( argv[4] );<br>
&gt;<br>
&gt;   //added<br>
&gt;   index[2] = atoi( argv[5] );<br>
&gt;<br>
&gt;   std::cout &lt;&lt; index &lt;&lt; std::endl;<br>
&gt;<br>
&gt;   // Software Guide : BeginCodeSnippet<br>
&gt;   connectedThreshold-&gt;SetSeed( index );<br>
&gt;<br>
&gt;   //obtain a 5 x 5 bounding region of seeds<br>
&gt;   int ii, jj, kk;<br>
&gt;<br>
&gt;   ii = index[0];<br>
&gt;   jj = index[1];<br>
&gt;   kk = index[2];<br>
&gt;<br>
&gt;   for (int i = ii; i &lt; ii + 5; i++)<br>
&gt;     for (int j = jj; j &lt; jj + 5; j++)<br>
&gt;       for (int k = kk; k &lt; kk + 5; k++)<br>
&gt;     {<br>
&gt;<br>
&gt;       index[0] = i;<br>
&gt;       index[1] = j;<br>
&gt;       index[2] = k;<br>
&gt;       connectedThreshold-&gt;AddSeed( index );<br>
&gt;     }<br>
&gt;<br>
&gt;   for (int i = ii; i &gt; ii - 5; i--)<br>
&gt;     for (int j = jj; j &gt; jj - 5; j--)<br>
&gt;       for (int k = kk; k &gt; kk - 5; k--)<br>
&gt;     {<br>
&gt;<br>
&gt;       index[0] = i;<br>
&gt;       index[1] = j;<br>
&gt;       index[2] = k;<br>
&gt;       connectedThreshold-&gt;AddSeed( index );<br>
&gt;     }<br>
&gt;<br>
&gt;   connectedThreshold-&gt;Print(std::cout,17100);<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;   typedef itk::MetaDataDictionary DictionaryType;<br>
&gt;<br>
&gt;   DictionaryType inputdict = reader-&gt;GetMetaDataDictionary();<br>
&gt;<br>
&gt;   writer-&gt;SetMetaDataDictionary( inputdict );<br>
&gt;<br>
&gt;   writer-&gt;SetFileName( argv[2] );<br>
&gt;<br>
&gt;   writer-&gt;SetInput( caster-&gt;GetOutput() );<br>
&gt;<br>
&gt;   try<br>
&gt;     {<br>
&gt;     writer-&gt;Update();<br>
&gt;     }<br>
&gt;   catch( itk::ExceptionObject &amp; excep )<br>
&gt;     {<br>
&gt;     std::cerr &lt;&lt; &quot;Exception caught !&quot; &lt;&lt; std::endl;<br>
&gt;     std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>
&gt;     }<br>
&gt;<br>
&gt;   return 0;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
</div></div><div><div></div><div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>