Problem with Fiji with ROI.getPosition macro command

Hello,

The macro command Roi.getPosition(channel, slice, frame); always return 0 under Fiji whereas it is working well with classical imageJ. Same macro, same images, same ROI…
Problem under Fiji only but not present under imageJ , both with same version (1.52 V).
Any suggestion to bypass the problem and be sure it will work under Fiji and ImageJ ?
Thank you

@beghinanne

Can you provide a minimal working code example that shows this issue you are seeing? That way - we can try to replicate the issue on our side… So just write a short, easy macro that demos this issue and share it here.

1 Like

Yes of course ! Here a short macro. I tried with v1.52v. It Return 0,0,0.
Whereas it returns 13, 0, 1 with v1.52t. It seems to be more a problem of version than Fiji vs IJ.

run("Confocal Series (2.2MB)");
setSlice(25);
makeOval(229, 97, 76, 83);
roiManager("Add");
roiManager("Select", 0);
Roi.getPosition(channel, slice, frame); 
print(slice);
print(channel);
print(frame);

Thank you for your help !

1 Like

Use Roi.setPosition(channel,slice,frame) to set the ROI position, as in the following version of your test macro. The setSlice() function does not work with hyperstacks and does not set ROI positions.

  close("ROI Manager");
  run("Confocal Series (2.2MB)");
  makeOval(229, 97, 76, 83);
  Roi.setPosition(0,25,0);
  roiManager("Add");
  roiManager("Select", 0);
  Roi.getPosition(channel, slice, frame);
  print(channel, slice, frame);
1 Like