Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5841fd7
To fix the clicking accuracy issues, the old version(2022) of MIPAV for
dchen116 Apr 23, 2024
3636593
To fix the clicking accuracy issues, the old version(2022) of MIPAV for
dchen116 Apr 23, 2024
d75f20f
Switched the mis-named variables.
dchen116 Apr 23, 2024
e816823
Switch between 2 modes(Accurate vs 3-color mode)
dchen116 May 1, 2024
caf1a7d
An accurateModeButton added for switch modes between accurate clicking
dchen116 May 13, 2024
6709dd2
An accurateModeButton added for switch the mode between accurate mode vs
dchen116 May 13, 2024
b5fc4a2
An keyBoard "M" added for switch the mode between accurate mode vs 3
dchen116 May 13, 2024
c014917
An AccurateModeListener interface was made for responding to the
dchen116 May 13, 2024
18d9831
Changed the tabbedPan name into "Selection"
dchen116 May 13, 2024
39c46e3
Restore VolumeImage.java
mkitti May 13, 2024
9c6ec52
Added updateSelectionPanel to fix the issue of clicking accurateMode
dchen116 May 14, 2024
830f328
Merge branch 'janelia/janelia_work' into FeatureClickingIssue
dchen116 May 15, 2024
fd0980b
Added block comments
dchen116 May 15, 2024
ffc8804
Created a plot corresponding to each clicking reflects the maximum
dchen116 May 22, 2024
2d62e12
Add a valueMarker for highlight the maximum value in the plot
dchen116 May 22, 2024
ede406b
Added the ValueMarker with mouseDragged function
dchen116 May 23, 2024
92b79ef
removed the EXIT_ON_CLOSE line
dchen116 May 24, 2024
bf35175
updated removed all the EXIT_ON_CLOSE
dchen116 May 24, 2024
c69c82a
post code review, removed unused variables, comments, and added a dialog
dchen116 May 28, 2024
3df941b
Added chartPanel and features to move the marker along with the mouse
dchen116 May 31, 2024
96a934d
added function to be able to move the marker in the plot to move the 3D
dchen116 Jun 3, 2024
79286d2
Fixed the first 3D marker so that it would move along with mouseDrag
dchen116 Jun 4, 2024
5fb7f7a
ValueOutput class is deleted due to no longer needed
dchen116 Jun 4, 2024
7fde24f
comment added to explain adding updateSelected for fix the first 3D
dchen116 Jun 4, 2024
00996d7
added comments and documentations as well as deleted elements used for
dchen116 Jun 4, 2024
1f44094
changed setPlot into more specific name: notifyPlotListeners
dchen116 Jun 4, 2024
6a44a83
changed PlotListener into more specific name as PlotDataUpdateListener
dchen116 Jun 4, 2024
8bf198b
moved the variables to the top of the class
dchen116 Jun 4, 2024
81db712
removed all the unnecessary println
dchen116 Jun 5, 2024
6bcea59
changed mkdir into mkdirs to fix the annotation failed to save issue
dchen116 Jun 5, 2024
3408bbc
fixed the mkdir if statement to consider the case when !dir.mkdirs()
dchen116 Jun 5, 2024
61c775c
created CustomChartPanel to separate the chartPanel related methods from
dchen116 Jun 7, 2024
6726926
fixed the zoomed in issue by created a new method setChart()
dchen116 Jun 7, 2024
27eedea
Created a fakePanel to split the panel into desired layout and fixed the
dchen116 Jun 11, 2024
4933d9d
changed the plot settings like color and size for the marker and the
dchen116 Jun 11, 2024
1d18102
Renamed the CustomChartPanel into SelectionChartPanel.
dchen116 Jun 12, 2024
2b3fa3b
Deleted unused import and renamed to "Selection Chart"
dchen116 Jun 13, 2024
86b646d
Added a JToolTip to the button to give a hint that there is a keyboard
dchen116 Jun 13, 2024
96a518a
added comments to explain the plot size changes once it was removed
dchen116 Jun 13, 2024
2783fcb
changed the plot title from 'Chart' into 'Selection Chart'
dchen116 Jun 13, 2024
6054f51
Added the slopes on the plot and created a NextPeak button
dchen116 Jun 14, 2024
4c19d78
Added yClick function and thresholdMarker
dchen116 Jun 14, 2024
03509b8
renamed slope
dchen116 Jun 14, 2024
781117c
Added nextPeak and actionPerformed to allow the nextPeakButton move 3D
dchen116 Jun 18, 2024
f3e3d30
add jfreechart jar file
dchen116 Jun 21, 2024
283ebf9
deleted the jcommon
dchen116 Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
739 changes: 372 additions & 367 deletions .classpath

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/bin/
/export/
/null/
classes
classes
*.csv
*.pdf
*.png
/output/
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import javax.swing.ButtonGroup;
Expand All @@ -33,6 +35,8 @@
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.janelia.mipav.plugins.worm.untwisting.AccurateModeListener;

import WildMagic.LibFoundation.Distance.DistanceVector3Segment3;
import WildMagic.LibFoundation.Mathematics.Segment3f;
import WildMagic.LibFoundation.Mathematics.Vector3f;
Expand Down Expand Up @@ -1092,39 +1096,78 @@ private void setVoxelSize()
defaultVoxelSize = new JTextField( "" + VoxelSize );
defaultVoxelSize.addActionListener(this);
JPanel panel = new JPanel( new GridLayout(1, 3) );
panel.add( new JLabel( "Current Voxel Size" ) );
panel.add( defaultVoxelSize );
panel.add( new JLabel("um") );
panel.add(new JLabel("Current Voxel Size"));
panel.add(defaultVoxelSize);
panel.add(new JLabel("um"));

