Skip to content

Commit e465f10

Browse files
committedDec 20, 2024
Fix minor issues
1 parent ff9f267 commit e465f10

File tree

5 files changed

+40
-49
lines changed

5 files changed

+40
-49
lines changed
 

‎weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/InfoLayer.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ public void paint(Graphics2D g2) {
347347
}
348348
}
349349
setPosition(
350-
Position.TopRight, bound.width - border, drawY - fontHeight + GuiUtils.getScaleLength(5));
350+
Position.TopRight,
351+
(double) bound.width - border,
352+
drawY - fontHeight + GuiUtils.getScaleLength(5));
351353
drawY = bound.height - border - GuiUtils.getScaleLength(1.5f); // -1.5 for outline
352354
if (hideMin) {
353355
corner = modality.getCornerInfo(CornerDisplay.BOTTOM_RIGHT);
@@ -377,7 +379,8 @@ public void paint(Graphics2D g2) {
377379
drawY -= 5;
378380
drawSeriesInMemoryState(g2, view2DPane.getSeries(), bound.width - border, (int) (drawY));
379381
}
380-
setPosition(Position.BottomRight, bound.width - border, drawY - GuiUtils.getScaleLength(5));
382+
setPosition(
383+
Position.BottomRight, (double) bound.width - border, drawY - GuiUtils.getScaleLength(5));
381384

382385
// Boolean synchLink = (Boolean) view2DPane.getActionValue(ActionW.SYNCH_LINK);
383386
// String str = synchLink != null && synchLink ? "linked" : "unlinked"; // NON-NLS
@@ -518,8 +521,9 @@ public void paint(Graphics2D g2) {
518521
}
519522
} else {
520523
setPosition(Position.TopLeft, border, border);
521-
setPosition(Position.TopRight, bound.width - border, border);
522-
setPosition(Position.BottomRight, bound.width - border, bound.height - border);
524+
setPosition(Position.TopRight, (double) bound.width - border, border);
525+
setPosition(
526+
Position.BottomRight, (double) bound.width - border, (double) bound.height - border);
523527
}
524528

525529
drawExtendedActions(g2);

‎weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/ArcBallController.java

+15-13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract class ArcBallController extends SliderChangeListener implements
2727
private MouseActionAdapter window = null;
2828
private MouseActionAdapter level = null;
2929

30-
public ArcBallController(MprController controller) {
30+
protected ArcBallController(MprController controller) {
3131
super(ActionW.ROTATION, 0, 360, 0, true, 0.25);
3232
this.controller = controller;
3333
this.lastMousePosition = new Vector2d();
@@ -125,18 +125,20 @@ public void mousePressed(MouseEvent e) {
125125
// if (view3d != null && !e.isConsumed() && (modifier & buttonMask) != 0) {
126126
int mask = InputEvent.CTRL_DOWN_MASK;
127127
if ((modifier & mask) == mask) {
128-
view3d.setCursor(ActionW.WINLEVEL.getCursor());
129-
window = view3d.getAction(ActionW.WINDOW);
130-
if (window != null) {
131-
window.setButtonMaskEx(window.getButtonMaskEx() | buttonMask);
132-
window.setMoveOnX(true);
133-
window.mousePressed(e);
134-
}
135-
level = view3d.getAction(ActionW.LEVEL);
136-
if (level != null) {
137-
level.setButtonMaskEx(level.getButtonMaskEx() | buttonMask);
138-
level.setInverse(true);
139-
level.mousePressed(e);
128+
if (view3d != null) {
129+
view3d.setCursor(ActionW.WINLEVEL.getCursor());
130+
window = view3d.getAction(ActionW.WINDOW);
131+
if (window != null) {
132+
window.setButtonMaskEx(window.getButtonMaskEx() | buttonMask);
133+
window.setMoveOnX(true);
134+
window.mousePressed(e);
135+
}
136+
level = view3d.getAction(ActionW.LEVEL);
137+
if (level != null) {
138+
level.setButtonMaskEx(level.getButtonMaskEx() | buttonMask);
139+
level.setInverse(true);
140+
level.mousePressed(e);
141+
}
140142
}
141143
} else {
142144
releaseWinLevelAdapter();

‎weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/AxisDirection.java

+12-8
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
public class AxisDirection {
2525
private final Color color;
2626
private final String name;
27-
private final Vector3d axisX, axisY, axisZ;
28-
private final Color xColor, yColor, zColor;
27+
private final Vector3d axisX;
28+
private final Vector3d axisY;
29+
private final Vector3d axisZ;
30+
private final Color xColor;
31+
private final Color yColor;
32+
private final Color zColor;
2933
private final boolean invertedDirection;
3034

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

134138
Vector3d[] arrows = {arrow1, arrow2, arrow3};
135-
double minX = Double.MAX_VALUE,
136-
minY = Double.MAX_VALUE,
137-
maxX = Double.MIN_VALUE,
138-
maxY = Double.MIN_VALUE;
139+
double minX = Double.MAX_VALUE;
140+
double minY = Double.MAX_VALUE;
141+
double maxX = Double.MIN_VALUE;
142+
double maxY = Double.MIN_VALUE;
139143
for (Vector3d arrow : arrows) {
140144
if (arrow.x < minX) minX = arrow.x;
141145
if (arrow.y < minY) minY = arrow.y;
@@ -144,7 +148,7 @@ public void drawAxes(Graphics2D g2d, MprView mprView) {
144148
}
145149

146150
Point2D pt = mprView.getInfoLayer().getPosition(Position.TopLeft);
147-
double dimX = Math.sqrt(axisLength * axisLength) * 2.0;
151+
double dimX = Math.sqrt((double) axisLength * axisLength) * 2.0;
148152
double dimY = dimX;
149153

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

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

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

‎weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/VolParams.java

-22
This file was deleted.

‎weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/VolumeShort.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
import org.joml.Quaterniond;
2626
import org.joml.Vector3d;
2727
import org.joml.Vector3i;
28+
import org.slf4j.Logger;
29+
import org.slf4j.LoggerFactory;
2830
import org.weasis.opencv.data.ImageCV;
2931
import org.weasis.opencv.data.PlanarImage;
3032

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

3336
private short[][][] data;
3437

@@ -189,7 +192,7 @@ public void saveVolumeInFile(File file) {
189192
}
190193
}
191194
} catch (IOException e) {
192-
e.printStackTrace();
195+
LOGGER.error("Cannot save volume in file", e);
193196
}
194197
}
195198

@@ -215,7 +218,7 @@ public static Volume<?> readVolumeFromFile(File file) {
215218
}
216219
}
217220
} catch (IOException e) {
218-
e.printStackTrace();
221+
LOGGER.error("Cannot read volume from file", e);
219222
}
220223
return volume;
221224
}

0 commit comments

Comments
 (0)