Wrong Documentation on Patch.makeFlatImage

On the documentation website, it says that the srcRect input (an Java Rectangle object) is in world coordinates. However, it is actually in pixels. So this is actually wrong.

Also, I cannot find any documentation regarding converting from world coords to pixels. Please advise.

Thanks,

  • Angela

Hi @AngelaZ,

Is this the part of the documentation you’re referring to? If so, I think it is correct there.

World coordinates does not mean physical coordinates. I.e. world coordinates are indeed units of pixels. World coordinates refer to the space that patches live in. So, the origin of a patch might not be at the origin of the “world”

You can go from world coordinates (pixel units) to patch coordinates (pixel units) with the toPixelCoordinates method.

Hope this clears things up, but post back if I misunderstood, or if anything is still confusing
John

Hi John,

I see what you mean, but there is a disconnect between the wording in the makeFlatImage function and the wording in the ball object (Display.getFront().getLayerSet().getZDisplayables(Ball)) function, in ball_ob.getWorldBalls() (set ball_ob to one element in all ball objects.). The output of ball_ob.getWorldBalls() claims to be the ‘world coordinates’ but this is not the pixel unit ‘world coordinates’ in patch.makeFlatImage. I am not sure how to bridge the gap between the ball object world coordinates and the patch world coordinates, other than trial and error.

1 Like

@albertcardona @axtimwalde Do you have any thoughts here?

I wish I had been more consistent. Indeed, when discussing images, world coordinates refers to pixels, whereas when discussing objects like ini.trakem2.display.Ball, it means calibrated space (e.g. nanometers, micrometers). There may be more instances of this confusion. In the end, the only true documentation is the code itself, at https://github.com/trakem2/TrakEM2

1 Like

Thanks for the verification, Albert. It would be really helpful to have an example on how to convert between the two. Appreciate your help!