[Insight-users] incorrect z-spacing in GDCM reading

Li, George (NIH/NCI) ligeorge at mail.nih.gov
Wed May 11 12:43:33 EDT 2005


Mathieu:

Here are the dicom header information. The strings are direct dump,
So should provide some info on the images. Hopefully, you can tell
Me an alternative way to send images to you and test them from your
End.

Thanks,

George


-----Original Message-----
From: Li, George (NIH/NCI) 
Sent: Wednesday, May 11, 2005 12:38 PM
To: 'Mathieu Malaterre'
Cc: 'insight-users at itk.org'; 'Luis Ibanez'
Subject: RE: [Insight-users] incorrect z-spacing in GDCM reading



Mathieu:

I cannot send the 2 images as attachment, because they are 205KB each. I got
a message from ITK, saying that there is limit of 40KB per mail And my
following mail was discarded.

Any other way I can send the images?

Thanks,

George



-----Original Message-----
From: Li, George (NIH/NCI) 
Sent: Wednesday, May 11, 2005 12:32 PM
To: 'Mathieu Malaterre'
Cc: 'Luis Ibanez'; insight-users at itk.org
Subject: RE: [Insight-users] incorrect z-spacing in GDCM reading


Thanks, Mathieu:

I have included two image slices, together with their header information, 
which is printed into text files from one of my own program. Actually, the 
dicom image files are generated from my program, too. Theoretically, the 
syntax should follow dicom3 definition on 'Image Position Patient' / 'Image 
Orientation Patient'. I did not check how GDCM parses the string.

The spacing should be 3.4mm, but GDCM got 1.00mm.

Look forward to hearing from you.

Thanks.

George


-----Original Message-----
From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com] 
Sent: Wednesday, May 11, 2005 12:00 PM
To: Li, George (NIH/NCI)
Cc: 'Luis Ibanez'; insight-users at itk.org
Subject: Re: [Insight-users] incorrect z-spacing in GDCM reading


George,

	Your code looks fine. The algorithm for finding the z spacing is
kind 
of tricky. So I am wondering if:

1. Your images might not have proper 'Image Position Patient' / 'Image 
Orientation Patient'

2. If they have, maybe gdcm is not able to parse the string properly.

Could it be possible that you send me at least two images from this 
dataset ?

If not, you'll have to turn the code to be more verbose in particular 
when entering the function:


     gdcm::SerieHelper::ImagePositionPatientOrdering

Thanks,
Mathieu

Li, George (NIH/NCI) wrote:
> Hi, Luis and ITK users:
>  
> I recently tried to adopt the GDCM dicom code for loading dicom series
> images, and then consequently saving images in dicom series. However, 
> when I read the
> images, the spacing in z-direction is incorrect, leading to a compressed 
> image
> in z-direction. Here is the related code, could you help me to identify 
> anything
> wrong?
>  
> class CMDIDataITKIO
> {
>  public:
>   CMDIDataITKIO();
>   virtual ~CMDIDataITKIO();
>  public:
>   void ReadGDCM_DicomImages(const char*, SeriesReaderType::Pointer);
>   void WriteGDCM_DicomImages(const char*, ImageType::Pointer);
>  private:
>   // initiate in the ctor, and raise clean flag in dtor.
>   GDCMImageIOType::Pointer m_gdcmIO;
>   GDCMSeriesNames::Pointer m_gdcmNames;
>   SeriesReaderType::Pointer m_gdcmReader;
> }
>  
> 
> void CMDIDataITKIO::ReadGDCM_DicomImages(const char* folderName,
>                                                                        
> SeriesReaderType::Pointer reader)
> {
>  if(!m_gdcmIO) m_gdcmIO = GDCMImageIOType::New();
>  if(!m_gdcmNames) m_gdcmNames = GDCMSeriesNames::New();
>  
>  // Get the DICOM filenames from the directory 
> m_gdcmNames->SetInputDirectory(folderName);
>  
>  reader->SetFileNames( m_gdcmNames->GetInputFileNames() );
> reader->SetImageIO( m_gdcmIO );
>  
>  try {
>   reader->Update();
>     }
>  catch (itk::ExceptionObject &excp) {
>   std::cerr << "Exception thrown while writing the image" << std::endl;
>   std::cerr << excp << std::endl;
>     }
> }
> Thanks,
>  
> George
>  
> 
> 
> ----------------------------------------------------------------------
> --
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org 
> http://www.itk.org/mailman/listinfo/insight-users
_______________________________________________
Insight-users mailing list
Insight-users at itk.org http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
File Name =          F:\DICOM_CTPT\Disk1\Lung_B0861\resizedIMG_CT\000002.dcm
TYPE(tp) DEFINE 0:un, 1:i16, 2:i32, 3:ui16, 4:ui16x2, 5:ui32, 6:f32, 7:d64, 8: seq, 9: str, 10:bData, 11:wData

