Skip to content

Commit

Permalink
Revert itk image origin fix
Browse files Browse the repository at this point in the history
The patch DGtal-team#1484 mixes index space and physical space (with origins) in
ITK.

The iterators work on regions, defined by an `index` and a `size`.
Metadata, like origin, that is defined in the physical space, cannot be
mixed there.

Revert DGtal-team#1484
  • Loading branch information
phcerdan committed May 15, 2020
1 parent 022dbbe commit e85586c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/DGtal/images/ImageContainerByITKImage.ih
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,13 @@ namespace DGtal
const typename ITKImage::RegionType region = myITKImagePointer->GetLargestPossibleRegion();
const typename ITKImage::IndexType start = region.GetIndex();
const typename ITKImage::SizeType size = region.GetSize();
const typename ITKImage::PointType origin = myITKImagePointer->GetOrigin();


Point lowerBound;
Point upperBound;
for (Dimension k = 0; k < dimension; k++)
{
lowerBound[k] = start[k]+origin[k];
upperBound[k] = start[k]+size[k]+origin[k]-1;
lowerBound[k] = start[k];
upperBound[k] = start[k]+size[k]-1;
}

myDomain = TDomain(lowerBound, upperBound);
Expand All @@ -122,7 +120,7 @@ namespace DGtal
{
typename ITKImage::IndexType p;
for (Dimension k = 0; k < dimension; k++)
p[k] = aPoint[k]-myITKImagePointer->GetOrigin()[k];
p[k] = aPoint[k];
return myITKImagePointer->GetPixel(p);
}

Expand Down Expand Up @@ -175,7 +173,7 @@ namespace DGtal
{
typename ITKImage::IndexType p;
for (Dimension k = 0; k < dimension; k++)
p[k] = aPoint[k]-myITKImagePointer->GetOrigin()[k];
p[k] = aPoint[k];
myITKImagePointer->SetPixel(p, V);
}

Expand Down

0 comments on commit e85586c

Please sign in to comment.