Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Get ITK_USE_FLOAT_SPACE_PRECISION=ON to compile again #4805

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Examples/DataRepresentation/Image/Image4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ main(int, char *[])
// SoftwareGuide : EndLatex

// Software Guide : BeginCodeSnippet
using MatrixType = itk::Matrix<double, Dimension, Dimension>;
using MatrixType =
itk::Matrix<itk::SpacePrecisionType, Dimension, Dimension>;
MatrixType SpacingMatrix;
SpacingMatrix.Fill(0.0F);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ TEST(SpatialOrientationAdaptor, test1)
EXPECT_EQ(itk::SpatialOrientationEnums::ValidCoordinateOrientations::ITK_COORDINATE_ORIENTATION_RAI,
adapter.FromDirectionCosines(d1));

const double data[] = { 0.5986634407395047, 0.22716302314740483, -0.768113953548866,
0.5627936241740271, 0.563067040943212, 0.6051601804419384,
0.5699696670095713, -0.794576911518317, 0.20924175102261847 };
DirectionType d2{ DirectionType::InternalMatrixType{ data } };
const itk::SpacePrecisionType data[] = { 0.5986634407395047, 0.22716302314740483, -0.768113953548866,
0.5627936241740271, 0.563067040943212, 0.6051601804419384,
0.5699696670095713, -0.794576911518317, 0.20924175102261847 };
DirectionType d2{ DirectionType::InternalMatrixType{ data } };
EXPECT_EQ(itk::SpatialOrientationEnums::ValidCoordinateOrientations::ITK_COORDINATE_ORIENTATION_ASL,
adapter.FromDirectionCosines(d2));
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeImageFunction
static constexpr unsigned int ImageDimension2 = ImageDimension;
#endif

using ContinuousIndexType = ContinuousIndex<SpacePrecisionType, Self::ImageDimension>;
using ContinuousIndexType = typename Superclass::ContinuousIndexType;

using NeighborhoodType = Neighborhood<InputPixelType, Self::ImageDimension>;
using OperatorNeighborhoodType = Neighborhood<TOutput, Self::ImageDimension>;
Expand All @@ -96,7 +96,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeImageFunction

/** Point type alias support */
// using PointType = Point< TOutput, Self::ImageDimension >;
using PointType = typename InputImageType::PointType;
using PointType = typename Superclass::PointType;

/** Evaluate the function at the specified point. */
OutputType
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/ImageFunction/include/itkImageFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ITK_TEMPLATE_EXPORT ImageFunction : public FunctionBase<Point<TCoordRep, T

/** Evaluate the function at specified Point position.
* Subclasses must provide this method. */
TOutput
OutputType
Evaluate(const PointType & point) const override = 0;

