diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java index f227dcdf5f39c9831fca6562ccaf1e5788b66547..763ccaa66f8f588bbfdb8c9077948077494654e1 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceChannelBatch.java @@ -17,15 +17,10 @@ import plugins.tprovoost.sequenceblocks.SequenceBlocks; */ public class SequenceChannelBatch extends Batch implements SequenceBlock, PluginLibrary, PluginBundled { - // important to not initialize 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; - public SequenceChannelBatch() - { - super(); - } - @Override public VarSequence getBatchSource() { diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterBatch.java index 134d9af71ed8971b8503e86dc944698a857de19c..48ef8fb78bc0c06d0580986a67f365c3b701a6e0 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterBatch.java @@ -21,22 +21,13 @@ import plugins.tprovoost.sequenceblocks.importer.PositionedSequenceFileImporter; */ public abstract class SequenceFileImporterBatch extends Batch implements SequenceBlock, PluginLibrary, PluginBundled { - // important to not initialize and create them in getBatchSource() and getBatchElement() - protected Var<PositionedSequenceFileImporter> positionedImporter = null; - protected Var<PositionedSequenceFileImporter> element = null; - protected VarInteger series = null; + // important to not initialize here (even with null) and create them in getBatchSource() and getBatchElement() + protected Var<PositionedSequenceFileImporter> positionedImporter; + protected Var<PositionedSequenceFileImporter> element; + protected VarInteger series; // internal protected int limit; - protected boolean showSeriesField; - - public SequenceFileImporterBatch() - { - super(); - - // we want it by default - showSeriesField = true; - } @Override public Var<PositionedSequenceFileImporter> getBatchSource() @@ -75,15 +66,11 @@ public abstract class SequenceFileImporterBatch extends Batch implements Sequenc // create new positioned importer for element initialization final PositionedSequenceFileImporter pi = new PositionedSequenceFileImporter(value); - // series field active ? - if (showSeriesField) - { - final int s = series.getValue().intValue(); + final int s = series.getValue().intValue(); - // defined series ? --> set series position - if (s != -1) - pi.s = s; - } + // defined series ? --> set series position + if (s != -1) + pi.s = s; // init element with a copy of current positioned importer (and eventually set serie position) element.setValue(pi); @@ -94,30 +81,24 @@ public abstract class SequenceFileImporterBatch extends Batch implements Sequenc { super.declareInput(inputMap); - if (showSeriesField) - { - // lazy creation - if (series == null) - series = new VarInteger("Series", -1); + // lazy creation + if (series == null) + series = new VarInteger("Series", -1); - inputMap.add("series", series); - } + inputMap.add("series", series); } @Override public void declareLoopVariables(List<Var<?>> loopVariables) { - if (showSeriesField) - { - // lazy creation - if (series == null) - series = new VarInteger("Series", -1); - - loopVariables.add(series); - } - // need to be called after super.declareLoopVariables(loopVariables); + + // lazy creation + if (series == null) + series = new VarInteger("Series", -1); + + loopVariables.add(series); } @Override diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterRegionBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterRegionBatch.java index 98ab352ebf2a023456d4109e83fe45150b073fc6..05f05183d8836780a5e821f1701ded158786fcc3 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterRegionBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterRegionBatch.java @@ -24,9 +24,10 @@ import plugins.tprovoost.sequenceblocks.importer.PositionedSequenceFileImporter; */ public class SequenceFileImporterRegionBatch extends SequenceFileImporterBatch { - protected VarROIArray rois = null; - protected VarInteger inputRoisResolution = null; - protected VarInteger inputRoisMargin = null; + // important to not initialize here (even with null) and create them in getBatchSource() and getBatchElement() + protected VarROIArray rois; + protected VarInteger inputRoisResolution; + protected VarInteger inputRoisMargin; protected List<Rectangle> regions; @Override @@ -115,6 +116,8 @@ public class SequenceFileImporterRegionBatch extends SequenceFileImporterBatch @Override public void declareLoopVariables(List<Var<?>> loopVariables) { + super.declareLoopVariables(loopVariables); + // lazy creation if (rois == null) rois = new VarROIArray("XY regions (ROIs)"); @@ -126,8 +129,6 @@ public class SequenceFileImporterRegionBatch extends SequenceFileImporterBatch loopVariables.add(rois); loopVariables.add(inputRoisResolution); loopVariables.add(inputRoisMargin); - - super.declareLoopVariables(loopVariables); } @Override diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterSeriesBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterSeriesBatch.java index c08970f3bfc25a3dabeae22bd5489de1ab988f26..ffb8e57b7eec5d8a0c220be797cf52e763cae911 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterSeriesBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterSeriesBatch.java @@ -1,7 +1,11 @@ package plugins.tprovoost.sequenceblocks.loop; +import java.util.List; + import icy.file.SequenceFileImporter; import icy.sequence.MetaDataUtil; +import plugins.adufour.blocks.util.VarList; +import plugins.adufour.vars.lang.Var; import plugins.adufour.vars.util.VarException; import plugins.tprovoost.sequenceblocks.importer.PositionedSequenceFileImporter; @@ -12,14 +16,6 @@ import plugins.tprovoost.sequenceblocks.importer.PositionedSequenceFileImporter; */ public class SequenceFileImporterSeriesBatch extends SequenceFileImporterBatch { - public SequenceFileImporterSeriesBatch() - { - super(); - - // add series field here - showSeriesField = false; - } - @Override public void initializeLoop() { @@ -43,6 +39,24 @@ public class SequenceFileImporterSeriesBatch extends SequenceFileImporterBatch } } + @Override + public void declareInput(VarList inputMap) + { + super.declareInput(inputMap); + + // we don't want it here + inputMap.remove(series); + } + + @Override + public void declareLoopVariables(List<Var<?>> loopVariables) + { + super.declareLoopVariables(loopVariables); + + // we don't want it here + loopVariables.remove(series); + } + @Override public void beforeIteration() { diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterTileBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterTileBatch.java index b831e80c1a090fc5333e150300b372bf4caf1827..fa0d9a6c00dace230ca1deef310a6f4becdd000b 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterTileBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFileImporterTileBatch.java @@ -20,6 +20,7 @@ import plugins.tprovoost.sequenceblocks.importer.PositionedSequenceFileImporter; */ public class SequenceFileImporterTileBatch extends SequenceFileImporterBatch { + // important to not initialize here (even with null) and create them in getBatchSource() and getBatchElement() protected VarInteger tileW; protected VarInteger tileH; @@ -103,6 +104,9 @@ public class SequenceFileImporterTileBatch extends SequenceFileImporterBatch @Override public void declareLoopVariables(List<Var<?>> loopVariables) { + // need to be called after + super.declareLoopVariables(loopVariables); + // lazy creation if (tileW == null) tileW = new VarInteger("Tile width (-1 = auto)", 0); @@ -111,9 +115,6 @@ public class SequenceFileImporterTileBatch extends SequenceFileImporterBatch loopVariables.add(tileW); loopVariables.add(tileH); - - // need to be called after - super.declareLoopVariables(loopVariables); } @Override diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFrameBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFrameBatch.java index d06b0a6c91a7b520f7eb72e5bdeb9e26a14cf6e2..cacc7290d9db5c40a8311ea1cd5f37416ce698f3 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceFrameBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceFrameBatch.java @@ -16,7 +16,7 @@ import plugins.tprovoost.sequenceblocks.SequenceBlocks; */ public class SequenceFrameBatch extends Batch implements PluginLibrary, PluginBundled { - // important to not initialize 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; diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java index 548ba91b6ad96f97bda809d1c73ab7538d72fd88..dd539a3bd66f0f44ec1a1eaa5206f6e734804ac8 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java @@ -22,7 +22,7 @@ import plugins.tprovoost.sequenceblocks.SequenceBlocks; */ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginLibrary, PluginBundled { - // important to not initialize 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 final VarROIArray rois; diff --git a/src/plugins/tprovoost/sequenceblocks/loop/SequenceSliceBatch.java b/src/plugins/tprovoost/sequenceblocks/loop/SequenceSliceBatch.java index 4a0440a7b96052163ea9f147b768379c7330620b..0386775743c39f9960d4fa7994a48f3f34bccac2 100644 --- a/src/plugins/tprovoost/sequenceblocks/loop/SequenceSliceBatch.java +++ b/src/plugins/tprovoost/sequenceblocks/loop/SequenceSliceBatch.java @@ -17,7 +17,7 @@ import plugins.tprovoost.sequenceblocks.SequenceBlocks; */ public class SequenceSliceBatch extends Batch implements SequenceBlock, PluginLibrary, PluginBundled { - // important to not initialize 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;