diff --git a/nbactions.xml b/nbactions.xml
index 827cc3d..c9e50c7 100644
--- a/nbactions.xml
+++ b/nbactions.xml
@@ -1,46 +1,46 @@
-
-
-
- run
-
- jar
-
-
- process-classes
- org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
-
-
- -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r
- java
-
-
-
- debug
-
- jar
-
-
- process-classes
- org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
-
-
- -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r
- java
- true
-
-
-
- profile
-
- jar
-
-
- process-classes
- org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
-
-
- -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r
- java
-
-
-
+
+
+
+ run
+
+ jar
+
+
+ process-classes
+ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
+
+
+ -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r
+ java
+
+
+
+ debug
+
+ jar
+
+
+ process-classes
+ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
+
+
+ -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=D:\dev\pshell\home -r
+ java
+ true
+
+
+
+ profile
+
+ jar
+
+
+ process-classes
+ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
+
+
+ -classpath %classpath ch.psi.pshell.ui.App -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r
+ java
+
+
+
diff --git a/pom.xml b/pom.xml
index 2b34ce9..127b26b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,80 +1,80 @@
-
-
- 4.0.0
- ch.psi
- MXSC
- 1.19.0
- jar
-
-
- ${project.groupId}
- pshell
- ${project.version}
-
-
- org.zeromq
- jeromq
- 0.5.3
-
-
-
- UTF-8
- 11
- 11
-
-
-
-
- jcenter
- jcenter
- https://jcenter.bintray.com/
-
-
- bintray-hltools
- bintray
- https://dl.bintray.com/paulscherrerinstitute/hltools
-
-
- imagej
- imagej
- http://maven.imagej.net/content/repositories/public
-
-
- libs-snapshots-local
- libs-snapshots-local
- https://artifacts.psi.ch/artifactory/libs-snapshots-local/
-
-
- scijava-pub
- scijava-pub
- https://maven.scijava.org/content/repositories/public/
-
-
- scijava
- scijava
- https://maven.scijava.org/
-
-
- releases
- releases
- https://artifacts.psi.ch/artifactory/releases
-
-
- MXSC
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.3.1
-
- ../../config/mxsc/plugins
-
-
-
-
+
+
+ 4.0.0
+ ch.psi
+ MXSC
+ 1.21.0
+ jar
+
+
+ ${project.groupId}
+ pshell
+ ${project.version}
+
+
+ org.zeromq
+ jeromq
+ 0.5.3
+
+
+
+ UTF-8
+ 11
+ 11
+
+
+
+
+ jcenter
+ jcenter
+ https://jcenter.bintray.com/
+
+
+ bintray-hltools
+ bintray
+ https://dl.bintray.com/paulscherrerinstitute/hltools
+
+
+ imagej
+ imagej
+ http://maven.imagej.net/content/repositories/public
+
+
+ libs-snapshots-local
+ libs-snapshots-local
+ https://artifacts.psi.ch/artifactory/libs-snapshots-local/
+
+
+ scijava-pub
+ scijava-pub
+ https://maven.scijava.org/content/repositories/public/
+
+
+ scijava
+ scijava
+ https://maven.scijava.org/
+
+
+ releases
+ releases
+ https://artifacts.psi.ch/artifactory/releases
+
+
+ MXSC
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.3.1
+
+ ../pshell/home/plugins
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
index 2b79514..16775ef 100644
--- a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
+++ b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
@@ -2,10 +2,12 @@ package ch.psi.mxsc;
import ch.psi.pshell.imaging.Utils;
import ch.psi.utils.swing.MainFrame;
+import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Stroke;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
@@ -60,6 +62,17 @@ public class BasePlateGraphics {
top,
bottom
}
+
+ Rectangle imageRoi;
+
+ public void setImageRoi( Rectangle roi){
+ this.imageRoi = roi;
+ }
+
+ Point detection;
+ public void setDetection( Point detection){
+ this.detection = detection;
+ }
void draw(Graphics2D g, Rectangle plotRect, boolean drawSamples, boolean drawIds, boolean drawContour, DrawMode mode, BufferedImage img) {
if (mode != DrawMode.fill){
@@ -85,7 +98,19 @@ public class BasePlateGraphics {
this.plotRect = plotRect;
this.drawContour = drawContour;
boundingBox = new Rectangle((int)(plotRect.x+plotRect.width*0.05), (int)(plotRect.y+plotRect.height * 0.05), (int)(plotRect.width*0.90), (int)(plotRect.height*0.90));
+ int center_x=0, center_y=0;
if (img!=null){
+ Point detection = this.detection;
+ if (imageRoi!=null){
+ img = img.getSubimage(imageRoi.x, imageRoi.y, imageRoi.width, imageRoi.height);
+ if (detection!=null){
+ //detection = new Point(detection.x-imageRoi.x, detection.y-imageRoi.y);
+ center_x = detection.x * boundingBox.width / img.getWidth() + boundingBox.x;
+ center_y = detection.y * boundingBox.height / img.getHeight() + boundingBox.y;
+ center_x -= imageRoi.x * boundingBox.width / img.getWidth();
+ center_y -= imageRoi.y * boundingBox.height / img.getHeight();
+ }
+ }
img = Utils.stretch(img, boundingBox.width, boundingBox.height);
g.setClip(new Ellipse2D.Float(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height));
g.drawImage(img, boundingBox.x, boundingBox.y, null);
@@ -104,6 +129,16 @@ public class BasePlateGraphics {
for (PuckGraphics pg : puckGraphics) {
pg.draw(g, null, drawSamples, drawIds, drawBackground) ;
}
+ if (img!=null){
+ if (detection!=null){
+ int size=15;
+ g.setColor(new Color(86, 193, 255));
+ g.setStroke(new BasicStroke(2f));
+ g.drawLine(center_x-size, center_y, center_x+size, center_y);
+ g.drawLine(center_x, center_y-size, center_x, center_y+size);
+ //g.drawOval(center_x-size, center_y-size, 2*size, 2*size);
+ }
+ }
}
diff --git a/src/main/java/ch/psi/mxsc/Controller.java b/src/main/java/ch/psi/mxsc/Controller.java
index ef597ea..e92ebaf 100644
--- a/src/main/java/ch/psi/mxsc/Controller.java
+++ b/src/main/java/ch/psi/mxsc/Controller.java
@@ -56,7 +56,6 @@ public class Controller {
final BasePlate basePlate;
RoomTemperatureBasePlate roomTemperatureBasePlate;
static /*Panel*/ MainPanel mainFrame;
- Device hexiposi;
Device barcode_reader;
Device barcode_reader_puck;
Device puck_detection;
@@ -305,12 +304,6 @@ public class Controller {
}
}
- final DeviceListener hexiposiListener = new DeviceAdapter() {
- @Override
- public void onValueChanged(Device device, Object value, Object former) {
- updateView();
- }
- };
final DeviceListener barcodeReaderListener = new DeviceAdapter() {
@Override
@@ -346,22 +339,6 @@ public class Controller {
};
void updateDevices() {
- if (hexiposi != null) {
- hexiposi.removeListener(hexiposiListener);
- }
- if (barcode_reader != null) {
- hexiposi.removeListener(barcodeReaderListener);
- }
- if (puck_detection != null) {
- hexiposi.removeListener(puckDetectionListener);
- }
- hexiposi = (Device) getMainFrame().getDevice("hexiposi");
- if (hexiposi != null) {
- hexiposi.addListener(hexiposiListener);
- } else {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No hexiposi detected.");
- }
- mainFrame.hexiposiPanel.setDevice(hexiposi);
barcode_reader = (Device) getDevice("barcode_reader");
if (barcode_reader != null) {
barcode_reader.addListener(barcodeReaderListener);
@@ -429,16 +406,8 @@ public class Controller {
updateView();
}
- public String getHexiposiPosition() {
- try {
- return (String) ((ReadbackDevice) hexiposi).getReadback().take();
- } catch (Exception ex) {
- return null;
- }
- }
-
public boolean isSelectedPuck(Puck puck) {
- return ("" + puck.getSegment()).equalsIgnoreCase(getHexiposiPosition());
+ return puck.isSegmentSelected();
}
public List getSelectedPucks() {
@@ -773,7 +742,7 @@ public class Controller {
Puck.Detection[] detection = basePlate.getDetection();
for (int i = 0; i < Controller.NUMBER_OF_PUCKS; i++) {
Puck puck = basePlate.getPucks()[i];
- //Only manage pucks for current hexiposi position
+
if (isSelectedPuck(puck)) {
boolean detectedPuckInserted = (currentDetection[i] != Puck.Detection.Present) && (detection[i] == Puck.Detection.Present);
boolean detectedPuckRemoved = (currentDetection[i] != Puck.Detection.Empty) && (detection[i] == Puck.Detection.Empty);
diff --git a/src/main/java/ch/psi/mxsc/MainPanel.form b/src/main/java/ch/psi/mxsc/MainPanel.form
index 3cc1d67..bccb809 100644
--- a/src/main/java/ch/psi/mxsc/MainPanel.form
+++ b/src/main/java/ch/psi/mxsc/MainPanel.form
@@ -1,6 +1,10 @@