---=== DICOM Header ===---

Mem   (grp ,elm ) [VR] tp        Info about value field:  len Value field

0084: (0002,0000) [--]  0                      Group Length:    4 26
0090: (0002,0010) [ui]  9               Transfer Syntax UID:   18 1.2.840.10008.1.2 
00aa: (0008,0000) [un]  0                 identifying group:    4 500
00b6: (0008,0008) [cs]  9                        Image Type:   32 TPS_PROCESSED                   
00de: (0008,0016) [ui]  9                     SOP Class UID:   26 1.2.840.10008.5.1.4.1.1.2 
0100: (0008,0018) [ui]  9                  SOP Instance UID:   48 1.2.840.817173.1.1.182.1.2.20040812112136       
0138: (0008,0020) [da]  9                        Study Date:    8 20040812
0148: (0008,0021) [da]  9                       Series Date:    8 20040812
0158: (0008,0022) [da]  9                  Acquisition Date:    8 20040812
0168: (0008,0030) [tm]  9                        Study Time:    6 112136
0176: (0008,0031) [tm]  9                       Series Time:    6 112136
0184: (0008,0032) [tm]  9                  Acquisition Time:    6 112136
0192: (0008,0050) [sh]  9                  Accession Number:   14 20040812112136
01a8: (0008,0060) [cs]  9                          Modality:    2 CT
01b2: (0008,0070) [lo]  9                      Manufacturer:    4 TPS 
01be: (0008,0080) [lo]  9                  Institution Name:   32 Clinical Radiation Oncology, TPS
01e6: (0008,0090) [pn]  9        Referring Physician's Name:   32 Dr. Tps                         
020e: (0008,1010) [sh]  9                      Station Name:   32 ROB                             
0236: (0008,1030) [lo]  9                 Study Description:   12 TPS PLANNING
024a: (0008,103e) [lo]  9                Series Description:   12 TPS Clinical
025e: (0008,1060) [pn]  9  Name of Physicians Reading Study:   32 Dr. Tps                         
0286: (0008,1070) [pn]  9                   Operators' Name:   32 ROB                             
02ae: (0008,1090) [lo]  9         Manufacturer's Model Name:    4 TPS 
02ba: (0010,0000) [un]  0                     patient group:    4 118
02c6: (0010,0010) [pn]  9                    Patient's Name:   32 B861_B861_                      
02ee: (0010,0020) [lo]  9                        Patient ID:   32 111111111_                      
0316: (0010,0030) [da]  9              Patient's Birth Date:    8 19500101
0326: (0010,0040) [cs]  9                     Patient's Sex:    2 M 
0330: (0010,1010) [as]  9                     Patient's Age:    4 0054
033c: (0018,0000) [un]  0                 acquisition group:    4 268
0348: (0018,0010) [lo]  9              Contrast/Bolus Agent:    4 NONE
0354: (0018,0050) [ds]  9                   Slice Thickness:   10 3.400000  
0366: (0018,0060) [ds]  9                               KVP:    4  120
0372: (0018,0090) [ds]  9          Data Collection Diameter:   10 480.000000
0384: (0018,1020) [lo]  9               Software Version(s):    2 01
038e: (0018,1100) [ds]  9           Reconstruction Diameter:   14 480.0000000000
03a4: (0018,1110) [ds]  9       Distance Source to Detector:   16  1000.0000000000
03bc: (0018,1111) [ds]  9        Distance Source to Patient:   10 600.000000
03ce: (0018,1120) [ds]  9              Gantry/Detector Tilt:    8 0.000000
03de: (0018,1130) [ds]  9                      Table Height:   10 100.000000
03f0: (0018,1140) [cs]  9                Rotation Direction:    2 CW
03fa: (0018,1150) [is]  9                     Exposure Time:    4 1000
0406: (0018,1151) [is]  9                X-ray Tube Current:    4  300
0412: (0018,1160) [sh]  9                       Filter Type:   12 BODY FILTER 
0426: (0018,1190) [ds]  9                     Focal Spot(s):   10 1.2 \1.2  
0438: (0018,1210) [sh]  9                Convolution Kernel:    8 STANDARD
0448: (0018,5100) [cs]  9                  Patient Position:    4 FFS 
0454: (0020,0000) [un]  0                relationship group:    4 404
0460: (0020,000d) [ui]  9                Study Instance UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.788   
0498: (0020,000e) [ui]  9               Series Instance UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.737   
04d0: (0020,0010) [sh]  9                          Study ID:   14 11213620040812
04e6: (0020,0011) [is]  9                     Series Number:    4  182
04f2: (0020,0012) [is]  9                Acquisition Number:    4    1
04fe: (0020,0013) [is]  9                   Instance Number:    4    2
050a: (0020,0020) [cs]  9               Patient Orientation:    4 L \P
0516: (0020,0032) [ds]  9          Image Position (Patient):   36 0.000000  \0.000000  \3.400000      
0542: (0020,0037) [ds]  9       Image Orientation (Patient):   54  1.000000\0.000000\0.000000\0.000000\1.000000\0.000000
0580: (0020,0052) [ui]  9            Frame of Reference UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.367   
05b8: (0020,0060) [cs]  9                        Laterality:    0 
05c0: (0020,1040) [lo]  9      Position Reference Indicator:    2 SN
05ca: (0020,1041) [ds]  9                    Slice Location:   10 3.400000  
05dc: (0028,0000) [un]  0          image presentation group:    4 160
05e8: (0028,0002) [us]  3                 Samples per Pixel:    2 1
05f2: (0028,0004) [cs]  9        Photometric Interpretation:   12 MONOCHROME2 
0606: (0028,0010) [us]  3                              Rows:    2 
0610: (0028,0011) [us]  3                           Columns:    2 
061a: (0028,0030) [ds]  9                     Pixel Spacing:   18 1.563000\1.563000 
0634: (0028,0100) [us]  3                    Bits Allocated:    2 
063e: (0028,0101) [us]  3                       Bits Stored:    2 
0648: (0028,0102) [us]  3                          High Bit:    2 
0652: (0028,0103) [us]  3              Pixel Representation:    2 
065c: (0028,0106) [us]  3        Smallest Image Pixel Value:    2 0
0666: (0028,0120) [us]  3               Pixel Padding Value:    2 32768
0670: (0028,1052) [ds]  9                 Rescale Intercept:    6 
067e: (0028,1053) [ds]  9                     Rescale Slope:    2 
0688: (7fe0,0000) [un]  0                 group 7FE0 length:    4 204808
0694: (7fe0,0010) [ow] 11                        pixel data: 204800 

 ---=== The End ===---
