Class SpimDataUtils.CalibratedSource<T extends net.imglib2.type.numeric.NumericType<T>>

java.lang.Object
bdv.util.AbstractSource<T>
bdv.util.RandomAccessibleIntervalSource<T>
sc.fiji.snt.io.SpimDataUtils.CalibratedSource<T>
Type Parameters:
T - the pixel type
All Implemented Interfaces:
bdv.viewer.Source<T>
Enclosing class:
SpimDataUtils

public static class SpimDataUtils.CalibratedSource<T extends net.imglib2.type.numeric.NumericType<T>> extends bdv.util.RandomAccessibleIntervalSource<T>
Wraps a RandomAccessibleIntervalSource and overrides getVoxelDimensions() to carry the physical unit (e.g. "µm"). Without this, BDV's ScaleBarOverlayRenderer reads "pixel" from RandomAccessibleIntervalSource.getVoxelDimensions() and the scale bar label is wrong even when calibration is applied.
  • Field Summary

    Fields inherited from class bdv.util.AbstractSource

    interpolators, name, type
  • Constructor Summary

    Constructors
    Constructor
    Description
    CalibratedSource(net.imglib2.RandomAccessibleInterval<T> rai, T type, net.imglib2.realtransform.AffineTransform3D sourceTransform, String name, double[] cal, String unit)
    Convenience constructor for sources without a time axis (timeDim = -1).
    CalibratedSource(net.imglib2.RandomAccessibleInterval<T> rai, T type, net.imglib2.realtransform.AffineTransform3D sourceTransform, String name, double[] cal, String unit, int timeDim)
    Full constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.imglib2.RealRandomAccessible<T>
    getInterpolatedSource(int t, int level, bdv.viewer.Interpolation method)
    Overridden for the same reason as getSource(int, int): BDV's actual on-screen rendering goes through getInterpolatedSource(t, level, method), not getSource() directly.
    net.imglib2.RandomAccessibleInterval<T>
    getSource(int t, int level)
     
    mpicbg.spim.data.sequence.VoxelDimensions
     
    void
    setCalibration(double[] cal, String unit)
    Updates the voxel calibration (spacing and unit) of this source.

    Methods inherited from class bdv.util.RandomAccessibleIntervalSource

    getSourceTransform

    Methods inherited from class bdv.util.AbstractSource

    doBoundingBoxCulling, getInterpolatedMaskedSource, getMaskedSource, getName, getNumMipmapLevels, getType, isPresent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CalibratedSource

      public CalibratedSource(net.imglib2.RandomAccessibleInterval<T> rai, T type, net.imglib2.realtransform.AffineTransform3D sourceTransform, String name, double[] cal, String unit, int timeDim)
      Full constructor. When timeDim >= 0, getSource(int, int) slices the RAI along that axis so each BVV timepoint returns the correct frame. RandomAccessibleIntervalSource ignores the timepoint argument entirely, causing all frames to show frame 0 for timelapse data.
    • CalibratedSource

      public CalibratedSource(net.imglib2.RandomAccessibleInterval<T> rai, T type, net.imglib2.realtransform.AffineTransform3D sourceTransform, String name, double[] cal, String unit)
      Convenience constructor for sources without a time axis (timeDim = -1).
  • Method Details

    • setCalibration

      public void setCalibration(double[] cal, String unit)
      Updates the voxel calibration (spacing and unit) of this source. Mutates the source transform diagonal and replaces the VoxelDimensions so the BVV scale bar reflects the new values.
      Parameters:
      cal - voxel spacing {x, y, z}
      unit - physical unit string (e.g. "µm")
    • getSource

      public net.imglib2.RandomAccessibleInterval<T> getSource(int t, int level)
      Specified by:
      getSource in interface bdv.viewer.Source<T extends net.imglib2.type.numeric.NumericType<T>>
      Overrides:
      getSource in class bdv.util.RandomAccessibleIntervalSource<T extends net.imglib2.type.numeric.NumericType<T>>
    • getInterpolatedSource

      public net.imglib2.RealRandomAccessible<T> getInterpolatedSource(int t, int level, bdv.viewer.Interpolation method)
      Overridden for the same reason as getSource(int, int): BDV's actual on-screen rendering goes through getInterpolatedSource(t, level, method), not getSource() directly. RandomAccessibleIntervalSource's own implementation builds the interpolated/ extended view once from the (fixed, single-timepoint) RAI passed to its constructor is always the t=0 slice. Without this override the time slider and status text update correctly (they're driven by numTimepoints alone) while the rendered image stays frozen on frame 0. Rebuilding the interpolation from our own time-aware getSource(int, int) on every call fixes this
      Specified by:
      getInterpolatedSource in interface bdv.viewer.Source<T extends net.imglib2.type.numeric.NumericType<T>>
      Overrides:
      getInterpolatedSource in class bdv.util.RandomAccessibleIntervalSource<T extends net.imglib2.type.numeric.NumericType<T>>
    • getVoxelDimensions

      public mpicbg.spim.data.sequence.VoxelDimensions getVoxelDimensions()
      Specified by:
      getVoxelDimensions in interface bdv.viewer.Source<T extends net.imglib2.type.numeric.NumericType<T>>
      Overrides:
      getVoxelDimensions in class bdv.util.AbstractSource<T extends net.imglib2.type.numeric.NumericType<T>>