Skip to content

Commit d318bb6

Browse files
committed
v.0.4.1
1 parent 33dafa2 commit d318bb6

File tree

12 files changed

+182
-47
lines changed

12 files changed

+182
-47
lines changed

pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>nl.uu.science.cellbiology</groupId>
1313
<artifactId>bigtrace</artifactId>
14-
<version>0.4.0</version>
14+
<version>0.4.1</version>
1515

1616
<name>BigTrace</name>
1717
<description>Tracing of curvilinear structures in 3D</description>
@@ -106,6 +106,11 @@
106106
<groupId>net.imagej</groupId>
107107
<artifactId>imagej-mesh</artifactId>
108108
</dependency>
109+
<!-- dependency>
110+
<groupId>com.github.imglib</groupId>
111+
<artifactId>imglib2-mesh</artifactId>
112+
<version>e7d4e89</version>
113+
</dependency -->
109114

110115
<dependency>
111116
<groupId>com.formdev</groupId>

src/main/java/bigtrace/BigTrace.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,20 @@ public class BigTrace < T extends RealType< T > & NativeType< T > > implements P
139139
/** ROI manager + list tab **/
140140
public RoiManager3D<T> roiManager;
141141

142-
/** BigTrace interface panel **/
142+
/** BigTrace macro interface**/
143143
BigTraceMacro<T> btMacro;
144144

145145
/**macro extensions **/
146146
private ExtensionDescriptor[] extensions = {
147147

148148
ExtensionDescriptor.newDescriptor("btLoadROIs", this, ARG_STRING, ARG_STRING),
149149
ExtensionDescriptor.newDescriptor("btStraighten", this, ARG_NUMBER, ARG_STRING),
150+
ExtensionDescriptor.newDescriptor("btShapeInterpolation", this, ARG_STRING,ARG_NUMBER),
151+
ExtensionDescriptor.newDescriptor("btIntensityInterpolation", this, ARG_STRING),
150152
ExtensionDescriptor.newDescriptor("btTest", this),
151153
ExtensionDescriptor.newDescriptor("btClose", this),
152154
ExtensionDescriptor.newDescriptor("btTest", this),
153155

154-
//ExtensionDescriptor.newDescriptor("testBigTrace", this, ARG_OUTPUT+ARG_NUMBER),
155-
//ExtensionDescriptor.newDescriptor("getFrame", this, ARG_OUTPUT+ARG_NUMBER),
156-
//ExtensionDescriptor.newDescriptor("setChannel", this, ARG_NUMBER ),
157-
//ExtensionDescriptor.newDescriptor("setFrame", this, ARG_NUMBER ),
158-
//ExtensionDescriptor.newDescriptor("getDisplayMode", this),
159-
//ExtensionDescriptor.newDescriptor("setDisplayMode", this, ARG_STRING),
160156
};
161157

162158
@Override
@@ -1548,6 +1544,14 @@ public String handleExtension(String name, Object[] args) {
15481544
{
15491545
btMacro.macroStraighten((int)Math.round(((Double)args[0]).doubleValue()),(String)args[1]);
15501546
}
1547+
if (name.equals("btShapeInterpolation"))
1548+
{
1549+
btMacro.macroShapeInterpolation( (String)args[0],(int)Math.round(((Double)args[1]).doubleValue()));
1550+
}
1551+
if (name.equals("btIntensityInterpolation"))
1552+
{
1553+
btMacro.macroIntensityInterpolation( (String)args[0]);
1554+
}
15511555
if (name.equals("btClose"))
15521556
{
15531557
btMacro.macroCloseBT();
@@ -1571,7 +1575,22 @@ public static void main(String... args) throws Exception
15711575
new ImageJ();
15721576
BigTrace testI = new BigTrace();
15731577

1578+
15741579
testI.run("");
1580+
///macros test
1581+
// testI.run("/home/eugene/Desktop/projects/BigTrace/BigTrace_data/ExM_MT_8bit.tif");
1582+
// testI.btMacro.macroLoadROIs( "/home/eugene/Desktop/projects/BigTrace/macro/ExM_MT_8bit.tif_btrois.csv","Clean" );
1583+
// IJ.log( "shapeInt1" );
1584+
// testI.btMacro.macroShapeInterpolation("Voxel", 10);
1585+
// testI.btMacro.macroIntensityInterpolation("Neighbor");
1586+
// IJ.log( "straight1" );
1587+
// testI.btMacro.macroStraighten(1, "/home/eugene/Desktop/test1/");
1588+
// IJ.log( "shapeInt2" );
1589+
// testI.btMacro.macroShapeInterpolation("Spline", 10);
1590+
// testI.btMacro.macroIntensityInterpolation("Linear");
1591+
// IJ.log( "straight2" );
1592+
// testI.btMacro.macroStraighten(1, "/home/eugene/Desktop/test2/");
1593+
15751594
//testI.run("/home/eugene/Desktop/projects/BigTrace/BigTrace_data/ExM_MT.tif");
15761595
//testI.run("/home/eugene/Desktop/projects/BigTrace/BT_tracks/Snejana_small_example.tif");
15771596

src/main/java/bigtrace/BigTraceData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
public class BigTraceData < T extends RealType< T > & NativeType< T > > {
3030

3131
/** current plugin version **/
32-
public static String sVersion = "0.4.0";
32+
public static String sVersion = "0.4.1";
3333

3434
/** plugin instance **/
3535
BigTrace<T> bt;

src/main/java/bigtrace/BigTraceMacro.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ void macroLoadROIs(String sFileName, String input) throws InterruptedException
2727
{
2828
Thread.sleep(1000);
2929
}
30+
31+
//it should be later unlocked by bt.roiManager.loadROIs
32+
bt.bInputLock = true;
33+
3034
if(input == null)
3135
return;
3236
int nLoadMode = 0;
@@ -44,6 +48,7 @@ void macroLoadROIs(String sFileName, String input) throws InterruptedException
4448
}
4549
bt.roiManager.loadROIs( sFileName, nLoadMode );
4650
IJ.log( "BigTrace ROIs loaded from " + sFileName);
51+
4752
}
4853

4954
void macroStraighten(final int nStraightenAxis, String sSaveDir) throws InterruptedException
@@ -52,6 +57,11 @@ void macroStraighten(final int nStraightenAxis, String sSaveDir) throws Interrup
5257
{
5358
Thread.sleep(100);
5459
}
60+
61+
//it should be later unlocked by StraightenCurve,
62+
//if we call it
63+
bt.bInputLock = true;
64+
5565
//build list of ROIs
5666
final ArrayList<AbstractCurve3D> curvesOut = new ArrayList<>();
5767

@@ -83,8 +93,71 @@ void macroStraighten(final int nStraightenAxis, String sSaveDir) throws Interrup
8393
{
8494
IJ.log("Cannot find proper curve ROIs to straighten.");
8595
bt.btPanel.progressBar.setString("curve straightening aborted.");
96+
bt.bInputLock = false;
8697
}
98+
8799
}
100+
101+
void macroShapeInterpolation(String sShapeInterpol, int nSmoothWindow) throws InterruptedException
102+
{
103+
while(bt.bInputLock)
104+
{
105+
Thread.sleep(100);
106+
}
107+
bt.bInputLock = true;
108+
switch (sShapeInterpol)
109+
{
110+
case "Voxel":
111+
BigTraceData.shapeInterpolation = BigTraceData.SHAPE_Voxel;
112+
IJ.log("BigTrace ROI Shape Interpolation set to Voxel.");
113+
break;
114+
case "Smooth":
115+
BigTraceData.shapeInterpolation = BigTraceData.SHAPE_Smooth;
116+
IJ.log("BigTrace ROI Shape Interpolation set to Smooth.");
117+
break;
118+
case "Spline":
119+
BigTraceData.shapeInterpolation = BigTraceData.SHAPE_Spline;
120+
IJ.log("BigTrace ROI Shape Interpolation set to Spline.");
121+
break;
122+
default:
123+
IJ.log( "Error! ROI Shape Interpolation values should be either Voxel, Smooth or Spline." );
124+
return;
125+
}
126+
BigTraceData.nSmoothWindow = Math.max( 1, Math.abs( Math.round( nSmoothWindow ) ));
127+
IJ.log("BigTrace ROI smoothing window set to "+Integer.toString( BigTraceData.nSmoothWindow )+".");
128+
bt.roiManager.updateROIsDisplay();
129+
bt.bInputLock = false;
130+
}
131+
132+
void macroIntensityInterpolation(String sInterpol) throws InterruptedException
133+
{
134+
while(bt.bInputLock)
135+
{
136+
Thread.sleep(100);
137+
}
138+
bt.bInputLock = true;
139+
switch (sInterpol)
140+
{
141+
case "Neighbor":
142+
BigTraceData.intensityInterpolation = BigTraceData.INT_NearestNeighbor;
143+
IJ.log("BigTrace Intensity Interpolation set to Nearest Neighbor.");
144+
break;
145+
case "Linear":
146+
BigTraceData.intensityInterpolation = BigTraceData.INT_NLinear;
147+
IJ.log("BigTrace Intensity Interpolation set to Linear.");
148+
break;
149+
case "Lanczos":
150+
BigTraceData.intensityInterpolation = BigTraceData.INT_Lanczos;
151+
IJ.log("BigTrace Intensity Interpolation set to Lanczos.");
152+
break;
153+
default:
154+
IJ.log( "Error! Intensity interpolation values should be either Nearest, Linear or Lanczos." );
155+
return;
156+
}
157+
bt.btData.setInterpolationFactory();
158+
bt.bInputLock = false;
159+
}
160+
88161

89162
void macroCloseBT() throws InterruptedException
90163
{

src/main/java/bigtrace/BigTraceRenderSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import ij.Prefs;
99

1010

11-
@Plugin(type = Command.class, menuPath = "Plugins>BigTrace 0.4.0>Render Settings")
11+
@Plugin(type = Command.class, menuPath = "Plugins>BigTrace 0.4.1>Render Settings")
1212
public class BigTraceRenderSettings implements Command {
1313

1414

src/main/java/bigtrace/geometry/CurveShapeInterpolation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,14 @@ public ArrayList<RealPoint> getVerticesResample()
389389
int i;
390390
if(currInterpolation == BigTraceData.SHAPE_Smooth || currInterpolation == BigTraceData.SHAPE_Voxel)
391391
{
392+
if(linInter == null)
393+
return null;
392394
dLength = linInter.getMaxLength();
393395
}
394396
else
395397
{
398+
if(splineInter == null)
399+
return null;
396400
dLength = splineInter.getMaxArcLength();
397401
}
398402
nNewPoints =(int) Math.ceil(dLength/ BigTraceData.dMinVoxelSize);

src/main/java/bigtrace/measure/RoiMeasure3D.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ public void dialSettings()
398398
{
399399
BigTraceData.nSmoothWindow = Integer.parseInt(nfSmoothWindow.getText());
400400
Prefs.set("BigTrace.nSmoothWindow", BigTraceData.nSmoothWindow);
401-
BigTraceData.shapeInterpolation= shapeInterpolationList.getSelectedIndex();
401+
BigTraceData.shapeInterpolation = shapeInterpolationList.getSelectedIndex();
402402
Prefs.set("BigTrace.ShapeInterpolation",BigTraceData.shapeInterpolation);
403-
BigTraceData.rotationMinFrame= rotationFrameList.getSelectedIndex();
403+
BigTraceData.rotationMinFrame = rotationFrameList.getSelectedIndex();
404404
Prefs.set("BigTrace.RotationMinFrame",BigTraceData.rotationMinFrame);
405405
bt.roiManager.updateROIsDisplay();
406406
}

src/main/java/bigtrace/rois/ROIsLoadBG.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import bigtrace.BigTrace;
1414
import bigtrace.BigTraceBGWorker;
1515
import bigtrace.BigTraceData;
16+
import ij.IJ;
17+
1618
import net.imglib2.RealPoint;
1719
import net.imglib2.type.NativeType;
1820
import net.imglib2.type.numeric.RealType;

src/main/java/bigtrace/rois/RoiManager3D.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import com.jogamp.opengl.GL3;
4040

4141
import bdv.tools.brightness.ColorIcon;
42-
42+
import ij.IJ;
4343
import ij.Prefs;
4444
import ij.io.OpenDialog;
4545
import ij.io.SaveDialog;
@@ -1519,7 +1519,6 @@ void updateROIsGroupDisplay(int nGroupN)
15191519
/** updates all ROIs images**/
15201520
public void updateROIsDisplay()
15211521
{
1522-
15231522
for (Roi3D roi : rois)
15241523
{
15251524
roi.updateRenderVertices();

src/main/java/bigtrace/scene/VisPolyLineMesh.java

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import btbvv.core.shadergen.Shader;
2727
import btbvv.core.shadergen.generate.Segment;
2828
import btbvv.core.shadergen.generate.SegmentTemplate;
29-
import net.imagej.mesh.nio.BufferMesh;
3029
import net.imglib2.RealPoint;
30+
import net.imagej.mesh.nio.BufferMesh;
3131

3232
public class VisPolyLineMesh {
3333

@@ -144,7 +144,7 @@ public synchronized void setVertices( final ArrayList< RealPoint > points_, fina
144144
//(renderType == Roi3D.SURFACE)
145145
{
146146

147-
initMesh(point_contours);
147+
initMesh(point_contours);//, points_);
148148
}
149149
}
150150

@@ -300,7 +300,11 @@ private void initLineShader( final GL3 gl )
300300
gl.glBindVertexArray( 0 );
301301
}
302302
}
303-
private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours )
303+
304+
/** initializing the mesh **/
305+
306+
//private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours, ArrayList< RealPoint > centerline )
307+
private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours)
304308
{
305309

306310
int i,j, iPoint;
@@ -309,6 +313,7 @@ private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours )
309313
final int nSectorN = BigTraceData.sectorN;
310314
nPointsN = allContours.size();
311315
float [][] triangle = new float[3][3];
316+
//int nMeshTrianglesN = (nPointsN-1)*nSectorN*2+nSectorN*2;
312317
int nMeshTrianglesN = (nPointsN-1)*nSectorN*2;
313318
if(nPointsN>1)
314319
{
@@ -321,13 +326,13 @@ private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours )
321326
{
322327
//add to drawing vertices triangles
323328
//nmesh.triangles().addf(v0x, v0y, v0z, v1x, v1y, v1z, v2x, v2y, v2z)
324-
for (i=0;i<nSectorN-1; i++)
329+
for (i=0;i<nSectorN; i++)
325330
{
326331
for (j=0;j<3; j++)
327332
{
328333

329334
triangle[0][j] = allContours.get(iPoint-1).get(i).getFloatPosition(j);
330-
triangle[1][j] = allContours.get(iPoint-1).get(i+1).getFloatPosition(j);
335+
triangle[1][j] = allContours.get(iPoint-1).get((i+1)%nSectorN).getFloatPosition(j);
331336
triangle[2][j] = allContours.get(iPoint).get(i).getFloatPosition(j);
332337

333338
}
@@ -337,34 +342,45 @@ private void initMesh(final ArrayList<ArrayList< RealPoint >> allContours )
337342
{
338343

339344
triangle[0][j] = allContours.get(iPoint).get(i).getFloatPosition(j);
340-
triangle[1][j] = allContours.get(iPoint-1).get(i+1).getFloatPosition(j);
341-
triangle[2][j] = allContours.get(iPoint).get(i+1).getFloatPosition(j);
345+
triangle[1][j] = allContours.get(iPoint-1).get((i+1)%nSectorN).getFloatPosition(j);
346+
triangle[2][j] = allContours.get(iPoint).get((i+1)%nSectorN).getFloatPosition(j);
342347

343348
}
344349
addTriangle(mesh, triangle);
345350
}
346-
i=nSectorN-1;
347-
//last one closing the sector
348-
for (j=0;j<3; j++)
349-
{
350-
351-
triangle[0][j] = allContours.get(iPoint-1).get(i).getFloatPosition(j);
352-
triangle[1][j] = allContours.get(iPoint-1).get(0).getFloatPosition(j);
353-
triangle[2][j] = allContours.get(iPoint).get(i).getFloatPosition(j);
354-
355-
}
356-
addTriangle(mesh, triangle);
357-
for (j=0;j<3; j++)
358-
{
359-
360-
triangle[0][j] = allContours.get(iPoint).get(i).getFloatPosition(j);
361-
triangle[1][j] = allContours.get(iPoint-1).get(0).getFloatPosition(j);
362-
triangle[2][j] = allContours.get(iPoint).get(0).getFloatPosition(j);
363-
364-
}
365-
addTriangle(mesh, triangle);
366351

367352
}
353+
354+
// //"lids" of the mesh, beginning
355+
// for (i=0;i<nSectorN; i++)
356+
// {
357+
// for (j=0;j<3; j++)
358+
// {
359+
//
360+
// triangle[0][j] = allContours.get(0).get((i+1)%nSectorN).getFloatPosition(j);
361+
// triangle[1][j] = allContours.get(0).get(i).getFloatPosition(j);
362+
// triangle[2][j] = centerline.get(0).getFloatPosition(j);
363+
//
364+
// }
365+
//
366+
// addTriangle(mesh, triangle);
367+
// }
368+
//
369+
// //"lids" of the mesh, end
370+
// for (i=0;i<nSectorN; i++)
371+
// {
372+
// for (j=0;j<3; j++)
373+
// {
374+
//
375+
// triangle[0][j] = allContours.get(nPointsN-1).get(i).getFloatPosition(j);
376+
// triangle[1][j] = allContours.get(nPointsN-1).get((i+1)%nSectorN).getFloatPosition(j);
377+
// triangle[2][j] = centerline.get(nPointsN-1).getFloatPosition(j);
378+
//
379+
// }
380+
//
381+
// addTriangle(mesh, triangle);
382+
// }
383+
368384
nMeshTrianglesSize = mesh.triangles().size();
369385
}
370386
}

0 commit comments

Comments
 (0)