Commit 89f4d755 authored by Stephane Dallongeville's avatar Stephane Dallongeville
Browse files

Restored changes lost in mavenization merge

parent 5f1c599d
......@@ -2,43 +2,10 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="F:/SDKs/Java/jdk1.8.0_241/lib/tools.jar"/>
<classpathentry kind="var" path="USER_HOME/SDKs/Java/jdk1.8.0_251/lib/tools.jar"/>
<classpathentry kind="var" path="USER_HOME/SDKs/Java/jdk1.8.0_251/lib/tools.jar"/>
<classpathentry kind="lib" path="D:/SDKs/Java/jdk1.8.0_241/lib/tools.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-kernel:2.1.0"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: net.sf.ehcache:ehcache:2.10.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.slf4j:slf4j-api:1.7.25"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-bioformats:6.3.1"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-insubstantial:7.3.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-vtk:6.3.0.1"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: net.imagej:ij:1.52q"/>
<classpathentry kind="var" path="USER_HOME/SDKs/Java/jdk1.8.0_251/lib/tools.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: javax.media:jai-core:1.1.3"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: javax.media:jai-codec:1.1.3"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all:2.1.5-01"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all-natives-linux-amd64:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all-natives-linux-i586:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all-natives-macosx-universal:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all-natives-windows-amd64:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.jogl:jogl-all-natives-windows-i586:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt:2.1.5-01"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt-natives-linux-amd64:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt-natives-linux-i586:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt-natives-macosx-universal:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt-natives-windows-amd64:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.jogamp.gluegen:gluegen-rt-natives-windows-i586:2.1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.javassist:javassist:3.22.0-GA"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: net.sourceforge.jexcelapi:jxl:2.6.12"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: log4j:log4j:1.2.14"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.swinglabs.swingx:swingx-all:1.6.5-1"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-sequence-blocks:2.0.14"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-blocks:1.0.1"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-protocols:3.0.9"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-javadocparser:1.0.0"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: com.nativelibs4java:ochafik-util:0.12"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Maven: org.bioimageanalysis.icy:icy-ezplug:3.15.13"/>
<classpathentry kind="var" path="ICY_JAR" sourcepath="/ICY_KERNEL"/>
<classpathentry kind="var" path="ICY_PLUGINS/adufour/blocks/Blocks.jar"/>
<classpathentry kind="var" path="ICY_PLUGINS/adufour/ezplug/EzPlug.jar"/>
<classpathentry kind="var" path="ICY_PLUGINS/tprovoost/sequenceblocks/SequenceBlocks.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
bin/
.idea/
.settings/
build/
......@@ -5,4 +6,5 @@ target/
*.iml
*.eml
.classpath
.project
\ No newline at end of file
.project
*.jar
......@@ -4,9 +4,6 @@
package plugins.stef.roi.bloc.op;
import java.awt.Color;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -31,6 +28,7 @@ import plugins.adufour.vars.lang.VarSequence;
import plugins.adufour.vars.lang.VarString;
import plugins.adufour.vars.util.VarException;
import plugins.kernel.roi.descriptor.measure.ROIInteriorDescriptor;
import plugins.kernel.roi.descriptor.property.ROIColorDescriptor;
import plugins.stef.roi.bloc.RoiBlocks;
/**
......@@ -92,9 +90,6 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
}
}
private static final DecimalFormat format = (DecimalFormat) NumberFormat.getInstance();
private static final DecimalFormatSymbols symbols = format.getDecimalFormatSymbols();
private static final char decimalSep = symbols.getDecimalSeparator();
private static final AlphanumComparator comp = new AlphanumComparator();
protected final VarROIArray roiSet = new VarROIArray("ROI(s)", null);
......@@ -170,34 +165,25 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
private static Object getTypedValue(String value)
{
final String adjValue = value.replace('.', decimalSep).replace(',', decimalSep);
try
{
return Double.valueOf(Double.parseDouble(adjValue));
return Double.valueOf(Double.parseDouble(value.replace(',', '.')));
}
catch (NumberFormatException e1)
{
try
{
return Float.valueOf(Float.parseFloat(adjValue));
return Double.valueOf(Float.parseFloat(value.replace('.', ',')));
}
catch (NumberFormatException e2)
{
try
{
return Integer.valueOf(Integer.parseInt(adjValue));
return Long.valueOf(Long.parseLong(value));
}
catch (NumberFormatException e3)
catch (NumberFormatException e4)
{
try
{
return Long.valueOf(Long.parseLong(adjValue));
}
catch (NumberFormatException e4)
{
// probably not a number then...
}
// probably not a number then...
}
}
}
......@@ -285,7 +271,16 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
// try to get the type behind
final Object typedValue = getTypedValue(value);
// get regex from String
final String regexValue = StringUtil.wildcardToRegex(value);
final String regexValue;
if (roiDescriptor instanceof ROIColorDescriptor)
{
regexValue = StringUtil.wildcardToRegex(value.toLowerCase());
value = value.toLowerCase();
}
else
{
regexValue = StringUtil.wildcardToRegex(value);
}
// number comparison
if (typedValue instanceof Number)
......@@ -322,7 +317,7 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
}
catch (VarException e1)
{
throw e1;
throw e1;
}
catch (Exception e2)
{
......@@ -352,7 +347,7 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
else if (res instanceof String)
stringRes = (String) res;
else if (res instanceof Color)
stringRes = colorToString((Color) res);
stringRes = colorToString((Color) res).toLowerCase();
else if (res != null)
stringRes = res.toString();
else
......@@ -363,7 +358,7 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
}
catch (VarException e1)
{
throw e1;
throw e1;
}
catch (Exception e2)
{
......@@ -401,4 +396,4 @@ public class FilterROI extends Plugin implements ROIBlock, PluginLibrary, Plugin
{
return filterROIs(rois, sequence, descriptorId, op, Double.toString(value));
}
}
\ No newline at end of file
}
......@@ -11,6 +11,7 @@ import icy.roi.ROI;
import icy.type.collection.CollectionUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarBoolean;
import plugins.adufour.vars.lang.VarEnum;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
......@@ -34,13 +35,14 @@ public class LogicalOperationROI extends Plugin implements ROIBlock, PluginLibra
protected VarROIArray roiSetA = new VarROIArray("ROI(s) group A", null);
protected VarROIArray roiSetB = new VarROIArray("ROI(s) group B", null);
protected VarEnum<LogicOperator> op = new VarEnum<LogicOperator>("Keep", LogicOperator.A_CONTAINED_IN_B);
protected VarBoolean copyRois = new VarBoolean("Copy ROIs", true);
protected VarROIArray output = new VarROIArray("Result");
@Override
public void run()
{
final List<ROI> result = doLogicalOperation(CollectionUtil.asList(roiSetA.getValue()),
CollectionUtil.asList(roiSetB.getValue()), op.getValue());
CollectionUtil.asList(roiSetB.getValue()), op.getValue(), copyRois.getValue());
output.setValue(result.toArray(new ROI[result.size()]));
}
......@@ -51,6 +53,7 @@ public class LogicalOperationROI extends Plugin implements ROIBlock, PluginLibra
inputMap.add("roiA", roiSetA);
inputMap.add("roiB", roiSetB);
inputMap.add("op", op);
inputMap.add("generate copies", copyRois);
}
@Override
......@@ -74,9 +77,12 @@ public class LogicalOperationROI extends Plugin implements ROIBlock, PluginLibra
* second set of ROI
* @param logicOp
* logical operation to apply between the 2 sets of ROI
* @param copyRois
* perform a copy of originals ROIs (so they are never modified)
* @return result ROIs from the given logical operation between the 2 sets of ROI
*/
public static List<ROI> doLogicalOperation(Collection<ROI> roiSetA, Collection<ROI> roiSetB, LogicOperator logicOp)
public static List<ROI> doLogicalOperation(Collection<ROI> roiSetA, Collection<ROI> roiSetB, LogicOperator logicOp,
boolean copyRois)
{
final List<ROI> result = new ArrayList<ROI>();
......@@ -129,7 +135,7 @@ public class LogicalOperationROI extends Plugin implements ROIBlock, PluginLibra
// condition verified ?
if (cond)
result.add(roiA.getCopy());
result.add((copyRois ? roiA.getCopy() : roiA));
}
}
......
......@@ -4,7 +4,7 @@ import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.type.point.Point5D;
import icy.type.rectangle.Rectangle5D;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarDouble;
......@@ -26,6 +26,10 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
protected VarDouble posT = new VarDouble("position T", 0d);
protected VarDouble posC = new VarDouble("position C", 0d);
protected VarDouble posXCenter = new VarDouble("position X(center)", 0d);
protected VarDouble posYCenter = new VarDouble("position Y(center)", 0d);
protected VarDouble posZCenter = new VarDouble("position Z(center)", 0d);
@Override
public void run()
{
......@@ -33,14 +37,18 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
{
if (roi != null)
{
final Point5D pos = roi.getPosition5D();
final Rectangle5D bounds = roi.getBounds5D();
posX.setValue(Double.valueOf(bounds.getX()));
posY.setValue(Double.valueOf(bounds.getY()));
posZ.setValue(Double.valueOf(bounds.getZ()));
posT.setValue(Double.valueOf(bounds.getT()));
posC.setValue(Double.valueOf(bounds.getC()));
posXCenter.setValue(Double.valueOf(bounds.getCenterX()));
posYCenter.setValue(Double.valueOf(bounds.getCenterY()));
posZCenter.setValue(Double.valueOf(bounds.getCenterZ()));
posX.setValue(Double.valueOf(pos.getX()));
posY.setValue(Double.valueOf(pos.getY()));
posZ.setValue(Double.valueOf(pos.getZ()));
posT.setValue(Double.valueOf(pos.getT()));
posC.setValue(Double.valueOf(pos.getC()));
// stop here
break;
}
......@@ -61,6 +69,10 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
outputMap.add("posZ", posZ);
outputMap.add("posT", posT);
outputMap.add("posC", posC);
outputMap.add("posXCenter", posXCenter);
outputMap.add("posYCenter", posYCenter);
outputMap.add("posZCenter", posZCenter);
}
@Override
......@@ -68,4 +80,4 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
{
return RoiBlocks.class.getName();
}
}
\ No newline at end of file
}
......@@ -8,8 +8,11 @@ import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.type.point.Point5D;
import icy.type.point.Point5D.Double;
import icy.type.rectangle.Rectangle5D;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarBoolean;
import plugins.adufour.vars.lang.VarDouble;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
......@@ -27,16 +30,33 @@ public class SetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
protected VarDouble posZ = new VarDouble("position Z", -1d);
protected VarDouble posT = new VarDouble("position T", -1d);
protected VarDouble posC = new VarDouble("position C", -1d);
protected VarBoolean useCenter = new VarBoolean("Set XYZ Center", false);
@Override
public void run()
{
final Point5D pos = new Point5D.Double(posX.getValue().doubleValue(), posY.getValue().doubleValue(), posZ
.getValue().doubleValue(), posT.getValue().doubleValue(), posC.getValue().doubleValue());
final Point5D.Double pos = new Point5D.Double(posX.getValue().doubleValue(), posY.getValue().doubleValue(),
posZ.getValue().doubleValue(), posT.getValue().doubleValue(), posC.getValue().doubleValue());
for (ROI roi : roiSet)
{
if ((roi != null) && roi.canSetPosition())
roi.setPosition5D(pos);
{
if (useCenter.getValue().booleanValue())
{
Rectangle5D bounds = roi.getBounds5D();
Point5D.Double newPos = (Double) pos.clone();
newPos.setX(pos.getX() - bounds.getSizeX() / 2);
newPos.setY(pos.getY() - bounds.getSizeY() / 2);
newPos.setZ(pos.getZ() - bounds.getSizeZ() / 2);
roi.setPosition5D(newPos);
}
else
{
roi.setPosition5D(pos);
}
}
}
}
@Override
......@@ -48,6 +68,7 @@ public class SetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
inputMap.add("posZ", posZ);
inputMap.add("posT", posT);
inputMap.add("posC", posC);
inputMap.add("useXYZCenter", useCenter);
}
@Override
......@@ -61,4 +82,4 @@ public class SetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
{
return RoiBlocks.class.getName();
}
}
\ No newline at end of file
}
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