imglib / imglib2-realtransform

Spatial transformations for ImgLib2
Other
7 stars 7 forks source link

AffineTransform3D.scale should take three parameters for potential anisotropic scaling #23

Closed haesleinhuepf closed 5 years ago

haesleinhuepf commented 5 years ago

Dear all,

I just tried to combine a translation, rotation and (anisotropic) scaling in an AffineTransform3D. However, AffineTransform3D.scale(double s) takes only one parameter. With a Scale3D you cannot scale an image centered (scaling and translation combined). Am I missing something? How would you guys do such an operation?

Thanks!

Cheers, Robert

axtimwalde commented 5 years ago

Just added this https://github.com/imglib/imglib2-realtransform/commit/8df6a73c19073862181b4a349bbdc3ad25162c8e. Until released, do

final AffineTransform3D scale = new AffineTransform3D();
scale.set(
  s0, 0, 0, 0,
  0, s1, 0, 0,
  0, 0, s2, 0);
at.preConcatenate(scale);
haesleinhuepf commented 5 years ago

Great! Thanks a lot!

axtimwalde commented 5 years ago

Oh--and the other part in pseudocode: at.translate(-center) at.scale() at.translate(center)