InsightSoftwareConsortium / SimpleITK-Notebooks

Jupyter notebooks for learning how to use SimpleITK
Apache License 2.0
841 stars 351 forks source link

registration_errors() function working in Registration_Utilities.py #122

Closed subhajitchatu closed 7 years ago

subhajitchatu commented 7 years ago

Hi,

This is not an issue, this is regarding a problem I have been encountered in image registration. Let me first discuss my problem in brief.

Experiment :

  1. I have a reference image and a moving image.(multimodal image)
  2. Registered using lets say method A, B , C, and D.
  3. I just want to compare A,B,C,D's accuracy in registration.
  4. I don't have any golden point-set database, neither it is possible in my case. I have only three image, fixed, moving and registered.

    Thoughts :

    Now while I come across this registration_utilities function, I thought if the fixed image is registered with moving image accurately, then ideal case, fixed image coordinate space = registered image coordinate space. Now if we pass some random point from Fixed image in two arguments of registration_errors(fixed_image_random,fixed_image_random,transformation_matrix). Then fixed_image_random will be transformed to a new point set, and will be compared with fixed_image_random in some sort of distance measurements. Should this be a measure for accuracy of registration?

Other Inputs:

Is there any other way to check which method A,B,C,D is better in registration. How can we measure registration accuracy with just

  1. Fixed image
  2. Moving Image
  3. TransformationA, TransformationB, TransformationC, TransformationD Thanks
zivy commented 7 years ago

You're presentation of the experimental input+output is slightly off. What you actually have is:

  1. fixed image
  2. moving image
  3. Ta, Tb, Tc, Td - four transformations that map points in the fixed image coordinate system to the moving image coordinate system. The "registered image" is an application of a transformation in combination with interpolation, it isn't the output of the registration.

In general to evaluate the quality of registration you need to use data that is not used by the registration process. In many cases these are pairs of corresponding points in the two coordinate spaces. A somewhat coarser approach is to use two segmentations of the same structures in both coordinate spaces and then evaluate the overlap/surface distance etc. We currently have no better way of evaluating registration.

The approach you are suggesting in the "Thoughts" section is incorrect. Providing the same point set twice means you are expecting the transformation_matrix to be the identity. If you expect the transformation to be the identity then there is no need for registration as the data is already aligned.

Finally, if you only have N transformations and you want to compare them you could use the same similarity metric you used for registration. As the goal is to minimize the similarity measure the transformation that corresponds to the minimal value is the best. This doesn't necessarily mean that it yields the best alignment, it could be that your similarity measure has deeper minima that are far from the correct alignment.

For further information please look into the registration literature (surveys/overviews etc.).

subhajitchatu commented 7 years ago

@zivy

Thanks for the reply! Correct me if I am wrong.

  1. "In general to evaluate the quality of registration you need to use data that is not used by the registration process" No I am not telling about a new method. Its all about standard method. I just want to check how well our data set has been registered. Just need that precision. Like A method gives arounf 4mm error after registration, B gives 3mm in our dataset. Thats all I want to know.

  2. Similarity metric can only compare between A,B,C,D but it will never give us the idea how good the registration is. Anyway what I am trying to say is if we apply Rigid Registration it will not take care of local motions as it is more about the global registration. Right?

Now what we have

Fixed image -------> Tx -------> Moving Image

That means if we apply Tx inverse back on moving image we will get an image which will be aligned optimally with the Fixed Image. I mean if we overlay the two image, it should be aligned properly, thats the motivation of registration as per my knowledge. Now the Tx throughly depends on the parameter we are selecting or the optimization algorithm we are using. So that makes the difference in A,B,C,D methods.

Now what I claimed is that if we choose some random points in domain of fixed image and if it is possible to find these points in the target aligned (after applying Tx inverse to moving image) image and if we take difference we can comment about registration accuracy. So I was thinking is it possible to use registration_errors() for this purpose.

  1. Can you please tell how do u recommend to use registration_errors() function. If I have only one dataset, some standard method , I just want to know the error term in mm. As this is multimodal diff image is normally not a good measurement. Rather it would be great if I can show the euclidean distance difference between some points.

  2. "This doesn't necessarily mean that it yields the best alignment, it could be that your similarity measure has deeper minima that are far from the correct alignment." -

What do u mean by deeper minima? When we are applying Gradient Descent , then the objective function a convex one. Right? Which has only one minima which is global also. Correct me if I am wrong.

Thanks

subhajitchatu commented 7 years ago

Hi @zivy

I have another simple question. As you suggested multiple box shaped regions of interest can be segmented using the ROIDataAquisition component found in the gui.py module.

If I can put a mask on both fixed image and registered image(applying inverse Tx on moving image) and then Can this function be used for overlap measures(Jaccard, dice) , Hausdroff distance for Image registration evaluation?

Please elaborate.

Thanks

zivy commented 7 years ago

If you are able to identify the exact same box in both datasets then, yes the two "segmentations" are expected to overlap after registration. This would be equivalent to a real segmentation of the same anatomical structure in both images. Then you can use all of the overlap and surface distance measures to evaluate registration. I doubt though that it is easy to identify the same box shaped region in two anatomical images (I am assuming this is the data you are working with and not images of man made structures).