No subject


Wed Oct 7 22:37:18 EDT 2009


output from reader->GetOutput()->GetDirection()
0 0 1
0 1 0
-1 0 0

output from castFilter->GetOutput()->GetDirection()
0 0 1
0 1 0
-1 0 0

output from connectedThreshold->GetOutput()->GetDirection()
0 0 1
0 1 0
-1 0 0

output from caster->GetOutput()->GetDirection()
0 0 1
0 1 0
-1 0 0

Also here are the tag statements from running that you requested:
*(I get a segmentation fault when I run this program on the output image
and I'm trying to figure out why it seg faults on the output image)*


[jdrozd at trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags
correctedsubject5.dcm
(0002|0000) Group Length =
214
(0002|0001) File Meta Information Version =
AAE=
(0002|0002) Media Storage SOP Class UID =
1.2.840.10008.5.1.4.1.1.2
(0002|0003) Media Storage SOP Instance UID =
1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811
(0002|0010) Transfer Syntax UID =
1.2.840.10008.1.2.1
(0002|0012) Implementation Class UID =
147.144.143.155
(0002|0013) Implementation Version Name = ITK/GDCM
1.2.4
(0002|0016) Source Application Entity Title =
NOTSPECIFIED
(0008|0008) Image Type =
DERIVED\PRIMARY

(0008|0012) Instance Creation Date =
20091029
(0008|0013) Instance Creation Time =
135224
(0008|0016) SOP Class UID =
1.2.840.10008.5.1.4.1.1.2

(0008|0018) SOP Instance UID =
1.2.826.0.1.3680043.2.1125.1.10607669833050788267094246636093811

(0008|0020) Study Date =
20081030

(0008|0030) Study Time =
164348.940

(0008|0050) Accession Number
=

(0008|0060) Modality =
CT

(0008|0064) Conversion Type =
WSD

(0008|0070) Manufacturer =
Manifacturer

(0008|0080) Institution Name = GDCM
Hospital
(0008|0090) Referring Physician's Name = Refering
Phisician
(0010|0010) Patient's Name = Patient
188858520
(0010|0020) Patient ID =
1747233212

(0010|0030) Patient's Birth Date =
19500101
(0010|0040) Patient's Sex =
M

(0018|0088) Spacing Between Slices = 1.207500
(0018|1164) Imager Pixel Spacing = 0.945750\0.945750
(0020|000d) Study Instance UID =
1.2.826.0.1.3680043.2.1125.1.53653479342656887425609263146205769
(0020|000e) Series Instance UID =
1.2.826.0.1.3680043.2.1125.1.47155241092896696198844159625679986
(0020|0010) Study ID = 1533117581
(0020|0011) Series Number = 2135500125
(0020|0013) Instance Number = 165
(0020|0020) Patient Orientation = L\P
(0020|0032) Image Position (Patient) = 199.237496852874\0.0\0.0
(0020|0037) Image Orientation (Patient) = 0.0\0.0\-1.0\0.0\1.0\0.0
(0020|4000) Image Comments = NOT FOR CLINICAL USE
(0028|0002) Samples per Pixel = 1
(0028|0004) Photometric Interpretation = MONOCHROME2
(0028|0008) Number of Frames = 166
(0028|0010) Rows = 256
(0028|0011) Columns = 256
(0028|0030) Pixel Spacing = 0.945750\0.945750
(0028|0034) Pixel Aspect Ratio = 1\1
(0028|0100) Bits Allocated = 16
(0028|0101) Bits Stored = 16
(0028|0102) High Bit = 15
(0028|0103) Pixel Representation = 0
(0028|1052) Rescale Intercept = 0.0
(0028|1053) Rescale Slope = 1.0
(0028|1054) Rescale Type = US
(7fe0|0000) Group Length = 21757964
Patient's Name (0010|0010)  is: Patient 188858520
Performing Physician's Name (0008|1050): (No Value Found in File)
PixelType: scalar
Component Type: unsigned_short

[jdrozd at trumpet DicomImageReadPrintTags]$ ./DicomImageReadPrintTags
outsubject5.dcm
Segmentation fault
[jdrozd at trumpet DicomImageReadPrintTags]$

Thanks,
john


On Thu, Nov 26, 2009 at 1:27 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:

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

--000e0ce0b72628b33504794b66a4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Luis:<br><br>Sorry for taking some time to get back to you. I took a bre=
ak from my computer to refresh my mind so I did an hour of ice skating at o=
ur university hockey arena.=A0 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 f=
rom reader-&gt;GetOutput()-&gt;GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<b=
r><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;G=
etDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>output from caster-&gt;Get=
Output()-&gt;GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>Also here ar=
e the tag statements from running that you requested:<br>
<i><b>(I get a segmentation fault when I run this program on the output ima=
ge<br>and I&#39;m trying to figure out why it seg faults on the output imag=
e)</b></i><br><br>=A0<br>[jdrozd at trumpet DicomImageReadPrintTags]$ ./DicomI=
mageReadPrintTags correctedsubject5.dcm<br>
(0002|0000) Group Length =3D 214=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>(0002|0001) F=
ile Meta Information Version =3D AAE=3D=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 <br>(0002|0002) Media Storage SOP Class UID =3D 1.2.840.10008.5.1=
.4.1.1.2=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br=
>
(0002|0003) Media Storage SOP Instance UID =3D 1.2.826.0.1.3680043.2.1125.1=
.10607669833050788267094246636093811<br>(0002|0010) Transfer Syntax UID =3D=
 1.2.840.10008.1.2.1=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>
(0002|0012) Implementation Class UID =3D 147.144.143.155=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>(=
0002|0013) Implementation Version Name =3D ITK/GDCM 1.2.4=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>
(0002|0016) Source Application Entity Title =3D NOTSPECIFIED=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>(0008|0008=
) Image Type =3D DERIVED\PRIMARY=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 <br>
(0008|0012) Instance Creation Date =3D 20091029=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 <br>(0008|0013) Instance Creation Time =3D 135224=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>
(0008|0016) SOP Class UID =3D 1.2.840.10008.5.1.4.1.1.2=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <b=
r>(0008|0018) SOP Instance UID =3D 1.2.826.0.1.3680043.2.1125.1.10607669833=
050788267094246636093811=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>
(0008|0020) Study Date =3D 20081030=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>(0008|0030) Study Time =3D 164348.=
940=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <b=
r>
(0008|0050) Accession Number =3D=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0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A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 <br>(0010|0040) Patient&#39;s Sex =3D M=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 <br>
(0018|0088) Spacing Between Slices =3D 1.207500<br>(0018|1164) Imager Pixel=
 Spacing =3D 0.945750\0.945750<br>(0020|000d) Study Instance UID =3D 1.2.82=
6.0.1.3680043.2.1125.1.53653479342656887425609263146205769<br>(0020|000e) S=
eries Instance UID =3D 1.2.826.0.1.3680043.2.1125.1.47155241092896696198844=
159625679986<br>
(0020|0010) Study ID =3D 1533117581<br>(0020|0011) Series Number =3D 213550=
0125<br>(0020|0013) Instance Number =3D 165<br>(0020|0020) Patient Orientat=
ion =3D L\P<br>(0020|0032) Image Position (Patient) =3D 199.237496852874\0.=
0\0.0<br>
(0020|0037) Image Orientation (Patient) =3D 0.0\0.0\-1.0\0.0\1.0\0.0<br>(00=
20|4000) Image Comments =3D NOT FOR CLINICAL USE<br>(0028|0002) Samples per=
 Pixel =3D 1<br>(0028|0004) Photometric Interpretation =3D MONOCHROME2<br>(=
0028|0008) Number of Frames =3D 166<br>
(0028|0010) Rows =3D 256<br>(0028|0011) Columns =3D 256<br>(0028|0030) Pixe=
l Spacing =3D 0.945750\0.945750<br>(0028|0034) Pixel Aspect Ratio =3D 1\1<b=
r>(0028|0100) Bits Allocated =3D 16<br>(0028|0101) Bits Stored =3D 16<br>(0=
028|0102) High Bit =3D 15<br>
(0028|0103) Pixel Representation =3D 0<br>(0028|1052) Rescale Intercept =3D=
 0.0<br>(0028|1053) Rescale Slope =3D 1.0<br>(0028|1054) Rescale Type =3D U=
S<br>(7fe0|0000) Group Length =3D 21757964<br>Patient&#39;s Name (0010|0010=
)=A0 is: Patient 188858520<br>
Performing Physician&#39;s Name (0008|1050): (No Value Found in File)<br>Pi=
xelType: scalar<br>Component Type: unsigned_short<br><br>[jdrozd at trumpet Di=
comImageReadPrintTags]$ ./DicomImageReadPrintTags outsubject5.dcm<br>Segmen=
tation fault<br>
[jdrozd at trumpet DicomImageReadPrintTags]$<br><br>Thanks,<br>john<br><br><br=
><div class=3D"gmail_quote">On Thu, Nov 26, 2009 at 1:27 PM, Luis Ibanez <s=
pan dir=3D"ltr">&lt;<a href=3D"mailto:luis.ibanez at kitware.com">luis.ibanez@=
kitware.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"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>
 =A0 =A0Insight/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>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(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) =3D<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() &l=
t;&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>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0writer-&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>
 =A0 =A0 Thanks,<br>
<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0Luis<br>
<br>
<br>
---------------------------------------------------------------------------=
-<br>
<div><div></div><div class=3D"h5">On Thu, Nov 26, 2009 at 12:57 PM, John Dr=
ozd &lt;<a href=3D"mailto:john.drozd at gmail.com">john.drozd at 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; (relati=
ve to the<br>
&gt; original inputted image) when I view it in 3D Slicer?=A0 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; =A0 if( argc &lt; 7 )<br>
&gt; =A0=A0=A0 {<br>
&gt; =A0=A0=A0 std::cerr &lt;&lt; &quot;Missing Parameters &quot; &lt;&lt; =
std::endl;<br>
&gt; =A0=A0=A0 std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0];<br>
&gt; =A0=A0=A0 std::cerr &lt;&lt; &quot; inputImage=A0 outputImage seedX se=
edY seedZ lowerThreshold<br>
&gt; upperThreshold&quot; &lt;&lt; std::endl;<br>
&gt;<br>
&gt; =A0=A0=A0 return 1;<br>
&gt; =A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 typedef=A0=A0 float=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 InternalPixelTyp=
e;<br>
&gt;<br>
&gt; =A0 const=A0=A0=A0=A0 unsigned int=A0=A0=A0 Dimension =3D 3;<br>
&gt;<br>
&gt; =A0 typedef itk::Image&lt; InternalPixelType, Dimension &gt;=A0 Intern=
alImageType;<br>
&gt;<br>
&gt; =A0 typedef signed short OutputPixelType;<br>
&gt;<br>
&gt; =A0 typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImage=
Type;<br>
&gt; =A0 typedef itk::Image&lt; float, Dimension &gt; OutputImageType2;<br>
&gt; =A0 typedef itk::CastImageFilter&lt; InternalImageType, OutputImageTyp=
e &gt;<br>
&gt; =A0=A0=A0 CastingFilterType;<br>
&gt; =A0 CastingFilterType::Pointer caster =3D CastingFilterType::New();<br=
>
&gt;<br>
&gt; =A0 const=A0=A0=A0 unsigned int=A0=A0=A0 ImageDimension =3D 3;<br>
&gt; =A0 typedef=A0 signed short=A0=A0=A0 PixelType;<br>
&gt;<br>
&gt; =A0 typedef itk::Image&lt; PixelType, ImageDimension &gt;=A0 FixedImag=
eType;<br>
&gt; =A0 typedef itk::Image&lt; float, ImageDimension &gt;=A0 FloatImageTyp=
e;<br>
&gt;<br>
&gt; =A0 typedef=A0 itk::ImageFileReader&lt; FixedImageType &gt; ReaderType=
;<br>
&gt; =A0 typedef=A0 itk::ImageFileWriter&lt;=A0 OutputImageType=A0 &gt; Wri=
terType;<br>
&gt; =A0 typedef=A0 itk::ImageFileWriter&lt;=A0 FloatImageType=A0 &gt; Writ=
erType2;<br>
&gt;<br>
&gt; =A0 ReaderType::Pointer reader =3D ReaderType::New();<br>
&gt; =A0 WriterType::Pointer writer =3D WriterType::New();<br>
&gt; =A0 WriterType2::Pointer writer2 =3D WriterType2::New();<br>
&gt;<br>
&gt; =A0 typedef itk::GDCMImageIO=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageIOType=
fixed;<br>
&gt; =A0 ImageIOTypefixed::Pointer gdcmImageIOfixed =3D ImageIOTypefixed::N=
ew();<br>
&gt; =A0 reader-&gt;SetImageIO( gdcmImageIOfixed );<br>
&gt;<br>
&gt; =A0 typedef itk::GDCMImageIO=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageIOType=
fixed2;<br>
&gt; =A0 ImageIOTypefixed2::Pointer gdcmImageIOfixed2 =3D ImageIOTypefixed2=
::New();<br>
&gt;<br>
&gt; =A0 reader-&gt;SetFileName( argv[1] );<br>
&gt;<br>
&gt; =A0 reader-&gt;Update();<br>
&gt;<br>
&gt; =A0 typedef itk::CurvatureFlowImageFilter&lt; InternalImageType,<br>
&gt; InternalImageType &gt;<br>
&gt; =A0=A0=A0 CurvatureFlowImageFilterType;<br>
&gt;<br>
&gt; =A0 CurvatureFlowImageFilterType::Pointer smoothing =3D<br>
&gt; =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 CurvatureFlowImageFilterType::New();<br>
&gt;<br>
&gt; =A0 typedef itk::ConnectedThresholdImageFilter&lt; InternalImageType,<=
br>
&gt; =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 InternalImageType &gt; ConnectedFilter=
Type;<br>
&gt;<br>
&gt; =A0 ConnectedFilterType::Pointer connectedThreshold =3D<br>
&gt; ConnectedFilterType::New();<br>
&gt;<br>
&gt; =A0 typedef signed short InputAPixelType;<br>
&gt; =A0 typedef float OutputBPixelType;<br>
&gt;<br>
&gt; =A0 typedef itk::Image&lt; InputAPixelType, 3 &gt; InputAImageType;<br=
>
&gt; =A0 typedef itk::Image&lt; OutputBPixelType, 3 &gt; OutputBImageType;<=
br>
&gt;<br>
&gt; =A0 typedef itk::CastImageFilter&lt; InputAImageType, OutputBImageType=
 &gt;<br>
&gt; CastFilterType;<br>
&gt;<br>
&gt; =A0 CastFilterType::Pointer castFilter =3D CastFilterType::New();<br>
&gt;<br>
&gt;<br>
&gt; =A0 castFilter-&gt;SetInput( reader-&gt;GetOutput() );<br>
&gt;<br>
&gt;<br>
&gt; =A0 connectedThreshold-&gt;SetInput( castFilter-&gt;GetOutput() );<br>
&gt;<br>
&gt; =A0 caster-&gt;SetInput( connectedThreshold-&gt;GetOutput() );<br>
&gt;<br>
&gt;<br>
&gt; =A0 smoothing-&gt;SetNumberOfIterations( 20 ); //was 5<br>
&gt; =A0 smoothing-&gt;SetTimeStep( 0.125 );<br>
&gt;<br>
&gt; =A0 const InternalPixelType lowerThreshold =3D atof( argv[6] );<br>
&gt; =A0 const InternalPixelType upperThreshold =3D atof( argv[7] );<br>
&gt;<br>
&gt; =A0 connectedThreshold-&gt;SetLower(=A0 lowerThreshold=A0 );<br>
&gt; =A0 connectedThreshold-&gt;SetUpper(=A0 upperThreshold=A0 );<br>
&gt;<br>
&gt; =A0 connectedThreshold-&gt;SetReplaceValue( 255 );<br>
&gt;<br>
&gt; =A0 InternalImageType::IndexType=A0 index;<br>
&gt;<br>
&gt; =A0 index[0] =3D atoi( argv[3] );<br>
&gt; =A0 index[1] =3D atoi( argv[4] );<br>
&gt;<br>
&gt; =A0 //added<br>
&gt; =A0 index[2] =3D atoi( argv[5] );<br>
&gt;<br>
&gt; =A0 std::cout &lt;&lt; index &lt;&lt; std::endl;<br>
&gt;<br>
&gt; =A0 // Software Guide : BeginCodeSnippet<br>
&gt; =A0 connectedThreshold-&gt;SetSeed( index );<br>
&gt;<br>
&gt; =A0 //obtain a 5 x 5 bounding region of seeds<br>
&gt; =A0 int ii, jj, kk;<br>
&gt;<br>
&gt; =A0 ii =3D index[0];<br>
&gt; =A0 jj =3D index[1];<br>
&gt; =A0 kk =3D index[2];<br>
&gt;<br>
&gt; =A0 for (int i =3D ii; i &lt; ii + 5; i++)<br>
&gt; =A0=A0=A0 for (int j =3D jj; j &lt; jj + 5; j++)<br>
&gt; =A0=A0=A0=A0=A0 for (int k =3D kk; k &lt; kk + 5; k++)<br>
&gt; =A0=A0=A0 {<br>
&gt;<br>
&gt; =A0=A0=A0 =A0 index[0] =3D i;<br>
&gt; =A0=A0=A0 =A0 index[1] =3D j;<br>
&gt; =A0=A0=A0 =A0 index[2] =3D k;<br>
&gt; =A0=A0=A0 =A0 connectedThreshold-&gt;AddSeed( index );<br>
&gt; =A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 for (int i =3D ii; i &gt; ii - 5; i--)<br>
&gt; =A0=A0=A0 for (int j =3D jj; j &gt; jj - 5; j--)<br>
&gt; =A0=A0=A0=A0=A0 for (int k =3D kk; k &gt; kk - 5; k--)<br>
&gt; =A0=A0=A0 {<br>
&gt;<br>
&gt; =A0=A0=A0 =A0 index[0] =3D i;<br>
&gt; =A0=A0=A0 =A0 index[1] =3D j;<br>
&gt; =A0=A0=A0 =A0 index[2] =3D k;<br>
&gt; =A0=A0=A0 =A0 connectedThreshold-&gt;AddSeed( index );<br>
&gt; =A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 connectedThreshold-&gt;Print(std::cout,17100);<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; =A0 typedef itk::MetaDataDictionary DictionaryType;<br>
&gt;<br>
&gt; =A0 DictionaryType inputdict =3D reader-&gt;GetMetaDataDictionary();<b=
r>
&gt;<br>
&gt; =A0 writer-&gt;SetMetaDataDictionary( inputdict );<br>
&gt;<br>
&gt; =A0 writer-&gt;SetFileName( argv[2] );<br>
&gt;<br>
&gt; =A0 writer-&gt;SetInput( caster-&gt;GetOutput() );<br>
&gt;<br>
&gt; =A0 try<br>
&gt; =A0=A0=A0 {<br>
&gt; =A0=A0=A0 writer-&gt;Update();<br>
&gt; =A0=A0=A0 }<br>
&gt; =A0 catch( itk::ExceptionObject &amp; excep )<br>
&gt; =A0=A0=A0 {<br>
&gt; =A0=A0=A0 std::cerr &lt;&lt; &quot;Exception caught !&quot; &lt;&lt; s=
td::endl;<br>
&gt; =A0=A0=A0 std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>
&gt; =A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 return 0;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
</div></div><div><div></div><div class=3D"h5">&gt; ________________________=
_____________<br>
&gt; Powered by <a href=3D"http://www.kitware.com" target=3D"_blank">www.ki=
tware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href=3D"http://www.kitware.com/opensource/opensource.html" target=
=3D"_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=3D"http://www.kitware.com/products/protraining.html" target=3D=
"_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=3D"http://www.itk.org/Wiki/ITK_FAQ" target=3D"_blank">http://w=
ww.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href=3D"http://www.itk.org/mailman/listinfo/insight-users" target=
=3D"_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>

--000e0ce0b72628b33504794b66a4--


More information about the Insight-users mailing list