updates
This commit is contained in:
parent
0b3ce96675
commit
0c2c2d21d3
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_2_0.xml
generated
Normal file
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_2_0.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.2.0/jackson-annotations-2.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.2.0/jackson-annotations-2.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.2.0/jackson-annotations-2.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_2_0.xml
generated
Normal file
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_2_0.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.fasterxml.jackson.core:jackson-core:2.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.2.0/jackson-core-2.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.2.0/jackson-core-2.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.2.0/jackson-core-2.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_2_0.xml
generated
Normal file
13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_2_0.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.2.0/jackson-databind-2.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.2.0/jackson-databind-2.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.2.0/jackson-databind-2.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__gov_nih_imagej_imagej_1_46.xml
generated
Normal file
13
.idea/libraries/Maven__gov_nih_imagej_imagej_1_46.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: gov.nih.imagej:imagej:1.46">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/gov/nih/imagej/imagej/1.46/imagej-1.46.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/gov/nih/imagej/imagej/1.46/imagej-1.46-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/gov/nih/imagej/imagej/1.46/imagej-1.46-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_jeromq_jeromq_0_2_0.xml
generated
Normal file
13
.idea/libraries/Maven__org_jeromq_jeromq_0_2_0.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jeromq:jeromq:0.2.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jeromq/jeromq/0.2.0/jeromq-0.2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jeromq/jeromq/0.2.0/jeromq-0.2.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jeromq/jeromq/0.2.0/jeromq-0.2.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
15
pom.xml
15
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi.zmq</groupId>
|
||||
<artifactId>ch.psi.zmq.imagej</artifactId>
|
||||
<version>0.4.0</version>
|
||||
<version>0.5.0</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -11,11 +11,11 @@
|
||||
<artifactId>jeromq</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>ch.psi.imagej</groupId>
|
||||
<artifactId>ch.psi.imagej.cbf</artifactId>
|
||||
<version>0.0.3</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
@ -31,6 +31,15 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user