Commit ec798d56 authored by Stephane Dallongeville's avatar Stephane Dallongeville
Browse files

Initial commit from Eclipse project

Initial commit from Eclipse project.
Need to be mavenized
parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="var" path="ICY_PLUGINS/tprovoost/sequenceblocks/SequenceBlocks.jar"/>
<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_JAR"/>
<classpathentry kind="output" path="bin"/>
</classpath>
bin
pluginfile-roi-blocks*.jar
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RoiBlocks</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="RoiBlocks/RoiBlocks.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/RoiBlocks/export.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="true" manifestLocation="/Icy-Kernel/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
<javaElement handleIdentifier="=RoiBlocks/src"/>
</selectedElements>
</jardesc>
package plugins.stef.roi.bloc;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginLibrary;
/**
* Bundle of blocks (Protocols) to perform different operations on ROI (Region Of Interest).<br>
* <br>
* Supported operations:<br>
* <li>Create rectangular ROI (2D, 3D, 4D or 5D)</li><br>
* <li>Filter by size</li><br>
* <li>Perform boolean operation between two set of ROI</li><br>
* <li>Get / set ROI position</li><br>
* <li>Get / set ROI size</li><br>
* <li>Get / set ROI properties (name, color)</li><br>
* <br>
*
* @author stephane
*/
public class RoiBlocks extends Plugin implements PluginLibrary
{
//
}
package plugins.stef.roi.bloc.convert;
import java.util.ArrayList;
import java.util.List;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROI2D;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarInteger;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.adufour.vars.util.VarException;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input 2D ROIs to 3D stack ROI by stacking them along the Z axis.
*
* @author Stephane
*/
public class ROITo3DStack extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarInteger sizeZ;
protected final VarROIArray output;
public ROITo3DStack()
{
super();
input = new VarROIArray("Roi(s)");
sizeZ = new VarInteger("Size Z", 10);
output = new VarROIArray("3D stack roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final List<ROI> result = new ArrayList<ROI>();
if (rois != null)
{
final int maxZ = sizeZ.getValue().intValue() - 1;
if (maxZ < 0)
throw new VarException(sizeZ, "Size Z field should be > 0");
for (ROI roi : rois)
{
// only convert 2D roi
if (roi instanceof ROI2D)
result.add(ROIUtil.convertToStack((ROI2D) roi, 0, maxZ));
else
// otherwise we add them directly to the result
result.add(roi);
}
}
output.setValue(result.toArray(new ROI[result.size()]));
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
inputMap.add("sizeZ", sizeZ);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
\ No newline at end of file
/**
*
*/
package plugins.stef.roi.bloc.convert;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarDouble;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input ROI(s) to 2D ellipse type ROI(s) centered on the mass center.<br>
*
* @author Stephane
*/
public class ROIToEllipse extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarDouble radiusX;
protected final VarDouble radiusY;
protected final VarROIArray output;
public ROIToEllipse()
{
super();
input = new VarROIArray("Roi(s)");
radiusX = new VarDouble("Radius X", 1d);
radiusY = new VarDouble("Radius Y", 1d);
output = new VarROIArray("Ellipse roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final ROI[] result = new ROI[(rois != null) ? rois.length : 0];
final double rx = radiusX.getValue().doubleValue();
final double ry = radiusY.getValue().doubleValue();
if (rois != null)
{
for (int r = 0; r < rois.length; r++)
result[r] = ROIUtil.convertToEllipse(rois[r], rx, ry);
}
output.setValue(result);
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
inputMap.add("radiusX", radiusX);
inputMap.add("radiuxY", radiusY);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
/**
*
*/
package plugins.stef.roi.bloc.convert;
import java.util.ArrayList;
import java.util.List;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input ROI(s) to (boolean) mask type ROI(s).<br>
* Only 2D ROI(s) are supported and conversion is done only if needed.
*
* @author Stephane
*/
public class ROIToMask extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarROIArray output;
public ROIToMask()
{
super();
input = new VarROIArray("Roi(s)");
output = new VarROIArray("Mask roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final List<ROI> result = new ArrayList<ROI>();
if (rois != null)
{
for (ROI roi : rois)
result.add(ROIUtil.convertToMask(roi));
}
output.setValue(result.toArray(new ROI[result.size()]));
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
/**
*
*/
package plugins.stef.roi.bloc.convert;
import java.util.ArrayList;
import java.util.List;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input ROI(s) to single point type ROI(s) representing the mass center.
*
* @author Stephane
*/
public class ROIToPoint extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarROIArray output;
public ROIToPoint()
{
super();
input = new VarROIArray("Roi(s)");
output = new VarROIArray("Point roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final List<ROI> result = new ArrayList<ROI>();
if (rois != null)
{
for (ROI roi : rois)
result.add(ROIUtil.convertToPoint(roi));
}
output.setValue(result.toArray(new ROI[result.size()]));
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
/**
*
*/
package plugins.stef.roi.bloc.convert;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarDouble;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input ROI(s) to 2D rectangle type ROI(s) centered on the mass center.<br>
*
* @author Stephane
*/
public class ROIToRectangle extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarDouble width;
protected final VarDouble height;
protected final VarROIArray output;
public ROIToRectangle()
{
super();
input = new VarROIArray("Roi(s)");
width = new VarDouble("Width", 1d);
height = new VarDouble("Height", 1d);
output = new VarROIArray("Rectangle roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final ROI[] result = new ROI[(rois != null) ? rois.length : 0];
final double w = width.getValue().doubleValue();
final double h = height.getValue().doubleValue();
if (rois != null)
{
for (int r = 0; r < rois.length; r++)
result[r] = ROIUtil.convertToRectangle(rois[r], w, h);
}
output.setValue(result);
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
inputMap.add("width", width);
inputMap.add("height", height);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
package plugins.stef.roi.bloc.convert;
import java.util.ArrayList;
import java.util.List;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROI;
import icy.roi.ROIUtil;
import plugins.adufour.blocks.tools.roi.ROIBlock;
import plugins.adufour.blocks.util.VarList;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block to convert input ROI(s) to shape type ROI(s).<br>
* Only 2D ROI(s) are supported and conversion is done only if needed.
*
* @author Stephane
*/
public class ROIToShape extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
protected final VarROIArray input;
protected final VarROIArray output;
public ROIToShape()
{
super();
input = new VarROIArray("Roi(s)");
output = new VarROIArray("Shape roi(s)");
}
@Override
public void run()
{
final ROI[] rois = input.getValue();
final List<ROI> result = new ArrayList<ROI>();
if (rois != null)
{
for (ROI roi : rois)
result.add(ROIUtil.convertToShape(roi, -1));
}
output.setValue(result.toArray(new ROI[result.size()]));
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("input", input);
}
@Override
public void declareOutput(VarList outputMap)
{
outputMap.add("output", output);
}
@Override
public String getMainPluginClassName()
{
return RoiBlocks.class.getName();
}
}
package plugins.stef.roi.bloc.convert;
import icy.plugin.abstract_.Plugin;
import icy.plugin.interface_.PluginBundled;
import icy.plugin.interface_.PluginLibrary;
import icy.roi.ROIUtil;
import icy.type.DataType;
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.VarDouble;
import plugins.adufour.vars.lang.VarEnum;
import plugins.adufour.vars.lang.VarInteger;
import plugins.adufour.vars.lang.VarROIArray;
import plugins.adufour.vars.lang.VarSequence;
import plugins.stef.roi.bloc.RoiBlocks;
/**
* Block (Protocols) to convert ROI(s) (Region Of Interest) into a binary image / sequence.<br>
* <br>
* It takes a ROI (or a list of ROI) as input and generate a binary sequence from it.<br/>
* The content of the ROI area is filled with the specified value while background remains at 0.<br/>
* Size informations are used to define the dimension of the output sequence, a value of 0 indicate
* to use the ROI dimension instead.
*
* @author Stephane
*/
public class RoiToSequence extends Plugin implements ROIBlock, PluginLibrary, PluginBundled
{
final VarROIArray inputROI;
final VarInteger sizeX;
final VarInteger sizeY;
final VarInteger sizeC;
final VarInteger sizeZ;
final VarInteger sizeT;
final VarEnum<DataType> dataType;
final VarDouble fillValue;
final VarBoolean labeled;
final VarSequence varOut;
public RoiToSequence()
{
super();
inputROI = new VarROIArray("ROI(s)");
sizeX = new VarInteger("Size X", 0);
sizeY = new VarInteger("Size Y", 0);
sizeC = new VarInteger("Size C", 1);
sizeZ = new VarInteger("Size Z", 1);
sizeT = new VarInteger("Size T", 1);
dataType = new VarEnum<DataType>("Data type", DataType.UBYTE);
fillValue = new VarDouble("Fill value", 255.0);
labeled = new VarBoolean("Labeled", Boolean.FALSE);
varOut = new VarSequence("Sequence", null);
}
@Override
public void declareInput(VarList inputMap)
{
inputMap.add("rois", inputROI);
inputMap.add("sizeX", sizeX);
inputMap.add("sizeY", sizeY);
inputMap.add("sizeC", sizeC);
inputMap.add("sizeZ", sizeZ);
inputMap.add("sizeT", sizeT);
inputMap.add("dataType", dataType);
// inputMap.add("fillValue", fillValue);
inputMap.add("labeled", labeled);