[Insight-developers] more on pixel-centeredness
Michel Audette
michel.audette at kitware.com
Fri May 22 18:28:34 EDT 2009
Hi again,
I thought that I'd communicate with you some of my findings, regarding the
difference of behaviour between Pixel- and Grid-centered coordinates. This
was sent to Luis earlier, who has a lot on his plate these days. The value
m_Buffer in ImageConstIterator seems to be set differently depending on the
value of this flag, and why is not clear to me.
For many of the failing tests involving the ShrinkImageFilter, point
coordinates returned by
shrink->GetOutput()->TransformIndexToPhysicalPoint(
iterator2.GetIndex(), point );
appear consistent with either flag option,
ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY or not.
I.e.: I get the following, having added a bunch of cout statements...
Flag off:
Test command:
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedOff/bin/itkBasicFiltersTests
itkImportImageTest
Test timeout computed to be: 9.99988e+06
import->GetSpacing(): 0x320a550
import->GetOrigin(): 0x320a560
Pixel [0, 0] = 0
*iterator2.Get() 0 * iterator2.GetIndex() [0, 0] 0
* point [0.5, 0.5]*
Pixel [1, 0] = 2
*iterator2.Get() 2* iterator2.GetIndex() [1, 0] 2
* point [2.5, 0.5]*
Pixel [2, 0] = 4
*iterator2.Get() 4* iterator2.GetIndex() [2, 0] 4
* point [4.5, 0.5]*
Pixel [3, 0] = 6
*iterator2.Get() 6* iterator2.GetIndex() [3, 0] 6
* point [6.5, 0.5]*
Pixel [0, 1] = 16
*iterator2.Get() 16 *iterator2.GetIndex() [0, 1] 16
* point [0.5, 2.5]*
...
Flag on:
Test command:
/home/michel/tools/Insight_ALL/InsightDebugBuildShared/bin/itkBasicFiltersTests
itkImportImageTest
Test timeout computed to be: 9.99988e+06
import->GetSpacing(): 0x11e3710
import->GetOrigin(): 0x11e3720
Pixel [0, 0] = 9
*iterator2.Get() 9* iterator2.GetIndex() [0, 0] 0
* point [0.5, 0.5]*
Pixel [1, 0] = 11
*iterator2.Get() 11* iterator2.GetIndex() [1, 0] 2
* point [2.5, 0.5]*
Pixel [2, 0] = 13
*iterator2.Get() 13 * iterator2.GetIndex() [2, 0] 4
* point [4.5, 0.5]*
Pixel [3, 0] = 15
*iterator2.Get() 15* iterator2.GetIndex() [3, 0] 6
* point [6.5, 0.5]*
Pixel [0, 1] = 25
*iterator2.Get() 25* iterator2.GetIndex() [0, 1] 16
* point [0.5, 2.5]*
But the difference is clearly what the iterator returns at those indices.
I'm not sure how to duplicate this difference in the test suggested by Bill
Lorensen. I have written a simple itkImagePixelPositionTest.cxx, enclosed,
which I have not checked in yet because I have not filled in expected
values, but it's apparent that setting up a small 6x2 image, with spacing
and origin, and using TransformIndexToPhysicalPoint( inputIndex, point )
produces positions that reflect the origin and spacing. (It can wait until
after the release...)
This itkImagePixelPositionTest returns consistent results with both flags,
where position appears to be set according to origin, spacing and index...
What other wrinkle in the test should I put in?
See below also...
Best wishes,
Michel
Flag On:
michel at michel-desktop:~/tools/Insight_ALL/InsightDebugBuildSharedTemp$ ctest
-R PixelPosition -V
UpdateCTestConfiguration from
:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/DartConfiguration.tcl
Parse Config
file:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/DartConfiguration.tcl
Add coverage exclude regular expressions.
Start processing tests
UpdateCTestConfiguration from
:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/DartConfiguration.tcl
Parse Config
file:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/DartConfiguration.tcl
Test project /home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp
Constructing a list of tests
Done constructing a list of tests
Changing directory into
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/Testing/Code/Common
316/1612 Testing itkImagePixelPositionTest ....
Test command:
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTemp/bin/itkCommonTests
itkImagePixelPositionTest
Test timeout computed to be: 1500
Create the input image pattern.
i j 0 0 point [1.5, 2]
i j 1 0 point [3, 4]
i j 2 0 point [4.5, 6]
i j 3 0 point [6, 8]
i j 4 0 point [7.5, 10]
i j 5 0 point [9, 12]
i j 0 1 point [1.5, 2]
i j 1 1 point [3, 4]
i j 2 1 point [4.5, 6]
i j 3 1 point [6, 8]
i j 4 1 point [7.5, 10]
i j 5 1 point [9, 12]
index [0, 0] get 64
index [1, 0] get 65
index [2, 0] get 66
index [3, 0] get 67
index [4, 0] get 68
index [5, 0] get 69
index [0, 1] get 65
index [1, 1] get 66
index [2, 1] get 67
index [3, 1] get 68
index [4, 1] get 69
index [5, 1] get 70
Flag Off
michel at michel-desktop:~/tools/Insight_ALL/InsightDebugBuildSharedTempOff/Testing/Code/Common$
ctest -R PixelPosition -V
UpdateCTestConfiguration from
:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTempOff/Testing/Code/Common/DartConfiguration.tcl
Add coverage exclude regular expressions.
Start processing tests
UpdateCTestConfiguration from
:/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTempOff/Testing/Code/Common/DartConfiguration.tcl
Test project
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTempOff/Testing/Code/Common
Constructing a list of tests
Done constructing a list of tests
Changing directory into
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTempOff/Testing/Code/Common
82/188 Testing itkImagePixelPositionTest ....
Test command:
/home/michel/tools/Insight_ALL/InsightDebugBuildSharedTempOff/bin/itkCommonTests
itkImagePixelPositionTest
Test timeout computed to be: 9.99988e+06
Create the input image pattern.
i j 0 0 point [1.5, 2]
i j 1 0 point [3, 4]
i j 2 0 point [4.5, 6]
i j 3 0 point [6, 8]
i j 4 0 point [7.5, 10]
i j 5 0 point [9, 12]
i j 0 1 point [1.5, 2]
i j 1 1 point [3, 4]
i j 2 1 point [4.5, 6]
i j 3 1 point [6, 8]
i j 4 1 point [7.5, 10]
i j 5 1 point [9, 12]
index [0, 0] get 64
index [1, 0] get 65
index [2, 0] get 66
index [3, 0] get 67
index [4, 0] get 68
index [5, 0] get 69
index [0, 1] get 65
index [1, 1] get 66
index [2, 1] get 67
index [3, 1] get 68
index [4, 1] get 69
index [5, 1] get 70
-
--
Michel Audette, Ph.D.
R & D Engineer,
Kitware Inc.,
Chapel Hill, N.C.
--
Michel Audette, Ph.D.
R & D Engineer,
Kitware Inc.,
Chapel Hill, N.C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090522/df238f65/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkImagePixelPositionTest.cxx
Type: text/x-c++src
Size: 3117 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090522/df238f65/attachment-0001.cxx>
More information about the Insight-developers
mailing list