Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Dec 20, 2024
1 parent ff9f267 commit e465f10
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ public void paint(Graphics2D g2) {
}
}
setPosition(
Position.TopRight, bound.width - border, drawY - fontHeight + GuiUtils.getScaleLength(5));
Position.TopRight,
(double) bound.width - border,
drawY - fontHeight + GuiUtils.getScaleLength(5));
drawY = bound.height - border - GuiUtils.getScaleLength(1.5f); // -1.5 for outline
if (hideMin) {
corner = modality.getCornerInfo(CornerDisplay.BOTTOM_RIGHT);
Expand Down Expand Up @@ -377,7 +379,8 @@ public void paint(Graphics2D g2) {
drawY -= 5;
drawSeriesInMemoryState(g2, view2DPane.getSeries(), bound.width - border, (int) (drawY));
}
setPosition(Position.BottomRight, bound.width - border, drawY - GuiUtils.getScaleLength(5));
setPosition(
Position.BottomRight, (double) bound.width - border, drawY - GuiUtils.getScaleLength(5));

// Boolean synchLink = (Boolean) view2DPane.getActionValue(ActionW.SYNCH_LINK);
// String str = synchLink != null && synchLink ? "linked" : "unlinked"; // NON-NLS
Expand Down Expand Up @@ -518,8 +521,9 @@ public void paint(Graphics2D g2) {
}
} else {
setPosition(Position.TopLeft, border, border);
setPosition(Position.TopRight, bound.width - border, border);
setPosition(Position.BottomRight, bound.width - border, bound.height - border);
setPosition(Position.TopRight, (double) bound.width - border, border);
setPosition(
Position.BottomRight, (double) bound.width - border, (double) bound.height - border);
}

drawExtendedActions(g2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class ArcBallController extends SliderChangeListener implements
private MouseActionAdapter window = null;
private MouseActionAdapter level = null;

public ArcBallController(MprController controller) {
protected ArcBallController(MprController controller) {
super(ActionW.ROTATION, 0, 360, 0, true, 0.25);
this.controller = controller;
this.lastMousePosition = new Vector2d();
Expand Down Expand Up @@ -125,18 +125,20 @@ public void mousePressed(MouseEvent e) {
// if (view3d != null && !e.isConsumed() && (modifier & buttonMask) != 0) {
int mask = InputEvent.CTRL_DOWN_MASK;
if ((modifier & mask) == mask) {
view3d.setCursor(ActionW.WINLEVEL.getCursor());
window = view3d.getAction(ActionW.WINDOW);
if (window != null) {
window.setButtonMaskEx(window.getButtonMaskEx() | buttonMask);
window.setMoveOnX(true);
window.mousePressed(e);
}
level = view3d.getAction(ActionW.LEVEL);
if (level != null) {
level.setButtonMaskEx(level.getButtonMaskEx() | buttonMask);
level.setInverse(true);
level.mousePressed(e);
if (view3d != null) {
view3d.setCursor(ActionW.WINLEVEL.getCursor());
window = view3d.getAction(ActionW.WINDOW);
if (window != null) {
window.setButtonMaskEx(window.getButtonMaskEx() | buttonMask);
window.setMoveOnX(true);
window.mousePressed(e);
}
level = view3d.getAction(ActionW.LEVEL);
if (level != null) {
level.setButtonMaskEx(level.getButtonMaskEx() | buttonMask);
level.setInverse(true);
level.mousePressed(e);
}
}
} else {
releaseWinLevelAdapter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
public class AxisDirection {
private final Color color;
private final String name;
private final Vector3d axisX, axisY, axisZ;
private final Color xColor, yColor, zColor;
private final Vector3d axisX;
private final Vector3d axisY;
private final Vector3d axisZ;
private final Color xColor;
private final Color yColor;
private final Color zColor;
private final boolean invertedDirection;

public AxisDirection(SliceOrientation viewOrientation) {
Expand Down Expand Up @@ -132,10 +136,10 @@ public void drawAxes(Graphics2D g2d, MprView mprView) {
Vector3d arrow3 = getArrowDirection(axis, dirZ, axisLength);

Vector3d[] arrows = {arrow1, arrow2, arrow3};
double minX = Double.MAX_VALUE,
minY = Double.MAX_VALUE,
maxX = Double.MIN_VALUE,
maxY = Double.MIN_VALUE;
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxX = Double.MIN_VALUE;
double maxY = Double.MIN_VALUE;
for (Vector3d arrow : arrows) {
if (arrow.x < minX) minX = arrow.x;
if (arrow.y < minY) minY = arrow.y;
Expand All @@ -144,7 +148,7 @@ public void drawAxes(Graphics2D g2d, MprView mprView) {
}

Point2D pt = mprView.getInfoLayer().getPosition(Position.TopLeft);
double dimX = Math.sqrt(axisLength * axisLength) * 2.0;
double dimX = Math.sqrt((double) axisLength * axisLength) * 2.0;
double dimY = dimX;

if (pt != null) {
Expand Down Expand Up @@ -180,7 +184,7 @@ private void drawAxisLine(Graphics2D g2d, Vector3d arrow, Point offset) {

private void drawArrowHead(Graphics2D g2d, int xTip, int yTip, int xBase, int yBase) {
final int arrowHeadSize = 10;
double angle = Math.atan2(yTip - yBase, xTip - xBase);
double angle = Math.atan2((double) yTip - yBase, (double) xTip - xBase);

int x1 = xTip - (int) (arrowHeadSize * Math.cos(angle - Math.PI / 6));
int y1 = yTip - (int) (arrowHeadSize * Math.sin(angle - Math.PI / 6));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
import org.joml.Quaterniond;
import org.joml.Vector3d;
import org.joml.Vector3i;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.weasis.opencv.data.ImageCV;
import org.weasis.opencv.data.PlanarImage;

public class VolumeShort extends Volume<Short> {
private static final Logger LOGGER = LoggerFactory.getLogger(VolumeShort.class);

private short[][][] data;

Expand Down Expand Up @@ -189,7 +192,7 @@ public void saveVolumeInFile(File file) {
}
}
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("Cannot save volume in file", e);
}
}

Expand All @@ -215,7 +218,7 @@ public static Volume<?> readVolumeFromFile(File file) {
}
}
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("Cannot read volume from file", e);
}
return volume;
}
Expand Down

0 comments on commit e465f10

Please sign in to comment.