/** Evaluate the function at specified Index position.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


using InputPixelType = double;
using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;

// Set up for 1D Images
enum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ enum
using ImageType = itk::Image<InputPixelType, ImageDimension>;
using ImageAdaptorType = itk::ImageAdaptor<ImageType, RedChannelPixelAccessor>;

using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;

using InterpolatorType = itk::LinearInterpolateImageFunction<ImageAdaptorType, CoordRepType>;
using IndexType = InterpolatorType::IndexType;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/ImageFunction/test/itkInterpolateTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

using SizeType = itk::Size<3>;
using ImageType = itk::Image<unsigned short, 3>;
using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::LinearInterpolateImageFunction<ImageType, CoordRepType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum
}; // RGB is a vector of dimension 3
using PixelType = itk::RGBPixel<unsigned short>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordRepType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum
};
using PixelType = itk::Vector<unsigned short, VectorDimension>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordRepType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum
};
using PixelType = itk::Vector<unsigned short, VectorDimension>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = double;
using CoordRepType = itk::SpacePrecisionType;

using InterpolatorType = itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction<ImageType, CoordRepType>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ itkImageMaskSpatialObjectTest2(int, char *[])
// Set the direction for a non-oriented image
// to better test the frequently encountered case
// Use non axis aligned image directions
itk::Euler3DTransform<double>::Pointer tfm = itk::Euler3DTransform<double>::New();
auto tfm = itk::Euler3DTransform<itk::SpacePrecisionType>::New();
tfm->SetRotation(30.0 * itk::Math::pi_over_180, 15.0 * itk::Math::pi_over_180, 10.0 * itk::Math::pi_over_180);
const ImageType::DirectionType direction = tfm->GetMatrix();
image->SetDirection(direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ itkRandomImageSourceAttributesTest(int, char *[])
const ImageType2D::SizeType size{ { 25, 25 } };
const ImageType2D::SpacingType spacing{ { { 0.7, 2.1 } } };
const ImageType2D::PointType origin{ { { -1.7, 5.2 } } };
const double d[4] = { 0, 1.0, 1.0, 0 };
const itk::SpacePrecisionType d[4] = { 0, 1.0, 1.0, 0 };
const ImageType2D::DirectionType direction = ImageType2D::DirectionType::InternalMatrixType(d);
const ImageType2D::ValueType min{ 0.0 };
const ImageType2D::ValueType max{ 1000.0 };
Expand All @@ -90,7 +90,7 @@ itkRandomImageSourceAttributesTest(int, char *[])
const ImageType3D::SizeType size{ { 14, 17, 36 } };
const ImageType3D::SpacingType spacing{ { { 0.7, 0.4, 1.2 } } };
const ImageType3D::PointType origin{ { { -1.7, 5.2, 3.4 } } };
const double d[9] = { 0, 1.0, 0, 1.0, 0, 0, 0, 1.0, 0 };
const itk::SpacePrecisionType d[9] = { 0, 1.0, 0, 1.0, 0, 0, 0, 1.0, 0 };
const ImageType3D::DirectionType direction = ImageType3D::DirectionType::InternalMatrixType(d);
const ImageType3D::ValueType min{ 0.0 };
const ImageType3D::ValueType max{ 10.0 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CheckValueIsPhysicalPoint(const TImageType * img)
for (unsigned int i = 0; i < TImageType::ImageDimension; ++i)
{
img->TransformIndexToPhysicalPoint(it.GetIndex(), pt);
if (!itk::Math::FloatAlmostEqual(pt[i], it.Get()[i]))
if (!itk::Math::FloatAlmostEqual<itk::SpacePrecisionType>(pt[i], it.Get()[i]))
{
typename TImageType::PointType::VectorType diff;
for (unsigned int j = 0; j < TImageType::ImageDimension; ++j)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ ShapeLabelMapFilter<TImage, TLabelImage>::ComputeOrientedBoundingBox(LabelObject
// iterate over all corners (2^D) of the pixel
for (unsigned int p = 0; p < 1u << ImageDimension; ++p)
{
Vector<double, ImageDimension> spacingAxis(0.5 * spacing);
Vector<double, ImageDimension> spacingAxis(spacing * 0.5);
dzenanz marked this conversation as resolved.
Show resolved Hide resolved

// permute signs of spacing vector components, based on a bit of p
// to component of spacingAxis mapping
Expand Down
16 changes: 8 additions & 8 deletions Modules/Filtering/LabelMap/test/itkShapeLabelMapFilterGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ TEST_F(ShapeLabelMapFixture, 3D_T3x2x1_Direction)

DirectionType direction;

const double d[9] = { 0.7950707161543119, -0.44533237368675166, 0.41175433605536305,
-0.6065167008084678, -0.5840224148057925, 0.5394954222649374,
0.00021898465942798317, -0.6786728931900383, -0.7344406416415056 };
const itk::SpacePrecisionType d[9] = { 0.7950707161543119, -0.44533237368675166, 0.41175433605536305,
-0.6065167008084678, -0.5840224148057925, 0.5394954222649374,
0.00021898465942798317, -0.6786728931900383, -0.7344406416415056 };

direction = DirectionType::InternalMatrixType(d);

Expand Down Expand Up @@ -342,9 +342,9 @@ TEST_F(ShapeLabelMapFixture, 3D_T2x2x2_Spacing_Direction)

DirectionType direction;

const double d[9] = { 0.7950707161543119, -0.44533237368675166, 0.41175433605536305,
-0.6065167008084678, -0.5840224148057925, 0.5394954222649374,
0.00021898465942798317, -0.6786728931900383, -0.7344406416415056 };
const itk::SpacePrecisionType d[9] = { 0.7950707161543119, -0.44533237368675166, 0.41175433605536305,
-0.6065167008084678, -0.5840224148057925, 0.5394954222649374,
0.00021898465942798317, -0.6786728931900383, -0.7344406416415056 };

direction = DirectionType::InternalMatrixType(d);

Expand Down Expand Up @@ -455,7 +455,7 @@ TEST_F(ShapeLabelMapFixture, 2D_T1_1_FlipDirection)

DirectionType direction;

const double d[4] = { 0, 1.0, 1.0, 0 };
const itk::SpacePrecisionType d[4] = { 0, 1.0, 1.0, 0 };

direction = DirectionType::InternalMatrixType(d);

Expand Down Expand Up @@ -489,7 +489,7 @@ TEST_F(ShapeLabelMapFixture, 2D_T1_2_Direction)

DirectionType direction;

const double d[4] = { 0, 1.0, 1.0, 0 };
const itk::SpacePrecisionType d[4] = { 0, 1.0, 1.0, 0 };

direction = DirectionType::InternalMatrixType(d);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ExtractOrthogonalSwath2DImageFilter<TImage>::GenerateData()
ProgressReporter progress(this, 0, outputRegion.GetNumberOfPixels());

using OutputIterator = ImageRegionIteratorWithIndex<ImageType>;
using InterpolatorType = LinearInterpolateImageFunction<ImageType, double>;
using InterpolatorType = LinearInterpolateImageFunction<ImageType, itk::SpacePrecisionType>;

ImageIndexType index;
double orthogonalOffset;
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/NIFTI/test/itkNiftiImageIOTest12.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ itkNiftiImageIOTest12(int argc, char * argv[])

ImageType::IndexType threeIndex = { { 3, 3, 3 } };
ImageType::PointType origPhysLocationIndexThree;
image->TransformIndexToPhysicalPoint<double>(threeIndex, origPhysLocationIndexThree);
image->TransformIndexToPhysicalPoint<itk::SpacePrecisionType>(threeIndex, origPhysLocationIndexThree);
ImageType::PointType readPhysLocationIndexThree;
readImage->TransformIndexToPhysicalPoint<double>(threeIndex, readPhysLocationIndexThree);
readImage->TransformIndexToPhysicalPoint<itk::SpacePrecisionType>(threeIndex, readPhysLocationIndexThree);

// If the origins, and the spacings, and the direction cosines are the smae,
// then index locations should all represent the same physical locations as well.
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/NIFTI/test/itkNiftiImageIOTest14.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ itkNiftiImageIOTest14(int argc, char * argv[])

auto read_origin = test_image->GetOrigin();

if (itk::Math::FloatAlmostEqual(read_origin[3], 2.0, 4, 1e-6))
if (itk::Math::FloatAlmostEqual<itk::SpacePrecisionType>(read_origin[3], 2.0, 4, 1e-6))
{
imageHasCorrectTimeOrigin = true;
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/NIFTI/test/itkNiftiReadWriteDirectionTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ template <typename TImage>
bool
CheckRotation(typename TImage::Pointer img)
{
vnl_matrix_fixed<double, 3, 3> rotation = img->GetDirection().GetVnlMatrix().extract(3, 3, 0, 0);
const vnl_matrix_fixed<double, 3, 3> candidate_identity = rotation * rotation.transpose();
vnl_matrix_fixed<itk::SpacePrecisionType, 3, 3> rotation = img->GetDirection().GetVnlMatrix().extract(3, 3, 0, 0);
const vnl_matrix_fixed<itk::SpacePrecisionType, 3, 3> candidate_identity = rotation * rotation.transpose();
return candidate_identity.is_identity(1.0e-4);
}

Expand Down