airlab-unibas / airlab

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

how to get point in moving image, can you give an example? #34

Open yangxue0827 opened 4 years ago

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?