-------------- next part --------------
File Name =          F:\DICOM_CTPT\Disk1\Lung_B0861\resizedIMG_CT\000001.dcm
TYPE(tp) DEFINE 0:un, 1:i16, 2:i32, 3:ui16, 4:ui16x2, 5:ui32, 6:f32, 7:d64, 8: seq, 9: str, 10:bData, 11:wData

---=== DICOM Header ===---

Mem   (grp ,elm ) [VR] tp        Info about value field:  len Value field

0084: (0002,0000) [--]  0                      Group Length:    4 26
0090: (0002,0010) [ui]  9               Transfer Syntax UID:   18 1.2.840.10008.1.2 
00aa: (0008,0000) [un]  0                 identifying group:    4 500
00b6: (0008,0008) [cs]  9                        Image Type:   32 TPS_PROCESSED                   
00de: (0008,0016) [ui]  9                     SOP Class UID:   26 1.2.840.10008.5.1.4.1.1.2 
0100: (0008,0018) [ui]  9                  SOP Instance UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136       
0138: (0008,0020) [da]  9                        Study Date:    8 20040812
0148: (0008,0021) [da]  9                       Series Date:    8 20040812
0158: (0008,0022) [da]  9                  Acquisition Date:    8 20040812
0168: (0008,0030) [tm]  9                        Study Time:    6 112136
0176: (0008,0031) [tm]  9                       Series Time:    6 112136
0184: (0008,0032) [tm]  9                  Acquisition Time:    6 112136
0192: (0008,0050) [sh]  9                  Accession Number:   14 20040812112136
01a8: (0008,0060) [cs]  9                          Modality:    2 CT
01b2: (0008,0070) [lo]  9                      Manufacturer:    4 TPS 
01be: (0008,0080) [lo]  9                  Institution Name:   32 Clinical Radiation Oncology, TPS
01e6: (0008,0090) [pn]  9        Referring Physician's Name:   32 Dr. Tps                         
020e: (0008,1010) [sh]  9                      Station Name:   32 ROB                             
0236: (0008,1030) [lo]  9                 Study Description:   12 TPS PLANNING
024a: (0008,103e) [lo]  9                Series Description:   12 TPS Clinical
025e: (0008,1060) [pn]  9  Name of Physicians Reading Study:   32 Dr. Tps                         
0286: (0008,1070) [pn]  9                   Operators' Name:   32 ROB                             
02ae: (0008,1090) [lo]  9         Manufacturer's Model Name:    4 TPS 
02ba: (0010,0000) [un]  0                     patient group:    4 118
02c6: (0010,0010) [pn]  9                    Patient's Name:   32 B861_B861_                      
02ee: (0010,0020) [lo]  9                        Patient ID:   32 111111111_                      
0316: (0010,0030) [da]  9              Patient's Birth Date:    8 19500101
0326: (0010,0040) [cs]  9                     Patient's Sex:    2 M 
0330: (0010,1010) [as]  9                     Patient's Age:    4 0054
033c: (0018,0000) [un]  0                 acquisition group:    4 268
0348: (0018,0010) [lo]  9              Contrast/Bolus Agent:    4 NONE
0354: (0018,0050) [ds]  9                   Slice Thickness:   10 3.400000  
0366: (0018,0060) [ds]  9                               KVP:    4  120
0372: (0018,0090) [ds]  9          Data Collection Diameter:   10 480.000000
0384: (0018,1020) [lo]  9               Software Version(s):    2 01
038e: (0018,1100) [ds]  9           Reconstruction Diameter:   14 480.0000000000
03a4: (0018,1110) [ds]  9       Distance Source to Detector:   16  1000.0000000000
03bc: (0018,1111) [ds]  9        Distance Source to Patient:   10 600.000000
03ce: (0018,1120) [ds]  9              Gantry/Detector Tilt:    8 0.000000
03de: (0018,1130) [ds]  9                      Table Height:   10 100.000000
03f0: (0018,1140) [cs]  9                Rotation Direction:    2 CW
03fa: (0018,1150) [is]  9                     Exposure Time:    4 1000
0406: (0018,1151) [is]  9                X-ray Tube Current:    4  300
0412: (0018,1160) [sh]  9                       Filter Type:   12 BODY FILTER 
0426: (0018,1190) [ds]  9                     Focal Spot(s):   10 1.2 \1.2  
0438: (0018,1210) [sh]  9                Convolution Kernel:    8 STANDARD
0448: (0018,5100) [cs]  9                  Patient Position:    4 FFS 
0454: (0020,0000) [un]  0                relationship group:    4 404
0460: (0020,000d) [ui]  9                Study Instance UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.788   
0498: (0020,000e) [ui]  9               Series Instance UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.737   
04d0: (0020,0010) [sh]  9                          Study ID:   14 11213620040812
04e6: (0020,0011) [is]  9                     Series Number:    4  182
04f2: (0020,0012) [is]  9                Acquisition Number:    4    1
04fe: (0020,0013) [is]  9                   Instance Number:    4    1
050a: (0020,0020) [cs]  9               Patient Orientation:    4 L \P
0516: (0020,0032) [ds]  9          Image Position (Patient):   36 0.000000  \0.000000  \0.000000      
0542: (0020,0037) [ds]  9       Image Orientation (Patient):   54  1.000000\0.000000\0.000000\0.000000\1.000000\0.000000
0580: (0020,0052) [ui]  9            Frame of Reference UID:   48 1.2.840.817173.1.1.182.1.1.20040812112136.367   
05b8: (0020,0060) [cs]  9                        Laterality:    0 
05c0: (0020,1040) [lo]  9      Position Reference Indicator:    2 SN
05ca: (0020,1041) [ds]  9                    Slice Location:   10 0.000000  
05dc: (0028,0000) [un]  0          image presentation group:    4 160
05e8: (0028,0002) [us]  3                 Samples per Pixel:    2 1
05f2: (0028,0004) [cs]  9        Photometric Interpretation:   12 MONOCHROME2 
0606: (0028,0010) [us]  3                              Rows:    2 
0610: (0028,0011) [us]  3                           Columns:    2 
061a: (0028,0030) [ds]  9                     Pixel Spacing:   18 1.563000\1.563000 
0634: (0028,0100) [us]  3                    Bits Allocated:    2 
063e: (0028,0101) [us]  3                       Bits Stored:    2 
0648: (0028,0102) [us]  3                          High Bit:    2 
0652: (0028,0103) [us]  3              Pixel Representation:    2 
065c: (0028,0106) [us]  3        Smallest Image Pixel Value:    2 0
0666: (0028,0120) [us]  3               Pixel Padding Value:    2 32768
0670: (0028,1052) [ds]  9                 Rescale Intercept:    6 
067e: (0028,1053) [ds]  9                     Rescale Slope:    2 
0688: (7fe0,0000) [un]  0                 group 7FE0 length:    4 204808
0694: (7fe0,0010) [ow] 11                        pixel data: 204800 

 ---=== The End ===---


More information about the Insight-users mailing list