Skip to content

Commit

Permalink
new RangeSlider
Browse files Browse the repository at this point in the history
changed loading of icons
  • Loading branch information
ekatrukha committed Jan 28, 2025
1 parent 6c6046f commit 9c0f1b3
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 93 deletions.
15 changes: 2 additions & 13 deletions 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.2</version>
<version>0.5.3-SNAPSHOT</version>

<name>BigTrace</name>
<description>Tracing of curvilinear structures in 3D</description>
Expand Down Expand Up @@ -87,7 +87,7 @@
<dependency>
<groupId>nl.uu.science.cellbiology</groupId>
<artifactId>bvv-playground</artifactId>
<version>0.3.4</version>
<version>0.3.5-SNAPSHOT</version>
</dependency>

<!-- BIOFORMATS -->
Expand Down Expand Up @@ -117,17 +117,6 @@
<artifactId>flatlaf</artifactId>
</dependency>

<dependency>
<groupId>com.formdev</groupId>
<artifactId>jide-oss</artifactId>
<version>3.7.15</version>
</dependency>

<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf-jide-oss</artifactId>
<version>3.0</version>
</dependency>
<!-- SCIFIO dependencies -->
<dependency>
<groupId>io.scif</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/bigtrace/BigTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
import bvvpg.vistools.BvvStackSource;
import bvvpg.core.render.RenderData;
import bvvpg.core.render.VolumeRenderer.RepaintType;
import bvvpg.pguitools.BvvGamma;
import bvvpg.pguitools.GammaConverterSetup;
import bvvpg.vistools.BvvGamma;
import bvvpg.source.converters.GammaConverterSetup;
import bvvpg.core.VolumeViewerFrame;
import bvvpg.core.VolumeViewerPanel;
import bvvpg.core.util.MatrixMath;
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/bigtrace/BigTraceControlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import bigtrace.gui.GBCHelper;
import bigtrace.gui.NumberField;
import bigtrace.gui.PanelTitle;
import bigtrace.gui.RangeSliderTF;
import bigtrace.gui.RangeSliderPanel;
import bigtrace.gui.RenderMethodPanel;
import bigtrace.gui.VoxelSizePanel;
import bigtrace.io.ViewsIO;
Expand Down Expand Up @@ -114,36 +114,36 @@ public BigTraceControlPanel(final BigTrace<T> bt_,final BigTraceData<T> btd_, fi

JTabbedPane tabPane = new JTabbedPane(SwingConstants.LEFT);

URL icon_path = bigtrace.BigTrace.class.getResource("/icons/cube_icon.png");
URL icon_path = this.getClass().getResource("/icons/cube_icon.png");
ImageIcon tabIcon = new ImageIcon(icon_path);

tabPane.addTab("",tabIcon,panelView(), "View/Clip");

//ROI MANAGER
icon_path = bigtrace.BigTrace.class.getResource("/icons/node.png");
icon_path = this.getClass().getResource("/icons/node.png");
tabIcon = new ImageIcon(icon_path);
tabPane.addTab("",tabIcon ,roiManager,"Tracing");

//MEASUREMENTS
icon_path = bigtrace.BigTrace.class.getResource("/icons/measure.png");
icon_path = this.getClass().getResource("/icons/measure.png");
tabIcon = new ImageIcon(icon_path);
tabPane.addTab("",tabIcon ,roiMeasure,"Measure");

//TRACKS
if(BigTraceData.nNumTimepoints>1)
{
icon_path = bigtrace.BigTrace.class.getResource("/icons/tracks.png");
icon_path = this.getClass().getResource("/icons/tracks.png");
tabIcon = new ImageIcon(icon_path);
tabPane.addTab("",tabIcon ,btTracksPanel,"Tracking");
}

//ANIMATION
icon_path = bigtrace.BigTrace.class.getResource("/icons/director.png");
icon_path = this.getClass().getResource("/icons/director.png");
tabIcon = new ImageIcon(icon_path);
tabPane.addTab("",tabIcon ,btAniPanel,"Movie animation");

//HELP/SHORTCUTS
icon_path = bigtrace.BigTrace.class.getResource("/icons/shortcut.png");
icon_path = this.getClass().getResource("/icons/shortcut.png");
tabIcon = new ImageIcon(icon_path);
tabPane.addTab("",tabIcon ,panelInformation(),"Help/Shortcuts");

Expand Down Expand Up @@ -267,7 +267,7 @@ public void itemStateChanged(ItemEvent e) {
//VIEW PANEL
JPanel panView = new JPanel(new GridBagLayout());
panView.setBorder(new PanelTitle(" View "));
URL icon_path = bigtrace.BigTrace.class.getResource("/icons/orig.png");
URL icon_path = this.getClass().getResource("/icons/orig.png");
ImageIcon tabIcon = new ImageIcon(icon_path);
JToggleButton butOrigin = new JToggleButton(tabIcon);
butOrigin.setSelected(btdata.bShowOrigin);
Expand All @@ -290,7 +290,7 @@ public void itemStateChanged(ItemEvent e) {
panView.add(butOrigin,c);

//BOX AROUND VOLUME
icon_path = bigtrace.BigTrace.class.getResource("/icons/boxvolume.png");
icon_path = this.getClass().getResource("/icons/boxvolume.png");
tabIcon = new ImageIcon(icon_path);
JToggleButton butVBox = new JToggleButton(tabIcon);
butVBox.setSelected(btdata.bVolumeBox);
Expand All @@ -313,15 +313,15 @@ public void itemStateChanged(ItemEvent e) {
panView.add(butVBox,c);

//SAVE AND LOAD BUTTONS
icon_path = bigtrace.BigTrace.class.getResource("/icons/save.png");
icon_path = this.getClass().getResource("/icons/save.png");
tabIcon = new ImageIcon(icon_path);
butSaveView = new JButton(tabIcon);
butSaveView.setToolTipText( "Save image view" );
butSaveView.addActionListener(this);
c.gridx++;
panView.add(butSaveView,c);

icon_path = bigtrace.BigTrace.class.getResource("/icons/load.png");
icon_path = this.getClass().getResource("/icons/load.png");
tabIcon = new ImageIcon(icon_path);
butLoadView = new JButton(tabIcon);
butLoadView.setToolTipText( "Load image view" );
Expand All @@ -331,7 +331,7 @@ public void itemStateChanged(ItemEvent e) {
panView.add(butLoadView,c);

//SETTINGS
icon_path = bigtrace.BigTrace.class.getResource("/icons/settings.png");
icon_path = this.getClass().getResource("/icons/settings.png");
tabIcon = new ImageIcon(icon_path);
butSettings = new JButton(tabIcon);
butSettings.setToolTipText("Settings");
Expand Down Expand Up @@ -652,7 +652,7 @@ public void extractClippedView()
int [] nRange = new int [2];
nRange[0] = 0;
nRange[1] = BigTraceData.nNumTimepoints-1;
RangeSliderTF timeRange = new RangeSliderTF(nRange, nRange);
RangeSliderPanel timeRange = new RangeSliderPanel(nRange, nRange);
if(BigTraceData.nNumTimepoints>1)
{
clipExtractSettings.add(new JLabel("Extract:"),cd);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/bigtrace/animation/AnimationPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ public AnimationPanel(final BigTrace<T> bt)
GridBagConstraints cr = new GridBagConstraints();


URL icon_path = bigtrace.BigTrace.class.getResource("/icons/render.png");
URL icon_path = this.getClass().getResource("/icons/render.png");
tabIconRecord = new ImageIcon(icon_path);
butRecord = new JButton(tabIconRecord);
butRecord.setToolTipText("Render");
butRecord.setPreferredSize(new Dimension(nButtonSize , nButtonSize ));

icon_path = bigtrace.BigTrace.class.getResource("/icons/play.png");
icon_path = this.getClass().getResource("/icons/play.png");
tabIconPlay = new ImageIcon(icon_path);
butPlayStop = new JButton(tabIconPlay);

icon_path = bigtrace.BigTrace.class.getResource("/icons/cancel.png");
icon_path = this.getClass().getResource("/icons/cancel.png");
tabIconStop = new ImageIcon(icon_path);
butPlayStop.setToolTipText("Play");
butPlayStop.setPreferredSize(new Dimension(nButtonSize , nButtonSize ));
Expand All @@ -173,13 +173,13 @@ public void mouseClicked(MouseEvent evt) {
}
});

icon_path = bigtrace.BigTrace.class.getResource("/icons/uncoil.png");
icon_path = this.getClass().getResource("/icons/uncoil.png");
ImageIcon tabIcon = new ImageIcon(icon_path);
butUncoil = new JButton(tabIcon);
butUncoil.setToolTipText("Straighten animation");
butUncoil.setPreferredSize(new Dimension(nButtonSize , nButtonSize ));

icon_path = bigtrace.BigTrace.class.getResource("/icons/settings.png");
icon_path = this.getClass().getResource("/icons/settings.png");
tabIcon = new ImageIcon(icon_path);
butSettings = new JButton(tabIcon);
butSettings.setToolTipText("Settings");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bigtrace/gui/BCsettings.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bigtrace.gui;

import bvvpg.pguitools.RealARGBColorGammaConverterSetup;
import bvvpg.source.converters.RealARGBColorGammaConverterSetup;
import bvvpg.vistools.BvvStackSource;

/** class to store and apply broghtness and contrast settings **/
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/bigtrace/gui/ClipPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void main(String[] args) {
*
*/
private static final long serialVersionUID = 1885320351623882576L;
private RangeSliderTF [] bbAxes = new RangeSliderTF[3];
private RangeSliderPanel [] bbAxes = new RangeSliderPanel[3];
private ArrayList<Listener> listeners = new ArrayList<>();

public JButton butExtractClipped;
Expand All @@ -50,8 +50,8 @@ public static interface Listener {

}

private RangeSliderTF addRangeSlider(String label, int[] realMinMax, int[] setMinMax, GridBagConstraints c) {
RangeSliderTF slider = new RangeSliderTF(realMinMax, setMinMax);
private RangeSliderPanel addRangeSlider(String label, int[] realMinMax, int[] setMinMax, GridBagConstraints c) {
RangeSliderPanel slider = new RangeSliderPanel(realMinMax, setMinMax);

GridBagLayout layout = (GridBagLayout)getLayout();

Expand Down Expand Up @@ -114,7 +114,7 @@ public ClipPanel(long [] maxDim) {
this.add(butExtractClipped,cd);


RangeSliderTF.Listener bbListener = new RangeSliderTF.Listener() {
RangeSliderPanel.Listener bbListener = new RangeSliderPanel.Listener() {
@Override
public void sliderChanged() {
long [][] new_box = new long [2][3];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import bvvpg.ui.sliders.RangeSliderPG;

import com.jidesoft.swing.RangeSlider;



public class RangeSliderTF extends JPanel implements FocusListener, NumberField.Listener, ChangeListener{
public class RangeSliderPanel extends JPanel implements FocusListener, NumberField.Listener, ChangeListener{

public static void main(String[] args) {

JFrame frame = new JFrame();
RangeSliderTF slider = new RangeSliderTF(new int[] {-100, 100}, new int[] {20, 50});
frame.getContentPane().add(slider);
RangeSliderPanel rsPanel = new RangeSliderPanel(new int[] {-100, 100}, new int[] {20, 50});
frame.getContentPane().add(rsPanel);
frame.pack();
frame.setVisible(true);
}
Expand All @@ -41,7 +40,7 @@ public static interface Listener {
public void sliderChanged();
}

private RangeSlider slider;
private RangeSliderPG slider;
private NumberField minTF = new NumberField(4);
private NumberField maxTF = new NumberField(4);

Expand All @@ -52,7 +51,7 @@ public static interface Listener {

private ArrayList<Listener> listeners = new ArrayList<>();

public RangeSliderTF(int[] realMinMax, int[] setMinMax) {
public RangeSliderPanel(int[] realMinMax, int[] setMinMax) {
super();

minTF.setIntegersOnly(true);
Expand All @@ -61,7 +60,7 @@ public RangeSliderTF(int[] realMinMax, int[] setMinMax) {
maxTF.setIntegersOnly(true);
maxTF.addListener(this);
maxTF.addNumberFieldFocusListener(this);
slider = new RangeSlider(realMinMax[0], realMinMax[1], setMinMax[0], setMinMax[1]);
slider = new RangeSliderPG(realMinMax[0], realMinMax[1], setMinMax[0], setMinMax[1]);
nLowerMax = realMinMax[0];
nHigherMin = realMinMax[1];
slider.addChangeListener(this);
Expand Down Expand Up @@ -107,18 +106,18 @@ public NumberField getMaxField() {
}

public int getMin() {
return slider.getLowValue();
return slider.getLowerValue();
}

public int getMax() {
return slider.getHighValue();
return slider.getUpperValue();
}

public void setMinAndMax(int min, int max) {
slider.setLowValue(min);
slider.setLowerValue(min);
minTF.setText(Integer.toString(min));

slider.setHighValue(max);
slider.setUpperValue(max);
maxTF.setText(Integer.toString(max));

slider.repaint();
Expand All @@ -133,16 +132,14 @@ public void makeConstrained(int nLowerMax_, int nHigherMin_)

@Override
public void valueChanged(double v) {


// TODO Auto-generated method stub

try {
//slider.getMaximum();
int nMinV = Math.min(Integer.parseInt(minTF.getText()),slider.getMaximum());
int nMaxV = Integer.parseInt(maxTF.getText());

slider.setLowValue(nMinV);
slider.setHighValue(nMaxV);
slider.setLowerValue(nMinV);
slider.setUpperValue(nMaxV);
slider.repaint();
fireSliderChanged();

Expand All @@ -155,24 +152,24 @@ public void valueChanged(double v) {

@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
JTextField tf = (JTextField)e.getSource();
tf.selectAll();
}

@Override
public void focusLost(FocusEvent arg0) {
// TODO Auto-generated method stub
valueChanged(0);
}

private void updateTextfieldsFromSliders() {
minTF.setText(Integer.toString(slider.getLowValue()));
maxTF.setText(Integer.toString(slider.getHighValue()));
minTF.setText(Integer.toString(slider.getLowerValue()));
maxTF.setText(Integer.toString(slider.getUpperValue()));
fireSliderChanged();
}

public void set(final int[] realMinMax, final int[] setMinMax) {
slider.setLowValue(realMinMax[0]);
slider.setLowValue(realMinMax[1]);
slider.setLowerValue(realMinMax[0]);
slider.setUpperValue(realMinMax[1]);
slider.setMinimum(setMinMax[0]);
slider.setMaximum(setMinMax[1]);
}
Expand All @@ -194,13 +191,13 @@ public void stateChanged(ChangeEvent e) {

if(bConstrained)
{
if(slider.getLowValue()>nLowerMax)
if(slider.getLowerValue()>nLowerMax)
{
slider.setLowValue( nLowerMax );
slider.setLowerValue( nLowerMax );
}
if(slider.getHighValue()<nHigherMin)
if(slider.getUpperValue()<nHigherMin)
{
slider.setHighValue( nHigherMin );
slider.setUpperValue( nHigherMin );
}
}
updateTextfieldsFromSliders();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/bigtrace/io/ViewsIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import bigtrace.BigTrace;
import bigtrace.BigTraceData;
import bigtrace.animation.Scene;
import bvvpg.pguitools.ConverterSetupBoundsAlpha;
import bvvpg.pguitools.ConverterSetupBoundsGamma;
import bvvpg.pguitools.ConverterSetupBoundsGammaAlpha;
import bvvpg.pguitools.ConverterSetupsPG;
import bvvpg.pguitools.RealARGBColorGammaConverterSetup;
import bvvpg.source.converters.ConverterSetupBoundsAlpha;
import bvvpg.source.converters.ConverterSetupBoundsGamma;
import bvvpg.source.converters.ConverterSetupBoundsGammaAlpha;
import bvvpg.source.converters.ConverterSetupsPG;
import bvvpg.source.converters.RealARGBColorGammaConverterSetup;
import bvvpg.vistools.BvvStackSource;
import ij.IJ;
import ij.Prefs;
Expand Down
Loading

0 comments on commit 9c0f1b3

Please sign in to comment.