Skip to content
Snippets Groups Projects
Commit dc1dae88 authored by Stéphane  DALLONGEVILLE's avatar Stéphane DALLONGEVILLE
Browse files

Updated for Icy kernel 2.4.0 (interruptible process)

parent d1d52fbd
No related branches found
No related tags found
No related merge requests found
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.bioimageanalysis.icy</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<artifactId>parent-pom-plugin</artifactId> <artifactId>parent-pom-plugin</artifactId>
<version>1.0.1</version> <version>1.0.6</version>
</parent> </parent>
<artifactId>connected-components</artifactId> <artifactId>connected-components</artifactId>
<version>4.8.7</version> <version>4.8.8</version>
<packaging>jar</packaging> <packaging>jar</packaging>
......
...@@ -631,12 +631,17 @@ public class ConnectedComponent extends Detection implements Iterable<Point3i> ...@@ -631,12 +631,17 @@ public class ConnectedComponent extends Detection implements Iterable<Point3i>
/** /**
* Paints this component onto the given sequence with the specified value * Paints this component onto the given sequence with the specified value
* *
* @param s Sequence * @param s
* @param t int * Sequence
* @param c int * @param t
* @param value double * int
*/ * @param c
public void paintOnSequence(Sequence s, int t, int c, double value) * int
* @param value
* double
* @throws InterruptedException
*/
public void paintOnSequence(Sequence s, int t, int c, double value) throws InterruptedException
{ {
DataIteratorUtil.set(new SequenceDataIterator(s, toROI(), true, -1, t, c), value); DataIteratorUtil.set(new SequenceDataIterator(s, toROI(), true, -1, t, c), value);
} }
......
...@@ -14,6 +14,7 @@ import javax.vecmath.Point3i; ...@@ -14,6 +14,7 @@ import javax.vecmath.Point3i;
import javax.vecmath.Point4d; import javax.vecmath.Point4d;
import icy.file.FileUtil; import icy.file.FileUtil;
import icy.gui.frame.progress.FailedAnnounceFrame;
import icy.image.IcyBufferedImage; import icy.image.IcyBufferedImage;
import icy.image.colormap.FireColorMap; import icy.image.colormap.FireColorMap;
import icy.main.Icy; import icy.main.Icy;
...@@ -268,28 +269,36 @@ public class ConnectedComponents extends EzPlug implements Block ...@@ -268,28 +269,36 @@ public class ConnectedComponents extends EzPlug implements Block
// never remove objects touching the Z edge in 2D (that would remove... everything!) // never remove objects touching the Z edge in 2D (that would remove... everything!)
boolean discardEdgesAlongZ = (inputSequence.getSizeZ() > 1 && discardEdgesZ.getValue()); boolean discardEdgesAlongZ = (inputSequence.getSizeZ() > 1 && discardEdgesZ.getValue());
if (extractionMethod.getValue() == ExtractionType.ROI) try
{ {
int width = inputSequence.getWidth(); if (extractionMethod.getValue() == ExtractionType.ROI)
int height = inputSequence.getHeight(); {
int width = inputSequence.getWidth();
int height = inputSequence.getHeight();
Sequence labeledSequence = new Sequence(inputSequence.getMetadata()); Sequence labeledSequence = new Sequence(inputSequence.getMetadata());
for (int t = 0; t < inputSequence.getSizeT(); t++) for (int t = 0; t < inputSequence.getSizeT(); t++)
for (int z = 0; z < inputSequence.getSizeZ(); z++) for (int z = 0; z < inputSequence.getSizeZ(); z++)
labeledSequence.setImage(t, z, new IcyBufferedImage(width, height, 1, DataType.USHORT)); labeledSequence.setImage(t, z, new IcyBufferedImage(width, height, 1, DataType.USHORT));
short cpt = 1; short cpt = 1;
for (ROI roi : inputSequence.getROIs()) for (ROI roi : inputSequence.getROIs())
DataIteratorUtil.set(new SequenceDataIterator(labeledSequence, roi, true), cpt++ & 0xffff); DataIteratorUtil.set(new SequenceDataIterator(labeledSequence, roi, true), cpt++ & 0xffff);
componentsMap = extractConnectedComponents(labeledSequence, 0, ExtractionType.BACKGROUND_LABELED, componentsMap = extractConnectedComponents(labeledSequence, 0, ExtractionType.BACKGROUND_LABELED,
discardEdgesX.getValue(), discardEdgesY.getValue(), discardEdgesAlongZ, min, max, output); discardEdgesX.getValue(), discardEdgesY.getValue(), discardEdgesAlongZ, min, max, output);
}
else
{
componentsMap = extractConnectedComponents(inputSequence, background.getValue(),
extractionMethod.getValue(), discardEdgesX.getValue(), discardEdgesY.getValue(),
discardEdgesAlongZ, min, max, output);
}
} }
else catch (InterruptedException e)
{ {
componentsMap = extractConnectedComponents(inputSequence, background.getValue(), new FailedAnnounceFrame(e.getMessage());
extractionMethod.getValue(), discardEdgesX.getValue(), discardEdgesY.getValue(), discardEdgesAlongZ, return;
min, max, output);
} }
outputSequence.setValue(output); outputSequence.setValue(output);
...@@ -1347,8 +1356,10 @@ public class ConnectedComponents extends EzPlug implements Block ...@@ -1347,8 +1356,10 @@ public class ConnectedComponents extends EzPlug implements Block
* *
* @param output * @param output
* a sequence of type INT * a sequence of type INT
* @param components Map of List of ConnectedComponent * @param components
* @param comparator Comparator of ConnectedComponents * Map of List of ConnectedComponent
* @param comparator
* Comparator of ConnectedComponents
*/ */
public static void createLabeledSequence(Sequence output, Map<Integer, List<ConnectedComponent>> components, public static void createLabeledSequence(Sequence output, Map<Integer, List<ConnectedComponent>> components,
Comparator<ConnectedComponent> comparator) Comparator<ConnectedComponent> comparator)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment