airlab-unibas / airlab

Image registration laboratory for 2D and 3D image data
Apache License 2.0
408 stars 92 forks source link

Seems uncorrect corresponding landmarks #31

Closed KakaVlasic closed 4 years ago

KakaVlasic commented 4 years ago

Hi, Thanks for sharing! Given a point pts1 in fixed image, then I use pts2 = al.Points.transform(pts1, displacement) to get corresponding point in moving image. But seems uncorrect. someone give me a hand? many thanks!

help
ChristophJud commented 4 years ago

make sure that the displacement is not in the -1/1 standardized domain (check unit_displacement_to_displacement and displacement_to_unit_displacement).

KakaVlasic commented 4 years ago

make sure that the displacement is not in the -1/1 standardized domain (check unit_displacement_to_displacement and displacement_to_unit_displacement).

Thanks for your reply! I check the displacement value and find it is in range -0.3/0.5. And I use displacement = al.transformation.utils.unit_displacement_to_displacement(displacement) to transform its range to -7.6/7.8. Then I try to transform corresponding points again, but still seem uncorrect results. It would be great if you can give us some comments or suggestions. Thank you very much!

ChristophJud commented 4 years ago

I think your landmark is at a quite critical location namely at the border of a region with quit a large displacement (on the right hand side of the landmark). As you are dealing with binary images, there is no structure contained within the object which could guides the registration for a differentiated displacement withing such a region. Maybe, the registration is not good enough. Could you try to transform a landmark at an easier location? Or do you have images of the same object with more structure?

yangxue0827 commented 4 years ago

my code:

displacement = transformation.get_displacement()
warped_image = al.transformation.utils.warp_image(moving_image, displacement)
polybox = [[654, 260], [654, 290], [700, 290], [700, 260]]
warped_polybox = al.Points.transform(np.array(polybox).reshape([-1, 2]), displacement)
displacement = al.create_displacement_image_from_image(displacement, moving_image)

error:

Traceback (most recent call last):
  File "/Users/yangxue/Desktop/yangxue/code/airlab/examples/demo.py", line 151, in <module>
    main()
  File "/Users/yangxue/Desktop/yangxue/code/airlab/examples/demo.py", line 99, in main
    warped_polybox = al.Points.transform(np.array(polybox).reshape([-1, 2]), displacement)
  File "/Users/yangxue/Desktop/yangxue/code/airlab/airlab/utils/points.py", line 105, in transform
    raise Exception("Datatype of displacement field not supported.")
Exception: Datatype of displacement field not supported.

So I used the wrong displacement. How do I get the correct displacement? Can you give an example? @KakaVlasic