ijpb / MorphoLibJ

Collection of mathematical morphology methods and plugins for ImageJ
http://imagej.net/MorphoLibJ
GNU Lesser General Public License v3.0
101 stars 48 forks source link

croplabel() , set pixel/voxel size and origin of the cropped image #63

Closed romainGuiet closed 11 months ago

romainGuiet commented 2 years ago

Dear @MorphoLibJ team,

Would it be possible to add the pixel/voxel size and the origin of the cropped image (maybe via Calibration ? )

https://github.com/ijpb/MorphoLibJ/blob/59b691fb8fa457e2fad8d5eb57c82c0fe6115e67/src/main/java/inra/ijpb/label/LabelImages.java#L329

This would ease a lot the use of this cropped image!

One workaround is to get the BoudingBox via "Analyze Regions 3D", but I'm a bit afraid by rounding issues ...

Cheers,

R

dlegland commented 2 years ago

hi Romain, yes, sounds like a good idea! using Calibration looks the best way to do a priori.

dlegland commented 1 year ago

Hi,

I finally took some time to implement this! It was introduced in commit https://github.com/ijpb/MorphoLibJ/commit/6a98b8d31543b8c992c7806c5612ff1f5d1eb5cf. The bounds are computed via a new "IntBounds2D/3D" class, that prevents from rounding errors.

By the way, I do not know why I closed the PR you opened? maybe I was too quick to cleanup branches... Anyway, I hope this (finally...) fits the need

Best, David

dlegland commented 11 months ago

fixed in release 1.6.2