updateVoxelSize = new JDialog();
updateVoxelSize.getContentPane().setLayout(new BorderLayout());
updateVoxelSize.setModalityType( JDialog.ModalityType.APPLICATION_MODAL);
updateVoxelSize.getContentPane().add( panel, BorderLayout.NORTH );
updateVoxelSize.getContentPane().add( OK, BorderLayout.SOUTH );
updateVoxelSize.setModalityType(JDialog.ModalityType.APPLICATION_MODAL);
updateVoxelSize.getContentPane().add(panel, BorderLayout.NORTH);
updateVoxelSize.getContentPane().add(OK, BorderLayout.SOUTH);
updateVoxelSize.pack();
updateVoxelSize.setResizable(false);

MipavUtil.centerOnScreen(updateVoxelSize);
updateVoxelSize.setVisible(true);
}

public void mouseReleased(MouseEvent e) {

// Handle event when mouse button is released
public void mouseReleased(MouseEvent e) {
movingPickedPoint = false;
if(editingCrossSections) {
if (editingCrossSections) {
latticeModel.showLattice(true);
}
}
}

// Handle key press events if the key is pressed
public void keyPressed(KeyEvent e) {
isShiftSelected = e.isShiftDown();

}


// Maintains state for accurate mode and listeners for its changes
private boolean accurateMode = true;
// List of listeners that will be notified when accurate mode changes
// TODO: might want to change the array into set
private List<AccurateModeListener> listeners = new ArrayList<>();

// Check if the accurate mode is currently enabled
public boolean isAccurateMode() {
return accurateMode;
}

// Toggle the accurate mode state and notify all listeners
public void toggleAccurateMode() {
accurateMode = !accurateMode;
setAccurateMode(accurateMode);
}

// Set the accurate mode and notify listeners about the mode change
public void setAccurateMode(boolean accurateMode) {
this.accurateMode = accurateMode;
for (AccurateModeListener listener : listeners) {
listener.accurateModeChanged(accurateMode);
}
}

// Add a new listener to be notified about accurate mode changes
public void addAccurateModeListener(AccurateModeListener listener) {
listeners.add(listener);
}

// Handle key release events and perform actions based on the key released
public void keyReleased(KeyEvent e) {
isShiftSelected = e.isShiftDown();
movingPickedPoint = false;
if(editingCrossSections) {
switch(e.getKeyChar()) {

// Specific actions based on key codes, e.g., toggle accurate mode on 'M' key
if (e.getKeyCode() == KeyEvent.VK_M) {
toggleAccurateMode();
}

if (editingCrossSections) {
switch (e.getKeyChar()) {
case '+':
latticeModel.decreaseCrossSectionSamples();
break;
Expand Down Expand Up @@ -1155,7 +1198,7 @@ public void keyReleased(KeyEvent e) {
case 'R':
latticeModel.showLattice(false);
latticeModel.resetCrossSections();
if(editingCrossSections) {
if (editingCrossSections) {
latticeModel.showLattice(true);
}
break;
Expand All @@ -1168,46 +1211,40 @@ public void keyReleased(KeyEvent e) {
}
}
}


public static VOIBase findNearestAnnotation( final VOI annotations, final Vector3f startPt, final Vector3f endPt, final Vector3f pt ) {
public static VOIBase findNearestAnnotation(final VOI annotations, final Vector3f startPt, final Vector3f endPt,
final Vector3f pt) {
int pickedAnnotation = -1;
float minDist = Float.MAX_VALUE;
for ( int i = 0; i < annotations.getCurves().size(); i++ )
{
for (int i = 0; i < annotations.getCurves().size(); i++) {
final Vector3f annotationPt = annotations.getCurves().elementAt(i).elementAt(0);
final float distance = pt.distance(annotationPt);
if ( distance < minDist )
{
if (distance < minDist) {
minDist = distance;
if ( minDist <= 12 )
{
if (minDist <= 12) {
pickedAnnotation = i;
}
}
}
// System.err.println("findNearestAnnotation " + minDist + " " + pickedAnnotation );
if ( (pickedAnnotation == -1) && (startPt != null) && (endPt != null) )
{
if ((pickedAnnotation == -1) && (startPt != null) && (endPt != null)) {
minDist = Float.MAX_VALUE;
// look at the vector under the mouse and see which lattice point is closest...
final Segment3f mouseVector = new Segment3f(startPt, endPt);
for ( int i = 0; i < annotations.getCurves().size(); i++ )
{
DistanceVector3Segment3 dist = new DistanceVector3Segment3(annotations.getCurves().elementAt(i).elementAt(0), mouseVector);
for (int i = 0; i < annotations.getCurves().size(); i++) {
DistanceVector3Segment3 dist = new DistanceVector3Segment3(
annotations.getCurves().elementAt(i).elementAt(0), mouseVector);
float distance = dist.Get();
// System.err.println( i + " " + distance );
if ( distance < minDist )
{
// System.err.println( i + " " + distance );
if (distance < minDist) {
minDist = distance;
if ( minDist <= 12 )
{
if (minDist <= 12) {
pickedAnnotation = i;
}
}
}
}
if ( pickedAnnotation != -1 ) {
if (pickedAnnotation != -1) {
return annotations.getCurves().elementAt(pickedAnnotation);
}
return null;
Expand Down
Loading