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->GetOutput()->GetDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<b=
r><br>output from castFilter->GetOutput()->GetDirection()<br>0 0 1<br=
>
0 1 0<br>-1 0 0<br><br>output from connectedThreshold->GetOutput()->G=
etDirection()<br>0 0 1<br>0 1 0<br>-1 0 0<br><br>output from caster->Get=
Output()->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'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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008|0090) Referring Physician's Name =3D Refering=
Phisician=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=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>
(0010|0010) Patient's Name =3D Patient 188858520=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=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>(0010|0020) Patient ID =3D 1747233212=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=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>
(0010|0030) Patient's Birth Date =3D 19500101=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=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>(0010|0040) Patient'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's Name (0010|0010=
)=A0 is: Patient 188858520<br>
Performing Physician'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"><<a href=3D"mailto:luis.ibanez at kitware.com">luis.ibanez@=
kitware.com</a>></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 << reader->GetOutput()->GetDirection() << std::=
endl;<br>
std::cout << casterFilter->GetOutput()->GetDirection() <<=
std::endl;<br>
std::cout << connectedThreshold->GetOutput()->GetDirection() &l=
t;< std::endl;<br>
std::cout << caster->GetOutput()->GetDirection() << std::=
endl;<br>
<br>
after the call to<br>
<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0writer->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 <<a href=3D"mailto:john.drozd at gmail.com">john.drozd at gmail.com</a>>=
; wrote:<br>
> Hello,<br>
><br>
> Can anyone please tell me why my connect threshold segmentation code, =
where<br>
> I input a 3d dicom brain volume and output a 3d dicom ventricle<br>
> segmentation, gives me my segmentation "upside down" (relati=
ve to the<br>
> original inputted image) when I view it in 3D Slicer?=A0 When I output=
the<br>
> code in any other format eg. .mhd, the segmentation is right side up.<=
br>
><br>
> Thank you.<br>
><br>
> john<br>
><br>
> Below is my uncommented code:<br>
><br>
> /*<br>
> to run type:<br>
> ./ConnectedThresholdImageFilter correctedsubject5.dcm outsubject5.dcm =
103<br>
> 142 95 17100 17300<br>
> */<br>
><br>
> #if defined(_MSC_VER)<br>
> #pragma warning ( disable : 4786 )<br>
> #endif<br>
><br>
> #ifdef __BORLANDC__<br>
> #define ITK_LEAN_AND_MEAN<br>
> #endif<br>
><br>
><br>
> #include "itkConnectedThresholdImageFilter.h"<br>
><br>
> #include "itkImage.h"<br>
> #include "itkCastImageFilter.h"<br>
><br>
> #include "itkCurvatureFlowImageFilter.h"<br>
><br>
> #include "itkImageFileReader.h"<br>
> #include "itkImageFileWriter.h"<br>
><br>
> #include "itkGDCMImageIO.h"<br>
><br>
> #include "itkVersion.h"<br>
><br>
> #include "itkOrientedImage.h"<br>
> #include "itkMinimumMaximumImageFilter.h"<br>
><br>
> #include "itkGDCMImageIO.h"<br>
> #include "itkGDCMSeriesFileNames.h"<br>
> #include "itkNumericSeriesFileNames.h"<br>
><br>
> #include "itkImageSeriesReader.h"<br>
> #include "itkImageSeriesWriter.h"<br>
><br>
> #include "itkResampleImageFilter.h"<br>
> #include "itkShiftScaleImageFilter.h"<br>
><br>
> #include "itkIdentityTransform.h"<br>
> #include "itkLinearInterpolateImageFunction.h"<br>
><br>
> #include <itksys/SystemTools.hxx><br>
><br>
> #include "gdcm/src/gdcmFile.h"<br>
> #include "gdcm/src/gdcmUtil.h"<br>
><br>
> #include <string><br>
><br>
> int main( int argc, char *argv[])<br>
> {<br>
> =A0 if( argc < 7 )<br>
> =A0=A0=A0 {<br>
> =A0=A0=A0 std::cerr << "Missing Parameters " << =
std::endl;<br>
> =A0=A0=A0 std::cerr << "Usage: " << argv[0];<br>
> =A0=A0=A0 std::cerr << " inputImage=A0 outputImage seedX se=
edY seedZ lowerThreshold<br>
> upperThreshold" << std::endl;<br>
><br>
> =A0=A0=A0 return 1;<br>
> =A0=A0=A0 }<br>
><br>
> =A0 typedef=A0=A0 float=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 InternalPixelTyp=
e;<br>
><br>
> =A0 const=A0=A0=A0=A0 unsigned int=A0=A0=A0 Dimension =3D 3;<br>
><br>
> =A0 typedef itk::Image< InternalPixelType, Dimension >=A0 Intern=
alImageType;<br>
><br>
> =A0 typedef signed short OutputPixelType;<br>
><br>
> =A0 typedef itk::Image< OutputPixelType, Dimension > OutputImage=
Type;<br>
> =A0 typedef itk::Image< float, Dimension > OutputImageType2;<br>
> =A0 typedef itk::CastImageFilter< InternalImageType, OutputImageTyp=
e ><br>
> =A0=A0=A0 CastingFilterType;<br>
> =A0 CastingFilterType::Pointer caster =3D CastingFilterType::New();<br=
>
><br>
> =A0 const=A0=A0=A0 unsigned int=A0=A0=A0 ImageDimension =3D 3;<br>
> =A0 typedef=A0 signed short=A0=A0=A0 PixelType;<br>
><br>
> =A0 typedef itk::Image< PixelType, ImageDimension >=A0 FixedImag=
eType;<br>
> =A0 typedef itk::Image< float, ImageDimension >=A0 FloatImageTyp=
e;<br>
><br>
> =A0 typedef=A0 itk::ImageFileReader< FixedImageType > ReaderType=
;<br>
> =A0 typedef=A0 itk::ImageFileWriter<=A0 OutputImageType=A0 > Wri=
terType;<br>
> =A0 typedef=A0 itk::ImageFileWriter<=A0 FloatImageType=A0 > Writ=
erType2;<br>
><br>
> =A0 ReaderType::Pointer reader =3D ReaderType::New();<br>
> =A0 WriterType::Pointer writer =3D WriterType::New();<br>
> =A0 WriterType2::Pointer writer2 =3D WriterType2::New();<br>
><br>
> =A0 typedef itk::GDCMImageIO=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageIOType=
fixed;<br>
> =A0 ImageIOTypefixed::Pointer gdcmImageIOfixed =3D ImageIOTypefixed::N=
ew();<br>
> =A0 reader->SetImageIO( gdcmImageIOfixed );<br>
><br>
> =A0 typedef itk::GDCMImageIO=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ImageIOType=
fixed2;<br>
> =A0 ImageIOTypefixed2::Pointer gdcmImageIOfixed2 =3D ImageIOTypefixed2=
::New();<br>
><br>
> =A0 reader->SetFileName( argv[1] );<br>
><br>
> =A0 reader->Update();<br>
><br>
> =A0 typedef itk::CurvatureFlowImageFilter< InternalImageType,<br>
> InternalImageType ><br>
> =A0=A0=A0 CurvatureFlowImageFilterType;<br>
><br>
> =A0 CurvatureFlowImageFilterType::Pointer smoothing =3D<br>
> =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>
><br>
> =A0 typedef itk::ConnectedThresholdImageFilter< InternalImageType,<=
br>
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=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 > ConnectedFilter=
Type;<br>
><br>
> =A0 ConnectedFilterType::Pointer connectedThreshold =3D<br>
> ConnectedFilterType::New();<br>
><br>
> =A0 typedef signed short InputAPixelType;<br>
> =A0 typedef float OutputBPixelType;<br>
><br>
> =A0 typedef itk::Image< InputAPixelType, 3 > InputAImageType;<br=
>
> =A0 typedef itk::Image< OutputBPixelType, 3 > OutputBImageType;<=
br>
><br>
> =A0 typedef itk::CastImageFilter< InputAImageType, OutputBImageType=
><br>
> CastFilterType;<br>
><br>
> =A0 CastFilterType::Pointer castFilter =3D CastFilterType::New();<br>
><br>
><br>
> =A0 castFilter->SetInput( reader->GetOutput() );<br>
><br>
><br>
> =A0 connectedThreshold->SetInput( castFilter->GetOutput() );<br>
><br>
> =A0 caster->SetInput( connectedThreshold->GetOutput() );<br>
><br>
><br>
> =A0 smoothing->SetNumberOfIterations( 20 ); //was 5<br>
> =A0 smoothing->SetTimeStep( 0.125 );<br>
><br>
> =A0 const InternalPixelType lowerThreshold =3D atof( argv[6] );<br>
> =A0 const InternalPixelType upperThreshold =3D atof( argv[7] );<br>
><br>
> =A0 connectedThreshold->SetLower(=A0 lowerThreshold=A0 );<br>
> =A0 connectedThreshold->SetUpper(=A0 upperThreshold=A0 );<br>
><br>
> =A0 connectedThreshold->SetReplaceValue( 255 );<br>
><br>
> =A0 InternalImageType::IndexType=A0 index;<br>
><br>
> =A0 index[0] =3D atoi( argv[3] );<br>
> =A0 index[1] =3D atoi( argv[4] );<br>
><br>
> =A0 //added<br>
> =A0 index[2] =3D atoi( argv[5] );<br>
><br>
> =A0 std::cout << index << std::endl;<br>
><br>
> =A0 // Software Guide : BeginCodeSnippet<br>
> =A0 connectedThreshold->SetSeed( index );<br>
><br>
> =A0 //obtain a 5 x 5 bounding region of seeds<br>
> =A0 int ii, jj, kk;<br>
><br>
> =A0 ii =3D index[0];<br>
> =A0 jj =3D index[1];<br>
> =A0 kk =3D index[2];<br>
><br>
> =A0 for (int i =3D ii; i < ii + 5; i++)<br>
> =A0=A0=A0 for (int j =3D jj; j < jj + 5; j++)<br>
> =A0=A0=A0=A0=A0 for (int k =3D kk; k < kk + 5; k++)<br>
> =A0=A0=A0 {<br>
><br>
> =A0=A0=A0 =A0 index[0] =3D i;<br>
> =A0=A0=A0 =A0 index[1] =3D j;<br>
> =A0=A0=A0 =A0 index[2] =3D k;<br>
> =A0=A0=A0 =A0 connectedThreshold->AddSeed( index );<br>
> =A0=A0=A0 }<br>
><br>
> =A0 for (int i =3D ii; i > ii - 5; i--)<br>
> =A0=A0=A0 for (int j =3D jj; j > jj - 5; j--)<br>
> =A0=A0=A0=A0=A0 for (int k =3D kk; k > kk - 5; k--)<br>
> =A0=A0=A0 {<br>
><br>
> =A0=A0=A0 =A0 index[0] =3D i;<br>
> =A0=A0=A0 =A0 index[1] =3D j;<br>
> =A0=A0=A0 =A0 index[2] =3D k;<br>
> =A0=A0=A0 =A0 connectedThreshold->AddSeed( index );<br>
> =A0=A0=A0 }<br>
><br>
> =A0 connectedThreshold->Print(std::cout,17100);<br>
><br>
><br>
><br>
> =A0 typedef itk::MetaDataDictionary DictionaryType;<br>
><br>
> =A0 DictionaryType inputdict =3D reader->GetMetaDataDictionary();<b=
r>
><br>
> =A0 writer->SetMetaDataDictionary( inputdict );<br>
><br>
> =A0 writer->SetFileName( argv[2] );<br>
><br>
> =A0 writer->SetInput( caster->GetOutput() );<br>
><br>
> =A0 try<br>
> =A0=A0=A0 {<br>
> =A0=A0=A0 writer->Update();<br>
> =A0=A0=A0 }<br>
> =A0 catch( itk::ExceptionObject & excep )<br>
> =A0=A0=A0 {<br>
> =A0=A0=A0 std::cerr << "Exception caught !" << s=
td::endl;<br>
> =A0=A0=A0 std::cerr << excep << std::endl;<br>
> =A0=A0=A0 }<br>
><br>
> =A0 return 0;<br>
> }<br>
><br>
><br>
</div></div><div><div></div><div class=3D"h5">> ________________________=
_____________<br>
> Powered by <a href=3D"http://www.kitware.com" target=3D"_blank">www.ki=
tware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href=3D"http://www.kitware.com/opensource/opensource.html" target=
=3D"_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href=3D"http://www.kitware.com/products/protraining.html" target=3D=
"_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=3D"http://www.itk.org/Wiki/ITK_FAQ" target=3D"_blank">http://w=
ww.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href=3D"http://www.itk.org/mailman/listinfo/insight-users" target=
=3D"_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
</div></div></blockquote></div><br>
--000e0ce0b72628b33504794b66a4--
More information about the Insight-users
mailing list