Commit d99d11ff authored by Aliaksandr Halavatyi's avatar Aliaksandr Halavatyi
Browse files

additional util functions

parent 5af6741f
......@@ -8,7 +8,7 @@
<version>5.0</version> <relativePath /> </parent> -->
<groupId>embl.almf</groupId>
<artifactId>AutoMicTools_</artifactId>
<version>1.1.29-SNAPSHOT</version>
<version>1.1.30-SNAPSHOT</version>
<name>plugins/AutoMicTools_.jar</name>
<description>Collection of tools for automated (feedback) microscopy data acquisition and analysis</description>
......
......@@ -11,6 +11,14 @@ public class Point3D {
z=_z;
}
public Point3D(Integer _xInt, Integer _yInt, Integer _zInt) {
x=(_xInt==null)?null:Double.valueOf(_xInt);
y=(_yInt==null)?null:Double.valueOf(_yInt);
z=(_zInt==null)?null:Double.valueOf(_zInt);
}
public Double getX(){
return x;
}
......@@ -23,6 +31,25 @@ public class Point3D {
return z;
}
public Integer getXInteger(){
if (x==null)
return null;
return x.intValue();
}
public Integer getYInteger(){
if (y==null)
return null;
return y.intValue();
}
public Integer getZInteger(){
if (z==null)
return null;
return z.intValue();
}
public void setX(Double _x) {
x=_x;
}
......
......@@ -179,11 +179,4 @@ public class ZenBlueCommander implements MicroscopeCommanderInterface{
_jObject.add(_key, _value);
}
private static Double getValueFromNonNullArray(double[] _array, int _index) {
if (_array==null)
return null;
return _array[_index];
}
}
......@@ -16,6 +16,8 @@ import loci.plugins.in.ImporterOptions;
import java.lang.Exception;
import automic.geom.Point3D;
import java.io.File;
import java.io.IOException;
......@@ -198,4 +200,43 @@ public class ImageOpenerWithBioformats {
return imgs[0];
}
public static Point3D getVoxelSizeUm(String _imageFilePath)throws Exception {
ImageReader reader = new ImageReader();
IMetadata omeMeta = MetadataTools.createOMEXMLMetadata();
reader.setMetadataStore(omeMeta);
reader.setId(_imageFilePath);
double xSize=omeMeta.getPixelsPhysicalSizeX(0).value().doubleValue();
double ySize=omeMeta.getPixelsPhysicalSizeY(0).value().doubleValue();
double zSize=omeMeta.getPixelsPhysicalSizeZ(0).value().doubleValue();
reader.close();
return new Point3D(xSize, ySize, zSize);
}
public static Point3D getVoxelSizeNm(String _imageFilePath) throws Exception {
Point3D voxelSizeInUm=getVoxelSizeUm(_imageFilePath);
return new Point3D(voxelSizeInUm.getX()*1000, voxelSizeInUm.getY()*1000, voxelSizeInUm.getZ()*1000);
}
public static Point3D getImageSizePx(String _imageFilePath)throws Exception {
ImageReader reader = new ImageReader();
IMetadata omeMeta = MetadataTools.createOMEXMLMetadata();
reader.setMetadataStore(omeMeta);
reader.setId(_imageFilePath);
double xSize=omeMeta.getPixelsSizeX(0).getValue();
double ySize=omeMeta.getPixelsSizeY(0).getValue();
double zSize=omeMeta.getPixelsSizeZ(0).getValue();
reader.close();
return new Point3D(xSize, ySize, zSize);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment