fiji / Stitching

Fiji's Stitching plugins reconstruct big images from tiled input images.
http://imagej.net/Stitching
GNU General Public License v2.0
96 stars 64 forks source link

Fix downsampling issue #69

Open lguerard opened 1 year ago

lguerard commented 1 year ago

Just changing this line fixes the issue with the TileConfiguration reported here : https://forum.image.sc/t/fusion-of-label-images-using-downsampling/73150

Closes #38.

lguerard commented 1 year ago

@imagejan Thanks for cleaning up a bit the PR ;)

However, I'm not sure if that closes the issue aryehw was mentioning, but it at least closes mine. (I probably should have made a different issue for this, sorry..)

imagejan commented 1 year ago

Good point, @lguerard, sorry, I maybe was a bit fast to add the "Closes #38" to your PR description.

38 actually talks about "Filename defined position", which is grid type 4 according to here:

https://github.com/fiji/Stitching/blob/340ab1123e1b1c32744e05df63c5c0023056fc15/src/main/java/plugin/GridType.java#L48

So how about relaxing to gridType >= 4 even?

lguerard commented 1 year ago

I would be fine but I don't have any files to test the other types which is why I asked if there was a reason to keep it only for 5 and 7.

imagejan commented 1 year ago

@lguerard wrote in https://github.com/fiji/Stitching/issues/38#issuecomment-1293368423

Was there a reason to only do the downsampling if GridType was 5 or 7 ?

The Downsampler logic was introduced with https://github.com/fiji/Stitching/commit/f37c98f8b6ca3fb9bc8cc27a7efa2bf2021ff4bf.

There's actually two code paths, for grid type {5,7} and for all others:

So while the fix might work for your case, @lguerard, I believe there was some other breakage since https://github.com/fiji/Stitching/commit/f37c98f8b6ca3fb9bc8cc27a7efa2bf2021ff4bf. It would be good to have unit test cases for this 😄

lguerard commented 1 year ago

Indeed, sorry about this. I'll investigate a bit more and update this PR when I have found something !

lguerard commented 1 year ago

Actually, I think I was right.

If I understand correctly what the ImageCollection corresponds to, this part https://github.com/fiji/Stitching/blob/340ab1123e1b1c32744e05df63c5c0023056fc15/src/main/java/plugin/Stitching_Grid.java#L417-L418 only changes the grid elements which corresponds to the position of the tiles no ? The real downsampling of the ImagePlus is happening here and only if the GridType is 5 or 7. https://github.com/fiji/Stitching/blob/340ab1123e1b1c32744e05df63c5c0023056fc15/src/main/java/plugin/Stitching_Grid.java#L460-L466