Skip to content

Commit

Permalink
pom back, group color LUT, crosssection shader
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Oct 18, 2024
1 parent d5c552f commit 238ac62
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>39.0.0</version>
<version>38.0.1</version>
<relativePath />
</parent>

Expand Down
50 changes: 50 additions & 0 deletions src/main/java/bigtrace/rois/Roi3DGroupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.IndexColorModel;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -35,9 +36,12 @@
import bdv.tools.brightness.ColorIcon;
import bigtrace.BigTraceData;
import bigtrace.gui.NumberField;
import ij.IJ;
import ij.Prefs;
import ij.io.OpenDialog;
import ij.io.SaveDialog;
import ij.plugin.LutLoader;

import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;

Expand All @@ -58,6 +62,7 @@ public class Roi3DGroupManager < T extends RealType< T > & NativeType< T > > imp
JButton butCopyNew;
JButton butDelete;
JButton butMerge;
JButton butColor;
JButton butSave;
JButton butLoad;

Expand Down Expand Up @@ -100,6 +105,8 @@ public void initGUI()
butDelete.addActionListener(this);
butMerge = new JButton("Merge");
butMerge.addActionListener(this);
butColor = new JButton("Color");
butColor.addActionListener(this);
butSave = new JButton("Save");
butSave.addActionListener(this);
butLoad = new JButton("Load");
Expand All @@ -126,6 +133,8 @@ public void initGUI()
cr.gridy++;
presetList.add(butMerge,cr);
cr.gridy++;
presetList.add(butColor,cr);
cr.gridy++;
presetList.add(butSave,cr);
cr.gridy++;
presetList.add(butLoad,cr);
Expand Down Expand Up @@ -211,6 +220,42 @@ void dialogMerge(int indList)
}
}
}

/** show Group Properties dialog**/
void dialogColor(int indList)
{
String [] luts = IJ.getLuts();
JComboBox<String> cbLUTs = new JComboBox<>(luts);
int reply = JOptionPane.showConfirmDialog(null, cbLUTs, "Color ROIs in group using LUT",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (reply == JOptionPane.OK_OPTION)
{

String sLUTName = ( String ) cbLUTs.getSelectedItem();
ArrayList<Roi3D> groupROI = new ArrayList<>();

for (int i=0;i<roiManager.rois.size();i++)
{
if(roiManager.rois.get(i).getGroupInd() == indList)
{
groupROI.add(roiManager.rois.get(i));
}
}
final int nTotRois = groupROI.size();
IndexColorModel icm = LutLoader.getLut(sLUTName);
final int nMapSize = icm.getMapSize();
if (nTotRois>0)
{
for (int i=0;i<nTotRois;i++)
{
int nIndex = Math.round( i*(nMapSize-1)/(nTotRois-1) );
Color newColor = new Color(icm.getRed( nIndex ),icm.getGreen( nIndex ),icm.getBlue( nIndex ),255);
groupROI.get( i ).setLineColor( newColor );
}
}
roiManager.bt.repaintBVV();
}
}

/** show Group Properties dialog**/
public boolean dialogPropertiesShow(final Roi3DGroup preset, boolean bNameChangable)
Expand Down Expand Up @@ -712,6 +757,11 @@ public void actionPerformed(ActionEvent ae)
{
dialogMerge(indList);
}
//Color
if(ae.getSource() == butColor)
{
dialogColor(indList);
}
//SAVE
if(ae.getSource() == butSave)
{
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/bigtrace/scene/VisPolygonFlat.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,22 @@ public void draw( GL3 gl, Matrix4fc pvm )
Vector4f l_color_t = new Vector4f(l_color);
l_color_t.w = 0.6f;
prog.getUniform4f("colorin").set(l_color_t);
prog.getUniform1i("surfaceRender").set(3);
}
else
{

prog.getUniform4f("colorin").set(l_color);
}
if(renderType != Roi3D.SURFACE)
{
prog.getUniform1i("surfaceRender").set(0);
}
else
{
prog.getUniform1i("surfaceRender").set(BigTraceData.surfaceRender);
}
// if(renderType != Roi3D.SURFACE)
// {
// prog.getUniform1i("surfaceRender").set(0);
// }
// else
// {
// prog.getUniform1i("surfaceRender").set(BigTraceData.surfaceRender);
// }
prog.setUniforms( context );
prog.use( context );

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/scene/simple_color_depth.fp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main()
}
}
//"silhouette" surface
if(surfaceRender==1)
if(surfaceRender==3)
{
gl_FragDepth = 1.0;
}
Expand Down

0 comments on commit 238ac62

Please sign in to comment.