Notes |
|
(0017843)
|
Daniele E. Domenichelli
|
2009-09-30 10:44
|
|
Reading in the discussion of bug 0007748 I understand that
> The short hand explanation should be that the member m_Direction of
> itk::GDCMImageIO (inherited from itk::ImageIOBase) is a vector that
> points to vectors, where the first vector contains the direction
> cosines of the image rows, the second the direction cosines of the
> image columns and the third contains the direction cosines of the
> image slices. So, m_Direction[0][0], m_Direction[0][1],
> m_Direction[0][2] are the direction cosines of the image rows.
> itk::GDCMImageIO::m_Direction stores the direction cosines as rows.
Then in the first patch m_Direction is transposed
ITK_Direction2.diff corrects this bug |
|
|
(0018687)
|
Mathieu Malaterre
|
2009-12-03 06:26
|
|
> ITK_Direction2.diff corrects this bug
Hum, since 0007748 is now fixed, I believe I need to apply patch ITK_Direction.diff
I'll do that ASAP.
Thanks |
|
|
(0018688)
|
Mathieu Malaterre
|
2009-12-03 06:31
|
|
$ cvs ci -m"BUG: 0009622 Thanks to Daniele E. Domenichelli for providing the patch" ~/Kitware/Insight
Committer: Mathieu Malaterre <mathieu.malaterre@gmail.com>
Running style check
Running style check
Processing itkGDCMImageIO.cxx
Running style check
Processing itkIOCommon.cxx
Running style check
Processing itkIOCommon.h
Running style check
Processing itkImageSeriesWriter.txx
/cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v <-- Code/IO/itkGDCMImageIO.cxx
new revision: 1.168; previous revision: 1.167
/cvsroot/Insight/Insight/Code/IO/itkIOCommon.cxx,v <-- Code/IO/itkIOCommon.cxx
new revision: 1.30; previous revision: 1.29
/cvsroot/Insight/Insight/Code/IO/itkIOCommon.h,v <-- Code/IO/itkIOCommon.h
new revision: 1.28; previous revision: 1.27
/cvsroot/Insight/Insight/Code/IO/itkImageSeriesWriter.txx,v <-- Code/IO/itkImageSeriesWriter.txx
new revision: 1.34; previous revision: 1.33 |
|
|
(0018689)
|
Mathieu Malaterre
|
2009-12-03 06:32
|
|
|
|
(0018690)
|
Mathieu Malaterre
|
2009-12-03 09:02
|
|
Patch attached to bug tracker was not tested.
Reverting changes done to CVS. |
|
|
(0018942)
|
Daniele E. Domenichelli
|
2009-12-17 14:27
(edited on: 2009-12-17 14:28) |
|
> Hum, since 0007748 is now fixed, I believe I need to apply patch
> ITK_Direction.diff
Actually I believe that 0007748 corrects just the way direction cosines
are written (see [1]) and not the internal representation, that seems
to be transposed compared to itkImage (see Goethe comment 0014265 for
bug 0007748)
> Patient Orientation: 0/0/-1/1/0/0
>
> GDCMImageIO::m_Direction:
>
> 0 0 -1
> 1 0 0
> 0 -1 0
>
> Image::m_Direction:
>
> 0 1 0
> 0 0 -1
> -1 0 0
>
> The conversion/inversion from one to another is done by
> ImageFileReader, ImageFileWriter.
That means that:
- the patch to apply was ITK_Direction2.diff that transposes
direction matrix when readed by GDCMImageIO.
or
- to keep coherence with ImageFileWriter so that the conversion is
done by itkImageSeriesWriter, ITK_Direction.diff should be applied
but line 49
+ directionMatrix[i][j] = direction2[i][j];
should be replaced with
+ directionMatrix[j][i] = direction2[i][j];
(but I just realised this, so I didn't try it yet)
Anyway, as far as I understand this should not be the cause of
segmentation faults.
Applying ITK_Direction2.diff I don't get segmentation fault on tests
failing here [2].
itkImageReadDICOMSeriesWriteWithDirection003Test still fails, but it
fails also without the patch
(itkImageReadDICOMSeriesWriteWithDirection002Test is also failing
without the patch)
----
$ ctest -R itkImageReadDICOMSeriesWriteTest -V
[...]
1/1 Test 0000943: itkImageReadDICOMSeriesWriteTest ... Passed 7.59 sec
----
$ ctest -R itkImageReadDICOMSeriesWriteWithDirection002Test -V
[...]
1/1 Test 0000944: itkImageReadDICOMSeriesWriteWithDirection002Test ... Passed 0.43 sec
----
$ ctest -R itkImageReadDICOMSeriesWriteWithDirection003Test -V
[...]
945: ERROR: Origin values do not match
945: Original image origin = [0, 0, 0]
945: Recovered image origin = [0, 164, 0]
945: ERROR: found pixel value difference at index [1, 0, 0]
945: Original pixel value = 2
945: Recovered pixel value = 1
1/1 Test #945: itkImageReadDICOMSeriesWriteWithDirection003Test ...***Failed 0.27 sec
----
P.S. line 59 of 3dseriesimage_vs_2d.patch
- else if( key == ITK_XDirection )
should be
- else if( key == ITK_ZDirection )
Anyway I don't understand why renaming it should avoid segmentation
fault, maybe I'm missing something...
[1]http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkGDCMImageIO.cxx?r1=1.161&r2=1.161.2.1&pathrev=ITK-3-16&sortby=date&root=Insight [^]
[2]http://www.cdash.org/CDash/viewTest.php?onlyfailed&buildid=485280 [^]
|
|
|
(0019016)
|
Mathieu Malaterre
|
2009-12-30 17:35
|
|
[from the top of my head]
>Anyway I don't understand why renaming it should avoid segmentation
>fault, maybe I'm missing something...
Because you need to call v.resize(3) before doing v[2]. This is what was happening. Since keys are ordered by name ITK_Direction would come before ITK_NumberOfDimensions, then the vector had an improper size.
Just do some simple debugging and you'll see (print the size of the vector/matrix)
Cheers |
|
|
(0020272)
|
Daniele E. Domenichelli
|
2010-04-20 06:32
|
|
Hi, I attached a new patch (ITK_Direction4.patch) that resumes all changes.
I've been using this for a while and it works for me. |
|
|
(0022700)
|
Mathieu Malaterre
|
2010-10-26 05:49
|
|
I will apply patch and check again. Thanks ! |
|