Skip to content

New Spatial Object migration guide needs expanding #656

@hjmjohnson

Description

@hjmjohnson

Description

These changes needed to be made to compile the ANTs package. It would be nice if the migration guide were improved to indiate that these changes would be necessary.

       typename BlobType::PointType centerPoint;
       image->TransformIndexToPhysicalPoint(  cIter.GetIndex(), centerPoint );
       BlobPointer blob = BlobType::New();
-      blob->SetSigma( 1 );
+      blob->SetSigmaInObjectSpace( 1 );
       blob->SetScaleSpaceValue( val );
       blob->SetCenter(  cIter.GetIndex() );
       const typename BlobType::VectorType centerVector = centerPoint - zeroPoint;
-      blob->GetObjectToParentTransform()->SetOffset(centerVector);
-      blob->ComputeBoundingBox();
+      blob->GetModifiableObjectToParentTransform()->SetOffset(centerVector);
+      blob->ComputeMyBoundingBox();
       blobs1.push_back( blob );
       }
     }
     BlobPointer blob = BlobType::New();
-    blob->SetSigma( 1 );
+    blob->SetSigmaInObjectSpace( 1 );
     blob->SetScaleSpaceValue( image2->GetPixel( mIter.GetIndex() ) );
     blob->SetCenter(  mIter.GetIndex() );
     const typename BlobType::VectorType centerVector = centerPoint - zeroPoint;
-    blob->GetObjectToParentTransform()->SetOffset(centerVector);
-    blob->ComputeBoundingBox();
+    blob->GetModifiableObjectToParentTransform()->SetOffset(centerVector);
+    blob->ComputeMyBoundingBox();
     blobs2.push_back( blob );
     }

   {
-    return this->GetSigma() *  itk::Math::sqrt2;
+    return this->GetSigmaInObjectSpace() *  itk::Math::sqrt2;
   }

-    blob->GetObjectToParentTransform()->SetOffset(centerVector);
-    blob->ComputeBoundingBox();
+    blob->GetModifiableObjectToParentTransform()->SetOffset(centerVector);
+    blob->ComputeMyBoundingBox();

-            if( !fixedImageMask || fixedImageMask->IsInside( point ) )
+            if( !fixedImageMask || fixedImageMask->IsInsideInObjectSpace( point ) )

Additionally, I think these examples in ITK proper would not compile without changing to "GetModifiableObjectToParentTransform" so they should be removed, or fixed and tested.

Examples/RegistrationITKv3/ModelToImageRegistration1.cxx:  ellipse1->GetObjectToParentTransform()->SetOffset(offset);
Examples/RegistrationITKv3/ModelToImageRegistration1.cxx:  ellipse2->GetObjectToParentTransform()->SetOffset(offset);
Examples/RegistrationITKv3/ModelToImageRegistration1.cxx:  ellipse3->GetObjectToParentTransform()->SetOffset(offset);
Modules/Core/SpatialObjects/test/SpatialObjectTest.py:ellipse.GetObjectToParentTransform().SetOffset([20, 20])
Modules/Core/SpatialObjects/test/SpatialObjectTest.py:box.GetObjectToParentTransform().SetOffset([20, 40])
Modules/Core/SpatialObjects/test/SpatialObjectTest.py:gaussian.GetObjectToParentTransform().SetOffset([60, 60])

Steps to Reproduce

Try to compile ANTs with new version of ITK.

Expected behavior

If building with legacy mode, then the old function names should be available in deprecated mode issuing warnings.

Actual behavior

Developers spend a lot of time trying to figure out how to change code to meet the new naming conventions :).

Reproducibility

Always, until ANTs upgrades all code and requires ITK v5 after March 29th.

Versions

After update to SpatialObjects.

Environment

All

Metadata

Metadata

Assignees

Labels

type:BugInconsistencies or issues which will cause an incorrect result under some or all circumstances

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions