Skip to content

Commit

Permalink
v.0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Sep 25, 2023
1 parent 8dcfcd1 commit f44dbd9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>sc.fiji</groupId>
<artifactId>bigtrace</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>

<name>BigTrace</name>
<description>Tracing of curvilinear structures in 3D</description>
Expand Down Expand Up @@ -119,6 +119,7 @@
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/bigtrace/BigTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import bdv.spimdata.XmlIoSpimDataMinimal;
import bdv.tools.InitializeViewerState;
import bdv.tools.transformation.TransformedSource;
import bdv.util.AxisOrder;
import bdv.util.Bounds;
import bdv.viewer.Source;
import bdv.viewer.SourceAndConverter;
Expand Down Expand Up @@ -1055,7 +1056,7 @@ public AnisotropicTransformAnimator3D getCenteredViewAnim(final Interval inInter
return anim;
}

public void showTraceBox(IntervalView<UnsignedByteType> weights)
public void showTraceBox()
{

// there is a trace box already, let's remove it
Expand All @@ -1076,7 +1077,8 @@ public void showTraceBox(IntervalView<UnsignedByteType> weights)
}

}
bvv_trace = BvvFunctions.show(weights, "weights", Bvv.options().addTo(bvv_main));

bvv_trace = BvvFunctions.show(btdata.trace_weights, "weights", Bvv.options().addTo(bvv_main));
bvv_trace.setCurrent();
bvv_trace.setRenderType(btdata.nRenderMethod);
bvv_trace.setDisplayRangeBounds(0, 255);
Expand All @@ -1100,8 +1102,7 @@ public void showTraceBox(IntervalView<UnsignedByteType> weights)
public void removeTraceBox()
{


if(bvv_trace!=null)
if(bvv_trace != null)
{
btdata.bcTraceBox.storeBC(bvv_trace);
bvv_trace.removeFromBdv();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/BigTraceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class BigTraceData < T extends RealType< T > > {

/** current plugin version **/
public static String sVersion = "0.3.0";
public static String sVersion = "0.3.1";

/** plugin instanse **/
BigTrace<T> bt;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/BigTraceRenderSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import ij.Prefs;


@Plugin(type = Command.class, menuPath = "Plugins>BigTrace 0.3.0>Render Settings")
@Plugin(type = Command.class, menuPath = "Plugins>BigTrace 0.3.1>Render Settings")
public class BigTraceRenderSettings implements Command {

@Parameter( label = "Render width" )
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/bigtrace/math/TraceBoxMath.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bigtrace.math;


import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

Expand Down Expand Up @@ -84,7 +85,7 @@ protected Void doInBackground() throws Exception {
nDerivOrder[d2]++;
kernels = DerivConvolutionKernels.convolve_derive_kernel(bt.btdata.sigmaTrace, nDerivOrder );
derivKernel = Kernel1D.centralAsymmetric(kernels);
convObj=SeparableKernelConvolution.convolution( derivKernel );
convObj = SeparableKernelConvolution.convolution( derivKernel );
convObj.setExecutor(es);
convObj.process(Views.extendBorder(input), hs2 );
//SeparableKernelConvolution.convolution( derivKernel ).process( input, hs2 );
Expand Down Expand Up @@ -112,11 +113,15 @@ protected Void doInBackground() throws Exception {

mEV.computeVWCRAI(hessian, directionVectors,salWeights, lineCorners,nThreads,es);
es.shutdown();

setProgress(100);
setProgressState("trace box done.");
bt.btdata.trace_weights=VolumeMisc.convertFloatToUnsignedByte(salWeights,false);

bt.btdata.trace_weights = VolumeMisc.convertFloatToUnsignedByte(salWeights,false);


//bt.btdata.jump_points =VolumeMisc.localMaxPointList(VolumeMisc.convertFloatToUnsignedByte(lineCorners,false), 50);
bt.btdata.jump_points =VolumeMisc.localMaxPointList(VolumeMisc.convertFloatToUnsignedByte(lineCorners,false), 10);
bt.btdata.jump_points = VolumeMisc.localMaxPointList(VolumeMisc.convertFloatToUnsignedByte(lineCorners,false), 10);
bt.btdata.trace_vectors = directionVectors;
//bt.showCorners(bt.btdata.jump_points);
return null;
Expand All @@ -127,7 +132,19 @@ protected Void doInBackground() throws Exception {
@Override
public void done()
{
bt.showTraceBox(bt.btdata.trace_weights);
//see if we have some errors
try {
get();
}
catch (ExecutionException e) {
e.getCause().printStackTrace();
String msg = String.format("Unexpected problem during Hessian calculations: %s",
e.getCause().toString());
System.out.println(msg);
} catch (InterruptedException e) {
// Process e here
}
bt.showTraceBox();

//unlock user interaction
bt.bInputLock = false;
Expand Down
21 changes: 16 additions & 5 deletions src/main/java/bigtrace/volume/VolumeMisc.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.imglib2.algorithm.neighborhood.RectangleShape;
import net.imglib2.algorithm.neighborhood.Shape;
import net.imglib2.algorithm.region.BresenhamLine;
import net.imglib2.converter.Converters;
import net.imglib2.converter.RealUnsignedByteConverter;
import net.imglib2.converter.RealUnsignedShortConverter;
import net.imglib2.converter.read.ConvertedRandomAccessibleInterval;
Expand Down Expand Up @@ -183,18 +184,21 @@ public static IntervalView< UnsignedByteType > localMax(final IntervalView< Unsi
return output;
}

public static IntervalView<UnsignedByteType> convertFloatToUnsignedByte(IntervalView<FloatType> input, boolean inverse)
public static IntervalView<UnsignedByteType> convertFloatToUnsignedByte(RandomAccessibleInterval<FloatType> input, boolean inverse)
{


float minVal = Float.MAX_VALUE;
float maxVal = -Float.MAX_VALUE;
for ( final FloatType h : input )
IntervalView<FloatType> inInt = Views.interval(input,input.minAsLongArray(),input.maxAsLongArray());
for ( final FloatType h : inInt )
{
final float dd = h.get();
minVal = Math.min( dd, minVal );
maxVal = Math.max( dd, maxVal );
}


//final RealUnsignedByteConverter<FloatType> cvU = new RealUnsignedByteConverter<FloatType>(minVal,maxVal);
final RealUnsignedByteConverter<FloatType> cvU;
if (inverse)
Expand All @@ -205,9 +209,16 @@ public static IntervalView<UnsignedByteType> convertFloatToUnsignedByte(Interval
{
cvU = new RealUnsignedByteConverter<FloatType>(minVal, maxVal);
}
final ConvertedRandomAccessibleInterval< FloatType, UnsignedByteType > inputScaled = new ConvertedRandomAccessibleInterval<>( input, ( s, t ) -> {
cvU.convert(s,t);



RandomAccessibleInterval<UnsignedByteType> inputScaled = Converters.convert(input, cvU, new UnsignedByteType());

/*
final ConvertedRandomAccessibleInterval< FloatType, UnsignedByteType > inputScaled = new ConvertedRandomAccessibleInterval<FloatType, UnsignedByteType>( input, ( s, t ) -> {
cvU.convert(s, t);
}, new UnsignedByteType() );
*/
return Views.interval(inputScaled,inputScaled.minAsLongArray(),inputScaled.maxAsLongArray());

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugins.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Plugins>BigTrace 0.3.0, "Open TIF/BDV(xml) volume", bigtrace.BigTrace
Plugins>BigTrace 0.3.1, "Open TIF/BDV(xml) volume", bigtrace.BigTrace

0 comments on commit f44dbd9

Please sign in to comment.