Skip to content

Commit

Permalink
update methods to imglib v7
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Jan 28, 2025
1 parent 9c0f1b3 commit 55f2060
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/main/java/bigtrace/animation/UnCoilAnimation.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public IntervalView<T> generateSingleVolumeSetup(int nInd, int nChannel)

RandomAccessibleInterval<T> all_RAI = bt.btData.getAllDataRAI();

Img<T> outImg = Util.getSuitableImgFactory(roiIntervBox, Util.getTypeFromInterval(all_RAI) ).create(roiIntervBox);
Img<T> outImg = Util.getSuitableImgFactory(roiIntervBox, all_RAI.getType() ).create(roiIntervBox);

IntervalView<T> outInterval = Views.translate( outImg, roiIntervBox.minAsLongArray() );

Expand Down Expand Up @@ -614,7 +614,7 @@ public boolean loadTemplate(String sTemplateTIF)
final ImagePlus imp = IJ.openImage( sTemplateTIF );

int nBitD = imp.getBitDepth();
T ff = Util.getTypeFromInterval( bt.btData.getAllDataRAI() );
T ff = bt.btData.getAllDataRAI().getType();

if(ff instanceof UnsignedByteType)
{
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/bigtrace/io/UnCoilFrameImgLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.integer.UnsignedShortType;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.util.Util;
import net.imglib2.view.Views;

import bigtrace.BigTrace;
Expand Down Expand Up @@ -44,11 +43,11 @@ public RandomAccessibleInterval< UnsignedShortType > getImage( int timepointId,
{
final RandomAccessibleInterval< ? > raiXYZ
= Views.zeroMin(unCoil.generateSingleVolumeSetup( timepointId, setupId ));
if ( Util.getTypeFromInterval( raiXYZ ) instanceof UnsignedShortType )
if ( raiXYZ.getType() instanceof UnsignedShortType )
{
return (RandomAccessibleInterval <UnsignedShortType >) raiXYZ;
}
else if ( Util.getTypeFromInterval( raiXYZ ) instanceof UnsignedByteType )
else if ( raiXYZ.getType() instanceof UnsignedByteType )
{
return Converters.convert(
raiXYZ,
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/bigtrace/math/EigenValVecSymmDecomposition.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ private void computeVWRAIthreaded( final RandomAccessibleInterval< T > RAIin,
}
public void computeVWRAI( final RandomAccessibleInterval< T > RAIin, final RandomAccessibleInterval< T > eVector, final RandomAccessibleInterval< T > eWeight)
{
final Cursor< RealComposite< T > > m = Views.iterable( Views.collapseReal( RAIin ) ).cursor();
final Cursor< RealComposite< T > > eV = Views.iterable( Views.collapseReal( eVector ) ).cursor();
final Cursor< T > eW = Views.iterable( eWeight ).cursor();
final Cursor< RealComposite< T > > m = Views.collapseReal( RAIin ).cursor();
final Cursor< RealComposite< T > > eV = Views.collapseReal( eVector ).cursor();
final Cursor< T > eW = eWeight.cursor();

while ( m.hasNext() )
{
Expand Down Expand Up @@ -179,10 +179,10 @@ public void computeVWRAI( final RandomAccessibleInterval< T > tensor,

public void computeVWCRAI( final RandomAccessibleInterval< T > RAIin, final RandomAccessibleInterval< T > eVector, final RandomAccessibleInterval< T > eWeight,final RandomAccessibleInterval< T > eCorners)
{
final Cursor< RealComposite< T > > m = Views.iterable( Views.collapseReal( RAIin ) ).cursor();
final Cursor< RealComposite< T > > eV = Views.iterable( Views.collapseReal( eVector ) ).cursor();
final Cursor< T > eW = Views.iterable( eWeight ).cursor();
final Cursor< T > eC = Views.iterable( eCorners ).cursor();
final Cursor< RealComposite< T > > m = Views.collapseReal( RAIin ).cursor();
final Cursor< RealComposite< T > > eV = Views.collapseReal( eVector ).cursor();
final Cursor< T > eW = eWeight.cursor();
final Cursor< T > eC = eCorners.cursor();

while ( m.hasNext() )
{
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/bigtrace/measure/RoiMeasure3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ void measureEndsDirection(final Roi3D roi, final MeasureValues val)

public static double getMeanDoubleArray(final double [] values)
{
final RealSum realSum = new RealSum(values.length);
final RealSum realSum = new RealSum();

for(int i=0;i<values.length;i++)
{
Expand All @@ -1102,7 +1102,7 @@ public static double getMeanDoubleArray(final double [] values)

public static double getSDDoubleArray(final double mean, final double [] values)
{
final RealSum realSum = new RealSum(values.length);
final RealSum realSum = new RealSum();
for(int i=0;i<values.length;i++)
{
realSum.add((values[i]-mean)*(values[i]-mean));
Expand All @@ -1116,7 +1116,7 @@ public static double getSDDoubleArray(final double mean, final double [] values)

public static double getSumDoubleArray(final double [] values)
{
final RealSum realSum = new RealSum(values.length);
final RealSum realSum = new RealSum();

for(int i=0;i<values.length;i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/volume/ExtractROIBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ IntervalView<T> extractBoxRoiVolumeShape(final Roi3D roiIn, final RandomAccessib

IntervalView<T> bboxMeasure = Views.interval(Views.extendZero(all_RAI),finBoxInt);

Img<T> out1 = Util.getSuitableImgFactory(bboxMeasure, Util.getTypeFromInterval(bboxMeasure)).create(bboxMeasure);
Img<T> out1 = Util.getSuitableImgFactory(bboxMeasure, bboxMeasure.getType()).create(bboxMeasure);

IntervalView< T > trans = Views.translate( out1, bboxMeasure.minAsLongArray() );

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/bigtrace/volume/SplitVolumePlane.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ protected Void doInBackground() throws Exception {
//(for now)
//make two copies

Img<T> out1 = Util.getSuitableImgFactory(all_RAI, Util.getTypeFromInterval(all_RAI)).create(all_RAI);
Img<T> out1 = Util.getSuitableImgFactory(all_RAI, all_RAI.getType()).create(all_RAI);
LoopBuilder.setImages(out1,all_RAI).forEachPixel(Type::set);

Img<T> out2 = Util.getSuitableImgFactory(all_RAI, Util.getTypeFromInterval(all_RAI)).create(all_RAI);
Img<T> out2 = Util.getSuitableImgFactory(all_RAI, all_RAI.getType()).create(all_RAI);
LoopBuilder.setImages(out2, all_RAI).forEachPixel(Type::set);

final long [] nTotPixArr = all_RAI.dimensionsAsLongArray();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/volume/StraightenCurve.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ IntervalView<T> extractCurveRAI(final AbstractCurve3D curveROI, final RandomAcce
nChannelN = dimS[4];

//this is where we store straightened volume
Img<T> out1 = Util.getSuitableImgFactory(all_RAI, Util.getTypeFromInterval(all_RAI)).create(new FinalInterval(dimS));
Img<T> out1 = Util.getSuitableImgFactory(all_RAI, all_RAI.getType()).create(new FinalInterval(dimS));


//get a frame around line
Expand Down

0 comments on commit 55f2060

Please sign in to comment.