Skip to content

Commit

Permalink
v.0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Dec 30, 2024
1 parent 785f0a4 commit 9f9278a
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>nl.uu.science.cellbiology</groupId>
<artifactId>bigtrace</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.1</version>

<name>BigTrace</name>
<description>Tracing of curvilinear structures in 3D</description>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/bigtrace/BigTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,17 @@ public void calcShowTraceBox(final LineTrace3D trace, final boolean bRefine)

if(trace.numVertices() == 1)
{
rangeTraceBox = VolumeMisc.getTraceBoxCentered(traceIV,btData.lTraceBoxSize, trace.vertices.get(0));
rangeTraceBox = VolumeMisc.getTraceBoxCentered(traceIV,btData.nTraceBoxSize, trace.vertices.get(0));
}
else
{
rangeTraceBox = getTraceBoxNext(traceIV,btData.lTraceBoxSize, btData.fTraceBoxAdvanceFraction, trace);
rangeTraceBox = getTraceBoxNext(traceIV,btData.nTraceBoxSize, btData.fTraceBoxAdvanceFraction, trace);
}

IntervalView<?> traceInterval = Views.interval(traceIV, rangeTraceBox);

//getCenteredView(traceInterval);
viewer.setTransformAnimator(getCenteredViewAnim(traceInterval,btData.dTraceBoxScreenFraction));
viewer.setTransformAnimator(getCenteredViewAnim(traceInterval,btData.fTraceBoxScreenFraction));
//long start1, end1;


Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/BigTraceActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public void actionZoomIn()
{
if(bt.findPointLocationFromClick(bt.btData.trace_weights,target))
{
FinalInterval zoomInterval = VolumeMisc.getZoomBoxCentered((long)(bt.btData.lTraceBoxSize*0.5), target);
FinalInterval zoomInterval = VolumeMisc.getZoomBoxCentered((long)(bt.btData.nTraceBoxSize*0.5), target);

bt.viewer.setTransformAnimator(bt.getCenteredViewAnim(zoomInterval,bt.btData.dZoomBoxScreenFraction));
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/bigtrace/BigTraceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ public class BigTraceData < T extends RealType< T > & NativeType< T > > {
public int nTraceBoxView = 1;

/** half size of tracing box (for now in all dimensions) **/
public long lTraceBoxSize;
public int nTraceBoxSize;

/** fraction of screen occupied by trace box **/
public double dTraceBoxScreenFraction;
public float fTraceBoxScreenFraction;

/** After advancing tracebox, this parameter defines
* how much tracebox is going to follow the last direction of trace (with respect to the last added point):
Expand Down Expand Up @@ -303,9 +303,9 @@ public BigTraceData(final BigTrace<T> bt_)
sigmaTrace[2] = Prefs.get("BigTrace.sigmaTraceZ", 3.0);
bTraceOnlyClipped = Prefs.get("BigTrace.bTraceOnlyClipped", false);

lTraceBoxSize =(long) Prefs.get("BigTrace.lTraceBoxSize", 50);
nTraceBoxSize = (int) Prefs.get("BigTrace.nTraceBoxSize", 50);
fTraceBoxAdvanceFraction = (float) Prefs.get("BigTrace.fTraceBoxAdvanceFraction", 0.9);
dTraceBoxScreenFraction = Prefs.get("BigTrace.dTraceBoxScreenFraction", 0.5);
fTraceBoxScreenFraction = (float)Prefs.get("BigTrace.fTraceBoxScreenFraction", 0.5);
gammaTrace = Prefs.get("BigTrace.gammaTrace", 0.0);

//one-click
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/bigtrace/io/ROIsExportSWC.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ protected Void doInBackground() throws Exception {
String sRadius;
writer.write("#raw "+ bt.btData.sFileNameFullImg+"\n");
writer.write("#original_source BigTrace_ver_" +BigTraceData.sVersion+"\n");
writer.write( "#roi_shape_interpolation " );
switch (BigTraceData.shapeInterpolation)
{
case BigTraceData.SHAPE_Voxel:
writer.write("voxel\n");
break;
case BigTraceData.SHAPE_Smooth:
writer.write("smooth\n");
break;
case BigTraceData.SHAPE_Spline:
writer.write("spline\n");
break;
}
writer.write( "#smooth_window "+Integer.toString( BigTraceData.nSmoothWindow )+"\n" );

for(nRoi=0; nRoi<nRoiN; nRoi++)
{

Expand Down Expand Up @@ -96,7 +111,7 @@ protected Void doInBackground() throws Exception {
writer.close();
}
setProgress(100);
setProgressState("exporting curve ROIs done.");
setProgressState("SWC export curve ROIs done.");
} catch (IOException e) {
IJ.log(e.getMessage());
//e.printStackTrace();
Expand All @@ -113,7 +128,7 @@ public void done()
bt.bInputLock = false;
bt.setLockMode(false);
setProgress(100);
setProgressState("export traces to SWC done.");
setProgressState("SWC export curve ROI done.");
}


Expand Down
24 changes: 23 additions & 1 deletion src/main/java/bigtrace/io/ROIsLoadBG.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import bigtrace.rois.Roi3D;
import bigtrace.rois.Roi3DGroup;
import bigtrace.rois.Roi3DGroupManager;
import ij.Prefs;

import net.imglib2.RealPoint;
import net.imglib2.type.NativeType;
Expand Down Expand Up @@ -161,7 +162,28 @@ protected Void doInBackground() throws Exception {
break;
case "FrameInterval":
bt.btData.dFrameInterval = Double.parseDouble(line_array[1]);
break;
break;
case "Intensity Interpolation":
BigTraceData.intensityInterpolation = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.IntInterpolation",BigTraceData.intensityInterpolation);
bt.btData.setInterpolationFactory();
break;
case "ROI Shape Interpolation":
BigTraceData.shapeInterpolation = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.ShapeInterpolation",BigTraceData.shapeInterpolation);
break;
case "Rotation min frame type":
BigTraceData.rotationMinFrame = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.RotationMinFrame",BigTraceData.rotationMinFrame);
break;
case "Smooth window":
BigTraceData.nSmoothWindow = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.nSmoothWindow", BigTraceData.nSmoothWindow);
break;
case "Sector number":
BigTraceData.sectorN = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.nSectorN", BigTraceData.sectorN);
break;
case "BT_Roi":
//Sleep for up to one second.
try {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/bigtrace/io/ROIsSaveBG.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ protected Void doInBackground() throws Exception {
writer.write("ImageVoxelDepth," + df3.format(BigTraceData.globCal[2]) + "\n");
writer.write("TimeUnits," + bt.btData.sTimeUnit + "\n");
writer.write("FrameInterval," + df3.format(bt.btData.dFrameInterval) + "\n");
writer.write("Intensity Interpolation,"+Integer.toString( BigTraceData.intensityInterpolation )+"\n");
writer.write("ROI Shape Interpolation,"+Integer.toString( BigTraceData.shapeInterpolation )+"\n");
writer.write("Rotation min frame type,"+Integer.toString( BigTraceData.rotationMinFrame )+"\n");
writer.write("Smooth window,"+Integer.toString( BigTraceData.nSmoothWindow )+"\n");

nRoiN = bt.roiManager.rois.size();
writer.write("ROIsNumber," + Integer.toString(nRoiN)+"\n");
for(nRoi=0;nRoi<nRoiN;nRoi++)
Expand Down
50 changes: 49 additions & 1 deletion src/main/java/bigtrace/io/ViewsIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,19 @@ public static < T extends RealType< T > & NativeType< T > > void saveView(final
writer.write("wireAntiAliasing,"+Integer.toString( BigTraceData.wireAntiAliasing ? 1 : 0)+"\n");
writer.write("timeRender,"+Integer.toString( BigTraceData.timeRender )+"\n");
writer.write("timeFade,"+Integer.toString( BigTraceData.timeFade )+"\n");

//tracing parameters
writer.write("nTraceBoxSize,"+Integer.toString( bt.btData.nTraceBoxSize )+"\n");
writer.write("fTraceBoxScreenFraction,"+df3.format(bt.btData.fTraceBoxScreenFraction)+"\n");
writer.write("fTraceBoxAdvanceFraction,"+df3.format(bt.btData.fTraceBoxAdvanceFraction)+"\n");
writer.write("nVertexPlacementPointN,"+Integer.toString( bt.btData.nVertexPlacementPointN )+"\n");
writer.write("dDirectionalityOneClick,"+df3.format(bt.btData.dDirectionalityOneClick)+"\n");
writer.write("bOCIntensityStop,"+Integer.toString(bt.btData.bOCIntensityStop ? 1 : 0)+"\n");
writer.write("dOCIntensityThreshold,"+df3.format(bt.btData.dOCIntensityThreshold)+"\n");
for (int d=0;d<3;d++)
{
writer.write("Trace sigma,"+Integer.toString( d )+ ","+ df3.format(bt.btData.sigmaTrace[d])+"\n");
}

writer.write("Scene, current\n");
bt.getCurrentScene().save( writer );
int nSourcesN = bt.bvv_sources.size();
Expand Down Expand Up @@ -145,6 +157,8 @@ public static < T extends RealType< T > & NativeType< T > > void loadView(final
bt.bInputLock = true;
bt.setLockMode(true);
int nSourcesN = bt.bvv_sources.size();

String [] sigmaTraceName = new String [] {"sigmaTraceX", "sigmaTraceY", "sigmaTraceZ"};
try ( BufferedReader br = new BufferedReader(new FileReader(sFilename));)
{
String line = "";
Expand Down Expand Up @@ -265,6 +279,40 @@ public static < T extends RealType< T > & NativeType< T > > void loadView(final
BigTraceData.timeFade = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.timeFade", BigTraceData.timeFade);
break;
case "nTraceBoxSize":
bt.btData.nTraceBoxSize = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.nTraceBoxSize", bt.btData.nTraceBoxSize);
break;
case "fTraceBoxScreenFraction":
bt.btData.fTraceBoxScreenFraction = Float.parseFloat( line_array[1] );
Prefs.set("BigTrace.fTraceBoxScreenFraction", bt.btData.fTraceBoxScreenFraction);
break;
case "fTraceBoxAdvanceFraction":
bt.btData.fTraceBoxAdvanceFraction = Float.parseFloat( line_array[1] );
Prefs.set("BigTrace.fTraceBoxAdvanceFraction", bt.btData.fTraceBoxAdvanceFraction);
break;
case "nVertexPlacementPointN":
bt.btData.nVertexPlacementPointN = Integer.parseInt( line_array[1] );
Prefs.set("BigTrace.nVertexPlacementPointN", bt.btData.nVertexPlacementPointN);
break;
case "dDirectionalityOneClick":
bt.btData.dDirectionalityOneClick = Double.parseDouble( line_array[1] );
Prefs.set("BigTrace.dDirectionalityOneClick", bt.btData.dDirectionalityOneClick);
break;
case "bOCIntensityStop":
bt.btData.bOCIntensityStop = line_array[1].equals( "1" )? true : false;
Prefs.set("BigTrace.bOCIntensityStop", bt.btData.bOCIntensityStop);
break;
case "dOCIntensityThreshold":
bt.btData.dOCIntensityThreshold = Double.parseDouble( line_array[1] );
Prefs.set("BigTrace.dOCIntensityThreshold", bt.btData.dOCIntensityThreshold);
break;
case "Trace sigma":
int dA = Integer.parseInt( line_array[1]);
bt.btData.sigmaTrace[dA] = Double.parseDouble( line_array[2] ) ;
Prefs.set("BigTrace."+sigmaTraceName[dA], bt.btData.sigmaTrace[dA]);
break;

case "Scene":
final Scene scLoad = new Scene();
scLoad.load( br );
Expand Down
20 changes: 7 additions & 13 deletions src/main/java/bigtrace/rois/RoiManager3DDialogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public void dialSemiAutoProperties()
NumberField nfTraceBoxScreenFraction = new NumberField(4);
NumberField nfTBAdvance = new NumberField(4);

nfTraceBoxSize.setText(Integer.toString((int)(2.0*bt.btData.lTraceBoxSize)));
nfTraceBoxScreenFraction.setText(df.format(bt.btData.dTraceBoxScreenFraction));
nfTraceBoxSize.setText(Integer.toString((int)(2.0*bt.btData.nTraceBoxSize)));
nfTraceBoxScreenFraction.setText(df.format(bt.btData.fTraceBoxScreenFraction));
nfGammaTrace.setText(df.format(bt.btData.gammaTrace));
nfTBAdvance.setText(df.format(bt.btData.fTraceBoxAdvanceFraction));

Expand Down Expand Up @@ -145,12 +145,9 @@ public void dialSemiAutoProperties()

if (reply == JOptionPane.OK_OPTION)
{

bt.btData.lTraceBoxSize=(long)(Integer.parseInt(nfTraceBoxSize.getText())*0.5);
Prefs.set("BigTrace.lTraceBoxSize", bt.btData.lTraceBoxSize);

bt.btData.lTraceBoxSize=(long)(Integer.parseInt(nfTraceBoxSize.getText())*0.5);
Prefs.set("BigTrace.lTraceBoxSize", bt.btData.lTraceBoxSize);

bt.btData.nTraceBoxSize = (int)(Integer.parseInt(nfTraceBoxSize.getText())*0.5);
Prefs.set("BigTrace.lTraceBoxSize", bt.btData.nTraceBoxSize);

//TRACING OPTIONS

Expand All @@ -166,11 +163,8 @@ public void dialSemiAutoProperties()
bt.btData.bTraceOnlyClipped = cbTraceOnlyClipped.isSelected();
Prefs.set("BigTrace.bTraceOnlyClipped", bt.btData.bTraceOnlyClipped);

bt.btData.lTraceBoxSize=(long)(Integer.parseInt(nfTraceBoxSize.getText())*0.5);
Prefs.set("BigTrace.lTraceBoxSize", bt.btData.lTraceBoxSize);

bt.btData.dTraceBoxScreenFraction = Double.parseDouble(nfTraceBoxScreenFraction.getText());
Prefs.set("BigTrace.dTraceBoxScreenFraction", bt.btData.dTraceBoxScreenFraction);
bt.btData.fTraceBoxScreenFraction = Float.parseFloat(nfTraceBoxScreenFraction.getText());
Prefs.set("BigTrace.dTraceBoxScreenFraction", bt.btData.fTraceBoxScreenFraction);

bt.btData.fTraceBoxAdvanceFraction = Float.parseFloat(nfTBAdvance.getText());
Prefs.set("BigTrace.fTraceBoxAdvanceFraction", bt.btData.fTraceBoxAdvanceFraction);
Expand Down

0 comments on commit 9f9278a

Please sign in to comment.