fiji / bUnwarpJ

ImageJ/Fiji plugin for consistent elastic registration of 2D images
http://imagej.net/BUnwarpJ
GNU General Public License v3.0
23 stars 10 forks source link

bUnwarpJ Transformation is wrong if subsampling is used #1

Closed StephanPreibisch closed 9 years ago

StephanPreibisch commented 9 years ago

Hi @iarganda,

when I call bUnwarpJ through source code, something like this: final Transformation t = bUnwarpJ_.computeTransformationBatch( targetImp, sourceImp, null, null, mode, img_subsamp_fact, min_scale_deformation, max_scale_deformation, divWeight, curlWeight, landmarkWeight, imageWeight, consistencyWeight, stopThreshold );

and then apply the transformation myself (transforming an ImgLib2 image):

t.transform( u, v, l, true );

The result turns out only to be correct if the sub_samp_fact == 0, otherwise it is somehow not corrected for it. Is there a way to achieve that?

Thanks so much, Stephan

StephanPreibisch commented 9 years ago

A workaround is to do it like that, so I am happy so far:

final double s = subSampling == 0 ? 1 : Math.pow( 2, subSampling );

final double u = cursor.getDoublePosition( 0 ) / s; final double v = cursor.getDoublePosition( 1 ) / s;

t.transform( u, v, l, true );

l[ 0 ] = s; l[ 1 ] = s;

iarganda commented 9 years ago

Hello @StephanPreibisch ,

The code should be indeed like that. I'll try to fix it ASAP.

Thanks for reporting!

iarganda commented 9 years ago

OK, @StephanPreibisch , I just made a new release fixing this bug. Let me know if you need anything else. Thanks again for reporting!