diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_2_0.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_2_0.xml
new file mode 100644
index 0000000..0159524
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_2_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_2_0.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_2_0.xml
new file mode 100644
index 0000000..2bbffd3
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_2_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_2_0.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_2_0.xml
new file mode 100644
index 0000000..f858dcb
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_2_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__gov_nih_imagej_imagej_1_46.xml b/.idea/libraries/Maven__gov_nih_imagej_imagej_1_46.xml
new file mode 100644
index 0000000..c57be46
--- /dev/null
+++ b/.idea/libraries/Maven__gov_nih_imagej_imagej_1_46.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_jeromq_jeromq_0_2_0.xml b/.idea/libraries/Maven__org_jeromq_jeromq_0_2_0.xml
new file mode 100644
index 0000000..1833f32
--- /dev/null
+++ b/.idea/libraries/Maven__org_jeromq_jeromq_0_2_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index d3c1ed1..6cc2985 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
ch.psi.zmq
ch.psi.zmq.imagej
- 0.4.0
+ 0.5.0
@@ -11,11 +11,11 @@
jeromq
0.2.0
-
+
com.fasterxml.jackson.core
jackson-databind
@@ -31,6 +31,15 @@
+
+ maven-compiler-plugin
+ 2.3.2
+
+ UTF-8
+ 1.7
+ 1.7
+
+
maven-assembly-plugin
2.4
diff --git a/src/main/java/ch/psi/zmq/imagej/Collector.java b/src/main/java/ch/psi/zmq/imagej/Collector.java
index 31e4774..22be4d6 100644
--- a/src/main/java/ch/psi/zmq/imagej/Collector.java
+++ b/src/main/java/ch/psi/zmq/imagej/Collector.java
@@ -43,8 +43,8 @@ import javax.imageio.stream.ImageInputStream;
import org.jeromq.ZMQ;
-import ch.psi.imagej.cbf.CbfImageReader;
-import ch.psi.imagej.cbf.CbfImageReaderSpi;
+//import ch.psi.imagej.cbf.CbfImageReader;
+//import ch.psi.imagej.cbf.CbfImageReaderSpi;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -178,7 +178,9 @@ public class Collector implements Runnable {
imageSizeX = nImageSizeX;
imageSizeY = nImageSizeY;
- img.close();
+ if(img !=null){
+ img.close();
+ }
img = null;
}
@@ -234,75 +236,75 @@ public class Collector implements Runnable {
numImageUpdates++;
}
}
- else if (htype == HType.PILATUS_1_0) {
- CbfImageReaderSpi spi = new CbfImageReaderSpi();
- ImageInputStream stream = ImageIO.createImageInputStream(new ByteArrayInputStream(content));
- CbfImageReader reader = new CbfImageReader(spi);
- reader.setInput(stream);
- ImageReadParam param = reader.getDefaultReadParam();
- int width = reader.getWidth(0);
- int height = reader.getHeight(0);
- BufferedImage image = reader.read(0, param);
- DataBuffer buffer = image.getData().getDataBuffer();
- int bufferType = buffer.getDataType();
- float[] pixels;
- ImageProcessor ip = null;
- if (buffer instanceof DataBufferFloat) {
- pixels = ((DataBufferFloat) buffer).getData();
- ip = new FloatProcessor(width, height, pixels, null);
- image.flush();
- reader.dispose();
- // TODO
- // return new ImagePlus(cbfFile.getName(), ip);
- } else if (bufferType == DataBuffer.TYPE_INT || bufferType == DataBuffer.TYPE_FLOAT) {
- pixels = new float[width * height];
- for (int i = 0; i < pixels.length; i++)
- pixels[i] = buffer.getElemFloat(i);
- ip = new FloatProcessor(width, height, pixels, null);
- image.flush();
- reader.dispose();
- // TODO
- // return new ImagePlus(cbfFile.getName(), ip);
- } else if (bufferType == DataBuffer.TYPE_DOUBLE) {
- pixels = new float[width * height];
- boolean clipped = false;
- for (int i = 0; i < pixels.length; i++) {
- double doubleValue = buffer.getElemDouble(i);
- float floatValue;
- if (doubleValue < Float.MIN_VALUE) {
- floatValue = Float.MIN_VALUE;
- clipped = true;
- } else if (doubleValue > Float.MAX_VALUE) {
- floatValue = Float.MAX_VALUE;
- clipped = true;
- } else {
- floatValue = (float) doubleValue;
- }
- pixels[i] = floatValue;
- }
- if (clipped) {
- IJ.log("Warning: pixel value(s) clipped to fit in type float");
- }
- ip = new FloatProcessor(width, height, pixels, null);
- image.flush();
- reader.dispose();
- // TODO
- // return new ImagePlus(cbfFile.getName(), ip);
- } else {
- reader.dispose();
- // TODO
- // return new ImagePlus(cbfFile.getName(), image);
- }
- if(img==null){
- img = new ImagePlus("", ip);
- img.show();
- }
- else{
- img.setProcessor(ip);
- img.updateAndDraw();
- }
-
- }
+// else if (htype == HType.PILATUS_1_0) {
+// CbfImageReaderSpi spi = new CbfImageReaderSpi();
+// ImageInputStream stream = ImageIO.createImageInputStream(new ByteArrayInputStream(content));
+// CbfImageReader reader = new CbfImageReader(spi);
+// reader.setInput(stream);
+// ImageReadParam param = reader.getDefaultReadParam();
+// int width = reader.getWidth(0);
+// int height = reader.getHeight(0);
+// BufferedImage image = reader.read(0, param);
+// DataBuffer buffer = image.getData().getDataBuffer();
+// int bufferType = buffer.getDataType();
+// float[] pixels;
+// ImageProcessor ip = null;
+// if (buffer instanceof DataBufferFloat) {
+// pixels = ((DataBufferFloat) buffer).getData();
+// ip = new FloatProcessor(width, height, pixels, null);
+// image.flush();
+// reader.dispose();
+// // TODO
+// // return new ImagePlus(cbfFile.getName(), ip);
+// } else if (bufferType == DataBuffer.TYPE_INT || bufferType == DataBuffer.TYPE_FLOAT) {
+// pixels = new float[width * height];
+// for (int i = 0; i < pixels.length; i++)
+// pixels[i] = buffer.getElemFloat(i);
+// ip = new FloatProcessor(width, height, pixels, null);
+// image.flush();
+// reader.dispose();
+// // TODO
+// // return new ImagePlus(cbfFile.getName(), ip);
+// } else if (bufferType == DataBuffer.TYPE_DOUBLE) {
+// pixels = new float[width * height];
+// boolean clipped = false;
+// for (int i = 0; i < pixels.length; i++) {
+// double doubleValue = buffer.getElemDouble(i);
+// float floatValue;
+// if (doubleValue < Float.MIN_VALUE) {
+// floatValue = Float.MIN_VALUE;
+// clipped = true;
+// } else if (doubleValue > Float.MAX_VALUE) {
+// floatValue = Float.MAX_VALUE;
+// clipped = true;
+// } else {
+// floatValue = (float) doubleValue;
+// }
+// pixels[i] = floatValue;
+// }
+// if (clipped) {
+// IJ.log("Warning: pixel value(s) clipped to fit in type float");
+// }
+// ip = new FloatProcessor(width, height, pixels, null);
+// image.flush();
+// reader.dispose();
+// // TODO
+// // return new ImagePlus(cbfFile.getName(), ip);
+// } else {
+// reader.dispose();
+// // TODO
+// // return new ImagePlus(cbfFile.getName(), image);
+// }
+// if(img==null){
+// img = new ImagePlus("", ip);
+// img.show();
+// }
+// else{
+// img.setProcessor(ip);
+// img.updateAndDraw();
+// }
+//
+// }
} catch (Exception ex) {
logger.log(Level.SEVERE, "UpdateImage got exception", ex);
}