Skip to content

Commit

Permalink
BUG: RayCastInterpolateImageFunciton physical space issues
Browse files Browse the repository at this point in the history
Patches are incorporated from Jian Wu <eewujian at hotmail.com> to address
locations within physical space:

  https://public.kitware.com/pipermail/insight-users/2006-March/017265.html
  https://public.kitware.com/pipermail/insight-users/2006-March/017127.html

and Aviv Hurvitz <aviv.hurvitz@gmail.com>:

  https://public.kitware.com/pipermail/insight-users/2008-July/026509.html

The tested point is moved to lie outside of the input volume.

A new baseline is required for the example, whose output is now what is
expected from passing through a empty cube.

Change-Id: Ic3ff1cdd566adaf8a417ef0d6e9501deafca822b
  • Loading branch information
thewtex committed Oct 5, 2017
1 parent d930b84 commit cc94806
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Examples/Filtering/DigitallyReconstructedRadiograph1.cxx
Expand Up @@ -390,8 +390,8 @@ int main( int argc, char *argv[] )


#ifdef WRITE_CUBE_IMAGE_TO_FILE
char *filename = "cube.gipl";
typedef itk::ImageFileWriter< OutputImageType > WriterType;
const char *filename = "cube.gipl";
typedef itk::ImageFileWriter< InputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();

writer->SetFileName( filename );
Expand Down
Expand Up @@ -677,14 +677,9 @@ RayCastHelper< TInputImage, TCoordRep >
m_VoxelDimensionInY = spacing[1];
m_VoxelDimensionInZ = spacing[2];

m_CurrentRayPositionInMM[0] =
rayPosition[0] + 0.5 * m_VoxelDimensionInX * (double)m_NumberOfVoxelsInX;

m_CurrentRayPositionInMM[1] =
rayPosition[1] + 0.5 * m_VoxelDimensionInY * (double)m_NumberOfVoxelsInY;

m_CurrentRayPositionInMM[2] =
rayPosition[2] + 0.5 * m_VoxelDimensionInZ * (double)m_NumberOfVoxelsInZ;
m_CurrentRayPositionInMM[0] = rayPosition[0];
m_CurrentRayPositionInMM[1] = rayPosition[1];
m_CurrentRayPositionInMM[2] = rayPosition[2];

m_RayDirectionInMM[0] = rayDirection[0];
m_RayDirectionInMM[1] = rayDirection[1];
Expand Down Expand Up @@ -1451,7 +1446,7 @@ RayCastInterpolateImageFunction< TInputImage, TCoordRep >
ray.ZeroState();
ray.Initialise();

ray.SetRay(point, direction);
ray.SetRay(point - this->m_Image->GetOrigin().GetVectorFromOrigin(), direction);
ray.IntegrateAboveThreshold(integral, m_Threshold);

return ( static_cast< OutputType >( integral ) );
Expand Down
Expand Up @@ -22,6 +22,7 @@
#include "itkRayCastInterpolateImageFunction.h"
#include "itkTranslationTransform.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkTestingMacros.h"


int
Expand Down Expand Up @@ -121,13 +122,15 @@ itkRayCastInterpolateImageFunctionTest(
/* Evaluate the function */
double integral;
PointType query;
query[0] = 15;
query[1] = 15;
query[2] = 15;
query[0] = 15.;
query[1] = 15.;
query[2] = -2.;

integral = interp->Evaluate(query);

std::cout << "Integral = " << integral << std::endl;

TEST_EXPECT_TRUE( itk::Math::FloatAlmostEqual( integral, 1247. ) );

return EXIT_SUCCESS;
}
@@ -1 +1 @@
ee87a6fdee961da3da7e8bd3700fea0c
9b784ba9db935382f9ab2e133358533d

This file was deleted.

0 comments on commit cc94806

Please sign in to comment.