From 9f9278adad3816fc5684203959a60e673d3fbc7f Mon Sep 17 00:00:00 2001 From: Eugene Katrukha Date: Mon, 30 Dec 2024 14:39:08 +0100 Subject: [PATCH] v.0.5.1 --- pom.xml | 2 +- src/main/java/bigtrace/BigTrace.java | 6 +-- src/main/java/bigtrace/BigTraceActions.java | 2 +- src/main/java/bigtrace/BigTraceData.java | 8 +-- src/main/java/bigtrace/io/ROIsExportSWC.java | 19 ++++++- src/main/java/bigtrace/io/ROIsLoadBG.java | 24 ++++++++- src/main/java/bigtrace/io/ROIsSaveBG.java | 5 ++ src/main/java/bigtrace/io/ViewsIO.java | 50 ++++++++++++++++++- .../bigtrace/rois/RoiManager3DDialogs.java | 20 +++----- 9 files changed, 110 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index d2bfc6e..cf3191c 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ nl.uu.science.cellbiology bigtrace - 0.5.1-SNAPSHOT + 0.5.1 BigTrace Tracing of curvilinear structures in 3D diff --git a/src/main/java/bigtrace/BigTrace.java b/src/main/java/bigtrace/BigTrace.java index a2b9787..98c2439 100644 --- a/src/main/java/bigtrace/BigTrace.java +++ b/src/main/java/bigtrace/BigTrace.java @@ -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; diff --git a/src/main/java/bigtrace/BigTraceActions.java b/src/main/java/bigtrace/BigTraceActions.java index faf2096..5b07f1f 100644 --- a/src/main/java/bigtrace/BigTraceActions.java +++ b/src/main/java/bigtrace/BigTraceActions.java @@ -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)); } diff --git a/src/main/java/bigtrace/BigTraceData.java b/src/main/java/bigtrace/BigTraceData.java index 4438477..60a01d9 100644 --- a/src/main/java/bigtrace/BigTraceData.java +++ b/src/main/java/bigtrace/BigTraceData.java @@ -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): @@ -303,9 +303,9 @@ public BigTraceData(final BigTrace 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 diff --git a/src/main/java/bigtrace/io/ROIsExportSWC.java b/src/main/java/bigtrace/io/ROIsExportSWC.java index 3bd12fc..d418e0c 100644 --- a/src/main/java/bigtrace/io/ROIsExportSWC.java +++ b/src/main/java/bigtrace/io/ROIsExportSWC.java @@ -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 & 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(); @@ -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 = ""; @@ -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 ); diff --git a/src/main/java/bigtrace/rois/RoiManager3DDialogs.java b/src/main/java/bigtrace/rois/RoiManager3DDialogs.java index 03d8ced..68968ab 100644 --- a/src/main/java/bigtrace/rois/RoiManager3DDialogs.java +++ b/src/main/java/bigtrace/rois/RoiManager3DDialogs.java @@ -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)); @@ -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 @@ -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);