uncbiag / uniGradICON

The official website for uniGradICON: A Foundation Model for Medical Image Registration
Apache License 2.0
64 stars 3 forks source link

first try failed. #3

Open devhliu opened 5 months ago

devhliu commented 5 months ago

t1w This is my first try.... it seems the regularization is still a big issue....

marcniethammer commented 5 months ago

Looks like this is a multi-modal test case. Can you run a case without instance optimization? If this works then it is possible that switching the similarity measure from 1-LNCC to 1-LNCC^2 for instance optimization could fix the issue.

HastingsGreer commented 5 months ago

Hi! As much as I bragged about getting spacing and orientation correct, it looks like I messed it up somewhere. Could you post the output of this program for the fixed and moving images?

import argparse
parser = argparse.ArgumentParser(description='info of a volume')
parser.add_argument('-w', action='store_true')
parser.add_argument('volumes', metavar='Volume', nargs='+',
                   help='volumes to investigate')
import SimpleITK as sitk
args = parser.parse_args()
for v in args.volumes:
    reader = sitk.ImageFileReader()

    reader.SetFileName(v)

    reader.LoadPrivateTagsOn()

    reader.ReadImageInformation()
    print("=" * 30)
    print(v)
    if(args.w):
        for k in reader.GetMetaDataKeys():
            v = reader.GetMetaData(k)
            print("({0}) = = \"{1}\"".format(k, v))

    print("Image Size: {0}".format(reader.GetSize()))
    print("Image PixelType: {0}"
          .format(sitk.GetPixelIDValueAsString(reader.GetPixelID())))
    print("Image Spacing: {0}".format(reader.GetSpacing()))
HastingsGreer commented 5 months ago

Our approach handles differences in spacing well, but not yet differences in axis orientation. The current best workaround when images have different axis orientations ( itk.Image.GetDirection() ) is to resample one image to the coordinate system of the other before registering. We hope to automate this process soon, but for now it can be handled with a call to unigradicon-warp to resample the image before calling unigradicon-register.

I've documented the issue and the fix in this notebook:

https://colab.research.google.com/drive/1CmbTUneDRAlOkjUjcOm8f9ebSOarZhT3?usp=sharing