How to set pre-defined points in the fixed image in gui?

I have a list of pre-defined co-ordinates written in a text file.

I want to mark these co-ordinates in the fixed image in the gui. After the marked fixed image is obtained, the corresponding co-ordinates in the moving image will be marked manually. The resulting fixed-moving co-ordinate pairs will be used for landmark based registration.

The codes available in SimpleITK require fixed and moving images to be marked simultaneously. Is it possible to mark a set of points in the fixed image first, then find out the corresponding points in the moving image manually?

Hello @debapriya,

Unfortunately, the functionality you are asking for is not supported by the RegistrationPointDataAquisition component. Currently it only adds points via user clicks and enforces that these be pairs (can’t add multiple points to moving/fixed, have to alternate between them and this establishes the pairing).

You will need to modify the code to add the functionality you want.

Ok. I’ll try and make the necessary changes in

My goal is that I want more than one expert to mark points on the moving image, corresponding to a list of fixed image co-ordinates given in a text file. The final set of moving coordinates will be the mean of the points marked by the experts.

I have added a print("Hello World") command at the beginning of __call__ in, to check if __call__ is invoked when we click inside the figure.

No Hello World is showing on clicking inside the figure. However, the rest of the function is working properly, indicating __call__ is invoked. What could be the reason?

Hello @debapriya,

The GUI is overlaying onto the cell output so the prints are not going to be visible. Simply write to file in the __call__:

with open("gui_log.txt", "a") as fp:
  print("hello", file=fp)

It worked. Thank you.

Now, I am trying to set a counter, which will increase by 1, every time user clicks on the fixed image. I have written the following code for this purpose.

if self.viewing_checkbox.value == "edit":            
   if event.inaxes == self.fixed_axes:
       self.countF = self.countF + 1
       with open("gui_logF.txt", "w") as fp:
               print("Hello", file=fp)

gui_logF.txt is not created in this case. However, when I remove self.countF = self.countF + 1, the code snippet is working, and gui_logF.txt is created.

What is the reason?
Also, please share some study links on this topic, if possible.