Skip to content

Commit

Permalink
v.0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Nov 20, 2023
1 parent 1c9b617 commit c127fe6
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 128 deletions.
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>33.2.0</version>
<version>36.0.0</version>
<relativePath />
</parent>

<groupId>sc.fiji</groupId>
<artifactId>bigtrace</artifactId>
<version>0.3.2</version>
<version>0.3.3-SNAPSHOT</version>

<name>BigTrace</name>
<description>Tracing of curvilinear structures in 3D</description>
Expand Down Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>fiji.experimental</groupId>
<artifactId>bvv-playground</artifactId>
<version>0.0.9</version>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
Expand All @@ -119,7 +119,6 @@
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
Expand Down
131 changes: 45 additions & 86 deletions src/main/java/bigtrace/BigTrace.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

package bigtrace;


import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.KeyboardFocusManager;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
Expand All @@ -27,41 +26,14 @@
import com.formdev.flatlaf.FlatIntelliJLaf;
import com.jogamp.opengl.GL3;

import bdv.spimdata.SequenceDescriptionMinimal;
import bdv.spimdata.SpimDataMinimal;
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;
import bdv.viewer.TimePointListener;
import bdv.viewer.ViewerState;
import bigtrace.geometry.Cuboid3D;
import bigtrace.geometry.Intersections3D;
import bigtrace.geometry.Line3D;
import bigtrace.gui.AnisotropicTransformAnimator3D;
import bigtrace.math.OneClickTrace;
import bigtrace.math.TraceBoxMath;
import bigtrace.math.TracingBGVect;
import bigtrace.rois.Box3D;
import bigtrace.rois.LineTrace3D;
import bigtrace.rois.Roi3D;
import bigtrace.rois.RoiManager3D;
import bigtrace.scene.VisPolyLineSimple;
import bigtrace.volume.VolumeMisc;

import btbvv.util.BvvStackSource;
import ij.CompositeImage;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.plugin.PlugIn;
import ij.process.LUT;

import mpicbg.spim.data.SpimDataException;
import btbvv.util.BvvFunctions;
import btbvv.util.Bvv;
import net.imglib2.AbstractInterval;
import net.imglib2.FinalInterval;
import net.imglib2.FinalRealInterval;
Expand All @@ -71,7 +43,6 @@

import net.imglib2.img.Img;

import net.imglib2.img.array.ArrayImgs;
import net.imglib2.img.display.imagej.ImageJFunctions;
import net.imglib2.realtransform.AffineTransform3D;

Expand All @@ -83,11 +54,39 @@
import net.imglib2.view.IntervalView;
import net.imglib2.view.Views;

import bvvbigtrace.example2.RenderData;
import bvvbigtrace.example2.VolumeRenderer.RepaintType;
import bvvbigtrace.example2.VolumeViewerPanel;
import bvvbigtrace.util.MatrixMath;
import bdv.spimdata.SequenceDescriptionMinimal;
import bdv.spimdata.SpimDataMinimal;
import bdv.spimdata.XmlIoSpimDataMinimal;
import bdv.tools.InitializeViewerState;
import bdv.tools.transformation.TransformedSource;
import bdv.util.Bounds;
import bdv.viewer.Source;
import bdv.viewer.SourceAndConverter;
import bdv.viewer.TimePointListener;
import bdv.viewer.ViewerState;

import btbvv.vistools.BvvFunctions;
import btbvv.vistools.Bvv;
import btbvv.vistools.BvvStackSource;
import btbvv.core.render.RenderData;
import btbvv.core.render.VolumeRenderer.RepaintType;
import btbvv.btuitools.BvvGamma;
import btbvv.core.VolumeViewerPanel;
import btbvv.core.util.MatrixMath;

import bigtrace.geometry.Cuboid3D;
import bigtrace.geometry.Intersections3D;
import bigtrace.geometry.Line3D;
import bigtrace.gui.AnisotropicTransformAnimator3D;
import bigtrace.math.OneClickTrace;
import bigtrace.math.TraceBoxMath;
import bigtrace.math.TracingBGVect;
import bigtrace.rois.Box3D;
import bigtrace.rois.LineTrace3D;
import bigtrace.rois.Roi3D;
import bigtrace.rois.RoiManager3D;
import bigtrace.scene.VisPolyLineSimple;
import bigtrace.volume.VolumeMisc;

public class BigTrace < T extends RealType< T > > implements PlugIn, WindowListener, TimePointListener
{
Expand Down Expand Up @@ -207,7 +206,6 @@ public void run(String arg)
} catch( Exception ex ) {
System.err.println( "Failed to initialize LaF" );
}

