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

Error using LandmarkBasedTransformInitializer with BSpline transform #1385

Closed
ctorti opened this issue Apr 29, 2021 · 1 comment
Closed

Error using LandmarkBasedTransformInitializer with BSpline transform #1385

ctorti opened this issue Apr 29, 2021 · 1 comment
Labels

Comments

@ctorti
Copy link

ctorti commented Apr 29, 2021

Hello,

I am aware of sitk.BSplineTransformInitializer(image1, transformDomainMeshSize, order) for performing BSpline registrations, but I am trying to initialize the registration using LandmarkBasedTransformInitializer.

Following is how I attempt to obtain a landmark-based transform for a 'rigid', 'affine' or 'bspline' transform:

def GetLandmarkTx(FixIm, MovIm, FixPts, MovPts, 
                  Transform='rigid', NumControlPts=8):
    import SimpleITK as sitk
    
    if Transform == 'rigid':
        SitkTransform = sitk.VersorRigid3DTransform()
    elif Transform == 'affine':
        SitkTransform = sitk.AffineTransform(FixIm.GetDimension())
    elif Transform == 'bspline':
        SitkTransform = sitk.BSplineTransform(FixIm.GetDimension())
    else:
        msg = "Transform must be either 'rigid', 'affine' or 'bspline'."
        raise Exception(msg)
    
    if Transform == 'bspline':
        LandmarkTx =sitk.LandmarkBasedTransformInitializer(transform=SitkTransform, 
                                                           fixedLandmarks=FixPts, 
                                                           movingLandmarks=MovPts,
                                                           referenceImage=FixIm,
                                                           numberOfControlPoints=NumControlPts)
    else:
        LandmarkTx = sitk.LandmarkBasedTransformInitializer(transform=SitkTransform, 
                                                           fixedLandmarks=FixPts, 
                                                           movingLandmarks=MovPts,
                                                           referenceImage=FixIm)

    return LandmarkTx

The above works fine for 'rigid' and 'affine', but the following error occurs for 'bspline':

Exception thrown in SimpleITK LandmarkBasedTransformInitializer: C:...\ITK\Modules\Core\Common\src\itkMultiThreader.cxx:395:
itk::ERROR: MultiThreader(0000025C4E20D020): Exception occurred during SingleMethodExecute

Any advice would be much appreciated.

@blowekamp
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants