diff --git a/pom.xml b/pom.xml index d0774271531ef38d9ec150479ad3607b6d100032..d1ad26a89bba1bac6c8bed478fb2d87b5f160952 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ </parent> <artifactId>sequence-blocks</artifactId> - <version>2.1.0</version> + <version>2.1.1</version> <name>SequenceBlocks</name> diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertColor.java b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertColor.java index 3347c0383581322dec8dd49b53031d25eea44751..1e4cf5b0c13fdad0aba8fe99c43e190f15057255 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertColor.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertColor.java @@ -44,7 +44,14 @@ public class ConvertColor extends Plugin implements SequenceBlock, PluginBundled if (s == null) throw new VarException(EZseq, "Input sequence is null."); - varOut.setValue(convertColor(s, getImageType(EZtype.getValue()), EZlut.getValue())); + try + { + varOut.setValue(convertColor(s, getImageType(EZtype.getValue()), EZlut.getValue())); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override @@ -83,7 +90,7 @@ public class ConvertColor extends Plugin implements SequenceBlock, PluginBundled } } - public static Sequence convertColor(Sequence source, int imageType, LUT lut) + public static Sequence convertColor(Sequence source, int imageType, LUT lut) throws IllegalArgumentException, InterruptedException { final Sequence result = new Sequence(OMEUtil.createOMEXMLMetadata(source.getOMEXMLMetadata())); // image receiver diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertStack.java b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertStack.java index e7dbfdcaff0953815304a16d920bcecffe335b6a..7eae544ad6eb2f68596852a2e2574f99c4a5518c 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertStack.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertStack.java @@ -5,6 +5,7 @@ import icy.plugin.interface_.PluginBundled; import icy.sequence.Sequence; import icy.sequence.SequenceUtil; import plugins.adufour.blocks.tools.sequence.SequenceBlock; +import plugins.adufour.blocks.util.BlocksException; import plugins.adufour.blocks.util.VarList; import plugins.adufour.vars.lang.VarEnum; import plugins.adufour.vars.lang.VarSequence; @@ -32,13 +33,20 @@ public class ConvertStack extends Plugin implements SequenceBlock, PluginBundled if (in == null) throw new VarException(inputSequence, "Input sequence is null."); - // create a copy as we don't want to modify input - Sequence out = SequenceUtil.getCopy(in); - if (type.getValue() == TypeConversion.TIME) - SequenceUtil.convertToTime(out); - else - SequenceUtil.convertToStack(out); - outputSequence.setValue(out); + try + { + // create a copy as we don't want to modify input + Sequence out = SequenceUtil.getCopy(in); + if (type.getValue() == TypeConversion.TIME) + SequenceUtil.convertToTime(out); + else + SequenceUtil.convertToStack(out); + outputSequence.setValue(out); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertType.java b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertType.java index 0ec910c079fb9de5b9768bfaf77ce9a819140c9a..48a11a4eba8e5bfc9afbdd330f2f279334eb2d80 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertType.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/convert/ConvertType.java @@ -31,7 +31,14 @@ public class ConvertType extends Plugin implements SequenceBlock, PluginLibrary, if (s == null) throw new VarException(inputSequence, "Input sequence is null."); - outputSequence.setValue(SequenceUtil.convertToType(s, type.getValue(), rescale.getValue().booleanValue())); + try + { + outputSequence.setValue(SequenceUtil.convertToType(s, type.getValue(), rescale.getValue().booleanValue())); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/creation/DuplicateSequence.java b/src/main/java/plugins/tprovoost/sequenceblocks/creation/DuplicateSequence.java index 3379d9d69b177f8b4042ec975f642ec13eb76161..dec05da26bbdd55487d7c58ee7227eb40d420e5f 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/creation/DuplicateSequence.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/creation/DuplicateSequence.java @@ -25,7 +25,15 @@ public class DuplicateSequence extends Plugin implements SequenceBlock, PluginLi Sequence s = in.getValue(); if (s == null) throw new VarException(in, "Input Sequence is null."); - out.setValue(SequenceUtil.getCopy(s)); + + try + { + out.setValue(SequenceUtil.getCopy(s)); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/extract/CropSequence.java b/src/main/java/plugins/tprovoost/sequenceblocks/extract/CropSequence.java index 8379e58ac9ea4c6463923fd0a91c39de50fc4176..334444f25fd17bcae0c3f62418077fbfb0d6bd5e 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/extract/CropSequence.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/extract/CropSequence.java @@ -58,9 +58,16 @@ public class CropSequence extends Plugin implements SequenceBlock, PluginLibrary else rois = CollectionUtil.asList((ROI[]) obj); - final ROI roi = ROIUtil.merge(rois, BooleanOperator.OR); + try + { + final ROI roi = ROIUtil.merge(rois, BooleanOperator.OR); - outputSequence.setValue(SequenceUtil.getSubSequence(s, roi)); + outputSequence.setValue(SequenceUtil.getSubSequence(s, roi)); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractChannel.java b/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractChannel.java index 4ed5c38a906119a45c9443916dcbc0f64b407303..e977e82b733422edd3c95fb6a90dbe06c8065290 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractChannel.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractChannel.java @@ -32,10 +32,17 @@ public class ExtractChannel extends Plugin implements SequenceBlock, PluginLibra if (channel < 0 || channel >= s.getSizeC()) throw new VarException(channelIdx, "Channel index must be between 0 and " + (s.getSizeC() - 1)); - final Sequence res = SequenceUtil.extractChannel(s, channelIdx.getValue().intValue()); - res.setName(s.getName() + " - channel: " + channelIdx.getValue()); + try + { + final Sequence res = SequenceUtil.extractChannel(s, channelIdx.getValue().intValue()); + res.setName(s.getName() + " - channel: " + channelIdx.getValue()); - outputSequence.setValue(res); + outputSequence.setValue(res); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractMultiChannels.java b/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractMultiChannels.java index 56f892e270db6be695126a830ba2288a3c6fd34c..79d6acaef733c9c608929b79a6ff6a73299820fe 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractMultiChannels.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/extract/ExtractMultiChannels.java @@ -27,9 +27,17 @@ public class ExtractMultiChannels extends Plugin implements SequenceBlock, Plugi Sequence s = inputSequence.getValue(); if (s == null) throw new VarException(inputSequence, "Input sequence is null."); - Sequence res = SequenceUtil.extractChannels(s, channelIdx.getValue()); - res.setName(s.getName() + " - channel: " + channelIdx.getValue()); - outputSequence.setValue(res); + + try + { + Sequence res = SequenceUtil.extractChannels(s, channelIdx.getValue()); + res.setName(s.getName() + " - channel: " + channelIdx.getValue()); + outputSequence.setValue(res); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/importer/PositionedSequenceFileImporter.java b/src/main/java/plugins/tprovoost/sequenceblocks/importer/PositionedSequenceFileImporter.java index 75a25a734560b0e221fe3677d94ec14f70b49e26..946af7486e324c2f8213daf9b19143097fc10af7 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/importer/PositionedSequenceFileImporter.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/importer/PositionedSequenceFileImporter.java @@ -52,7 +52,7 @@ public class PositionedSequenceFileImporter positionedImporter.z, positionedImporter.c, positionedImporter.xyRegion); } - public OMEXMLMetadata getMetadata() throws UnsupportedFormatException, IOException + public OMEXMLMetadata getMetadata() throws UnsupportedFormatException, IOException, InterruptedException { // not yet defined --> take it from importer if possible if ((metadata == null) && (importer.getOpened() != null)) diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java b/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java index 763ccaa66f8f588bbfdb8c9077948077494654e1..ed0dbe83e0cd7f0438646f08fe78cc824c2804b2 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java @@ -53,9 +53,15 @@ public class SequenceChannelBatch extends Batch implements SequenceBlock, Plugin @Override public void beforeIteration() { - // set result in element - element.setValue( - SequenceUtil.extractChannel(inputSequence.getValue(), getIterationCounter().getValue().intValue())); + try + { + // set result in element + element.setValue(SequenceUtil.extractChannel(inputSequence.getValue(), getIterationCounter().getValue().intValue())); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java b/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java index 8da2ca75f2ca365b38448eb7ce954ec39b108bb5..99fc20a5e43b3639637ce1bd980146ffb82fe318 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java @@ -23,7 +23,7 @@ import plugins.tprovoost.sequenceblocks.SequenceBlocks; */ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginLibrary, PluginBundled { - // important to not initialize here (even with null) and create them in getBatchSource() and getBatchElement() + // important to not initialize here (even with null) and create them in getBatchSource() and getBatchElement() protected VarSequence inputSequence; protected VarSequence element; protected VarROIArray rois; @@ -91,9 +91,16 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL { // set result in element final ROI roi = rois.getValue()[getIterationCounter().getValue().intValue()]; - - element.setValue(SequenceUtil.getSubSequence(inputSequence.getValue(), roi)); - currentRoi.setValue(new ROI[] {roi}); + + try + { + element.setValue(SequenceUtil.getSubSequence(inputSequence.getValue(), roi)); + currentRoi.setValue(new ROI[] {roi}); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/op/AdditiveFillSequence.java b/src/main/java/plugins/tprovoost/sequenceblocks/op/AdditiveFillSequence.java index ec957c70ac0a0a08c7a85c7a221d0a5d52030143..2ed300e28c10eb0f6430699fe8eb1d21633c424c 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/op/AdditiveFillSequence.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/op/AdditiveFillSequence.java @@ -36,21 +36,28 @@ public class AdditiveFillSequence extends Plugin implements SequenceBlock, Plugi if (sequence == null) throw new VarException(inputSequence, "Input sequence is null."); - if (rois.getValue() != null) + try { - for (ROI roi : rois.getValue()) - doAdditiveFill(sequence, roi, 1d); + if (rois.getValue() != null) + { + for (ROI roi : rois.getValue()) + doAdditiveFill(sequence, roi, 1d); - sequence.dataChanged(); + sequence.dataChanged(); + } + } + catch (InterruptedException e) + { + // nothing to do } } - public static void doAdditiveFill(Sequence sequence, ROI roi, double value) + public static void doAdditiveFill(Sequence sequence, ROI roi, double value) throws InterruptedException { doAdditiveFill(new SequenceDataIterator(sequence, roi), value); } - public static void doAdditiveFill(DataIterator it, double value) + public static void doAdditiveFill(DataIterator it, double value) throws InterruptedException { it.reset(); diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/op/FillInnerSequence.java b/src/main/java/plugins/tprovoost/sequenceblocks/op/FillInnerSequence.java index 39c7c63ee2de233e5ddee6c3454eb67caf67e002..7dc0f4532a78ea1ea67d9f3e277f62b8b2679a6d 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/op/FillInnerSequence.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/op/FillInnerSequence.java @@ -36,14 +36,21 @@ public class FillInnerSequence extends Plugin implements SequenceBlock, PluginLi if (sequence == null) throw new VarException(inputSequence, "Input sequence is null."); - if (rois.getValue() != null) + try { - final double value = fillValue.getValue().doubleValue(); + if (rois.getValue() != null) + { + final double value = fillValue.getValue().doubleValue(); - for (ROI roi : rois.getValue()) - DataIteratorUtil.set(new SequenceDataIterator(sequence, roi), value); + for (ROI roi : rois.getValue()) + DataIteratorUtil.set(new SequenceDataIterator(sequence, roi), value); - sequence.dataChanged(); + sequence.dataChanged(); + } + } + catch (InterruptedException e) + { + // nothing to do } } diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/op/FillOuterSequence.java b/src/main/java/plugins/tprovoost/sequenceblocks/op/FillOuterSequence.java index 7e3faea781fd71a5675b3b2af8afefbbdeebda37..89d47ed586789e15bb70aeb34377d0307e38d9a8 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/op/FillOuterSequence.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/op/FillOuterSequence.java @@ -40,25 +40,32 @@ public class FillOuterSequence extends Plugin implements SequenceBlock, PluginLi if (sequence == null) throw new VarException(inputSequence, "Input sequence is null."); - if (rois.getValue() != null) + try { - try + if (rois.getValue() != null) { - final ROI roiUnion = ROIUtil.merge(CollectionUtil.asList(rois.getValue()), BooleanOperator.OR); - final ROI roiSeq = new ROI5DStackRectangle(sequence.getBounds5D()); - final ROI roi = roiSeq.getSubtraction(roiUnion); + try + { + final ROI roiUnion = ROIUtil.merge(CollectionUtil.asList(rois.getValue()), BooleanOperator.OR); + final ROI roiSeq = new ROI5DStackRectangle(sequence.getBounds5D()); + final ROI roi = roiSeq.getSubtraction(roiUnion); - final double value = fillValue.getValue().doubleValue(); + final double value = fillValue.getValue().doubleValue(); - DataIteratorUtil.set(new SequenceDataIterator(sequence, roi), value); + DataIteratorUtil.set(new SequenceDataIterator(sequence, roi), value); - sequence.dataChanged(); - } - catch (UnsupportedOperationException e) - { - throw new VarException(rois, e.getMessage()); + sequence.dataChanged(); + } + catch (UnsupportedOperationException e) + { + throw new VarException(rois, e.getMessage()); + } } } + catch (InterruptedException e) + { + // nothing to do + } } @Override diff --git a/src/main/java/plugins/tprovoost/sequenceblocks/remove/RemoveChannel.java b/src/main/java/plugins/tprovoost/sequenceblocks/remove/RemoveChannel.java index 946b5cbc21e7dfffa7e3c27a32ae1b5a9c9c3342..2fb63bfa7f979377579ecc37608f9e19390bab4e 100644 --- a/src/main/java/plugins/tprovoost/sequenceblocks/remove/RemoveChannel.java +++ b/src/main/java/plugins/tprovoost/sequenceblocks/remove/RemoveChannel.java @@ -35,7 +35,14 @@ public class RemoveChannel extends Plugin implements SequenceBlock, PluginLibrar if (channel < 0 || channel >= s.getSizeC()) throw new VarException(channelIdx, "Channel index must be between 0 and " + (s.getSizeC() - 1)); - SequenceUtil.removeChannel(s, channel); + try + { + SequenceUtil.removeChannel(s, channel); + } + catch (InterruptedException e) + { + // nothing to do + } } @Override