//not sure we really need it, but anyway
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
Expand Down Expand Up @@ -772,10 +770,12 @@ public void actionToggleRender()
if(btdata.nRenderMethod==0)
{
btpanel.renderMethodPanel.cbRenderMethod.setSelectedIndex(1);
panel.showMessage("volumetric");
}
else
{
btpanel.renderMethodPanel.cbRenderMethod.setSelectedIndex(0);
panel.showMessage("maximum intensity");
}
}
public void installActions(final Actions actions)
Expand All @@ -791,7 +791,7 @@ public void installActions(final Actions actions)
actions.runnableAction(() -> actionZoomToPoint(), "zoom in to click", "D" );
actions.runnableAction(() -> actionZoomOut(), "center view (zoom out)", "C" );
actions.runnableAction(() -> actionResetCrop(), "reset crop", "X" );
actions.runnableAction(() -> actionToggleRender(), "toggle render mode", "P" );
actions.runnableAction(() -> actionToggleRender(), "toggle render mode", "O" );
actions.runnableAction(() -> actionSelectRoi(), "select ROI", "E" );


Expand Down Expand Up @@ -1247,43 +1247,7 @@ public void initBVVSourcesImageJ()
Path p = Paths.get(btdata.sFileNameFullImg);
String filename = p.getFileName().toString();

/// "dummy" interval to init BVV
RandomAccessibleInterval< UnsignedByteType > empty_view;
// init bigvolumeviewer
final Img< UnsignedByteType > imgx = ArrayImgs.unsignedBytes( new long[]{ 2, 2, 2 } );
empty_view =
Views.interval( imgx, new long[] { 0, 0, 0 }, new long[]{ 1, 1, 1 } );
/*
bvv_main = BvvFunctions.show( all_ch_RAI, "empty" ,Bvv.options().
dCam(btdata.dCam).
dClipNear(btdata.dClipNear).
dClipFar(btdata.dClipFar).
renderWidth( BigTraceData.renderParams.nRenderW).
renderHeight( BigTraceData.renderParams.nRenderH).
numDitherSamples( BigTraceData.renderParams.numDitherSamples ).
cacheBlockSize( BigTraceData.renderParams.cacheBlockSize ).
maxCacheSizeInMB( BigTraceData.renderParams.maxCacheSizeInMB ).
ditherWidth(BigTraceData.renderParams.ditherWidth).
frameTitle(filename)
);*/
/*
bvv_main = BvvFunctions.show( all_ch_RAI, "empty" ,Bvv.options().
dCam(btdata.dCam).
dClipNear(btdata.dClipNear).
dClipFar(btdata.dClipFar).
renderWidth( BigTraceData.renderParams.nRenderW).
renderHeight( BigTraceData.renderParams.nRenderH).
numDitherSamples( BigTraceData.renderParams.numDitherSamples ).
cacheBlockSize( BigTraceData.renderParams.cacheBlockSize ).
maxCacheSizeInMB( BigTraceData.renderParams.maxCacheSizeInMB ).
ditherWidth(BigTraceData.renderParams.ditherWidth).
frameTitle(filename)
);
*/
//imgx
bvv_main = BvvFunctions.show( imgx, "empty" ,Bvv.options().
//bvv_main = BvvFunctions.show( empty_view, "empty" ,Bvv.options().
Bvv Tempbvv = BvvFunctions.show( Bvv.options().
dCam(btdata.dCam).
dClipNear(btdata.dClipNear).
dClipFar(btdata.dClipFar).
Expand All @@ -1299,10 +1263,8 @@ public void initBVVSourcesImageJ()

for(int i=0;i<sources.size();i++)
{
//bvv_main.getSources()

//bvv_sources.add(BvvFunctions.show( sources.get(i), "ch_"+Integer.toString(i+1), Bvv.options().addTo(bvv_main)));
bvv_sources.add(BvvFunctions.show( Views.hyperSlice(all_ch_RAI,4,i), "ch_"+Integer.toString(i+1), Bvv.options().addTo(bvv_main)));

bvv_sources.add(BvvFunctions.show( Views.hyperSlice(all_ch_RAI,4,i), "ch_"+Integer.toString(i+1), Bvv.options().addTo(Tempbvv)));
if(nBitDepth<=8)
{
bvv_sources.get(i).setDisplayRangeBounds(0, 255);
Expand All @@ -1319,9 +1281,9 @@ public void initBVVSourcesImageJ()
bvv_sources.get(i).setRenderType(btdata.nRenderMethod);

}
bvv_main.removeFromBdv();

bvv_main = bvv_sources.get(0);
//

panel = bvv_main.getBvvHandle().getViewerPanel();
}

Expand Down Expand Up @@ -1369,14 +1331,11 @@ public void initBVVSourcesHDF5()
}
(( TransformedSource< ? > ) source.getSpimSource() ).setIncrementalTransform(transform);
}

BigTraceData.dMinVoxelSize = Math.min(Math.min(BigTraceData.globCal[0], BigTraceData.globCal[1]), BigTraceData.globCal[2]);
double [] minmaxBrightness = initBrightnessBVV( 0.001, 0.999, panel.state() );

BvvGamma.initBrightness( 0.001, 0.999, panel.state(), panel.getConverterSetups());

for(int i=0;i<bvv_sources.size();i++)
{
bvv_sources.get(i).setDisplayRange(minmaxBrightness[0], minmaxBrightness[1]);
bvv_sources.get(i).setAlphaRange(minmaxBrightness[0], minmaxBrightness[1]);
}
}

public void setInitialTransform()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/BigTraceControlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import bigtrace.measure.RoiMeasure3D;
import bigtrace.rois.RoiManager3D;
import bigtrace.BigTraceData;
import btbvv.util.BvvStackSource;
import btbvv.vistools.BvvStackSource;
import ij.Prefs;
import net.imglib2.FinalRealInterval;
import net.imglib2.realtransform.AffineTransform3D;
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.2";
public static String sVersion = "0.3.3";

/** 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.2>Render Settings")
@Plugin(type = Command.class, menuPath = "Plugins>BigTrace 0.3.3>Render Settings")
public class BigTraceRenderSettings implements Command {

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

import btbvv.tools.RealARGBColorGammaConverterSetup;
import btbvv.util.BvvStackSource;
import btbvv.btuitools.RealARGBColorGammaConverterSetup;
import btbvv.vistools.BvvStackSource;

/** class to store and apply broghtness and contrast settings **/
public class BCsettings {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/bigtrace/math/OneClickTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.imglib2.img.array.ArrayImgs;
import net.imglib2.img.basictypeaccess.array.FloatArray;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.util.Intervals;
import net.imglib2.util.LinAlgHelpers;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/bigtrace/rois/Box3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import bigtrace.scene.VisPointsScaled;
import bigtrace.scene.VisPolyLineSimple;
import net.imglib2.AbstractInterval;
import net.imglib2.FinalInterval;
import net.imglib2.Interval;
import net.imglib2.RealPoint;

Expand Down
28 changes: 19 additions & 9 deletions src/main/java/bigtrace/rois/RoiManager3D.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package bigtrace.rois;



import java.awt.Color;

import java.awt.Dimension;
Expand Down Expand Up @@ -42,22 +40,25 @@
import com.jogamp.opengl.GL3;

import bdv.tools.brightness.ColorIcon;

import ij.Prefs;
import ij.io.OpenDialog;
import ij.io.SaveDialog;
import net.imglib2.RealPoint;

import bigtrace.BigTrace;
import bigtrace.BigTraceData;
import bigtrace.geometry.Line3D;
import bigtrace.gui.GuiMisc;
import bigtrace.gui.NumberField;
import bigtrace.gui.PanelTitle;
import bigtrace.measure.RoiMeasure3D;
import ij.Prefs;
import ij.io.OpenDialog;
import ij.io.SaveDialog;
import net.imglib2.RealPoint;


public class RoiManager3D extends JPanel implements ListSelectionListener, ActionListener {


@SuppressWarnings("rawtypes")
BigTrace bt;

private static final long serialVersionUID = -2843907862066423151L;
Expand All @@ -81,7 +82,8 @@ public class RoiManager3D extends JPanel implements ListSelectionListener, Actio
public boolean bShowAll = true;

//MEASURE OBJECT
public RoiMeasure3D roiMeasure = null;
@SuppressWarnings("rawtypes")
public RoiMeasure3D roiMeasure = null;

//GUI
public DefaultListModel<String> listModel;
Expand Down Expand Up @@ -558,8 +560,13 @@ public void draw(final GL3 gl, final Matrix4fc pvm, final int[] screen_size)
int nShift;
float fOpacityScale = 1.0f;
float fOpacitySave = 1.0f;
final int nMinF = (int)Math.min(0,BigTraceData.timeFade);
final int nMaxF = (int)Math.max(0,BigTraceData.timeFade);
int nMinF = (int)Math.min(0,BigTraceData.timeFade);
int nMaxF = (int)Math.max(0,BigTraceData.timeFade);
if(BigTraceData.timeRender==0)
{
nMinF = 0;
nMaxF = 0;
}

for (i=0;i<rois.size();i++)
{
Expand Down Expand Up @@ -843,6 +850,7 @@ private void fireActiveRoiChanged(int nRoi)
l.activeRoiChanged(nRoi);
}

@SuppressWarnings("unchecked")
@Override
public void valueChanged(ListSelectionEvent e)
{
Expand Down Expand Up @@ -876,6 +884,7 @@ public void valueChanged(ListSelectionEvent e)
}

//buttons
@SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent e)
{
Expand Down Expand Up @@ -1622,6 +1631,7 @@ public void dialProperties()
}

/** Save ROIS dialog and saving **/
@SuppressWarnings("unchecked")
public void diagSaveROIs()
{
String filename;
Expand Down
Loading

0 comments on commit c127fe6

Please sign in to comment.