Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Sequence Blocks
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bioimage Analysis
Sequence Blocks
Commits
34bdfc35
Commit
34bdfc35
authored
4 years ago
by
Daniel Felipe GONZALEZ OBANDO
Browse files
Options
Downloads
Patches
Plain Diff
Fix for sequence region batch: null pointer exception on declare input
parent
4f921d9c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java
+28
-18
28 additions, 18 deletions
...ns/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java
with
28 additions
and
18 deletions
src/plugins/tprovoost/sequenceblocks/loop/SequenceRegionBatch.java
+
28
−
18
View file @
34bdfc35
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
icy.plugin.interface_.PluginBundled
;
import
icy.plugin.interface_.PluginBundled
;
import
icy.plugin.interface_.PluginLibrary
;
import
icy.plugin.interface_.PluginLibrary
;
import
icy.roi.ROI
;
import
icy.sequence.Sequence
;
import
icy.sequence.Sequence
;
import
icy.sequence.SequenceUtil
;
import
icy.sequence.SequenceUtil
;
import
plugins.adufour.blocks.lang.Batch
;
import
plugins.adufour.blocks.lang.Batch
;
...
@@ -25,35 +26,51 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
...
@@ -25,35 +26,51 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
// 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
inputSequence
;
protected
VarSequence
element
;
protected
VarSequence
element
;
protected
final
VarROIArray
rois
;
protected
VarROIArray
rois
;
protected
VarROIArray
currentRoi
;
public
SequenceRegionBatch
()
public
SequenceRegionBatch
()
{
{
super
();
super
();
}
rois
=
new
VarROIArray
(
"ROI(s)"
);
@Override
public
VarROIArray
getBatchSource
()
{
if
(
rois
==
null
)
rois
=
new
VarROIArray
(
"ROI(s)"
);
return
rois
;
}
}
@Override
@Override
public
VarSequence
getBatchSource
(
)
public
void
declareInput
(
VarList
inputMap
)
{
{
// initialize variable if needed
super
.
declareInput
(
inputMap
);
if
(
inputSequence
==
null
)
if
(
inputSequence
==
null
)
inputSequence
=
new
VarSequence
(
"Sequence"
,
null
);
inputSequence
=
new
VarSequence
(
"Sequence"
,
null
);
return
inputSequence
;
inputMap
.
add
(
inputSequence
.
getName
(),
inputSequence
)
;
}
}
@Override
@Override
public
VarSequence
getBatchElement
()
public
VarSequence
getBatchElement
()
{
{
// initialize element if needed
if
(
element
==
null
)
if
(
element
==
null
)
element
=
new
VarSequence
(
"Channel Sequence"
,
null
);
element
=
new
VarSequence
(
"Channel Sequence"
,
null
);
return
element
;
return
element
;
}
}
@Override
public
void
declareOutput
(
VarList
outputMap
)
{
super
.
declareOutput
(
outputMap
);
if
(
currentRoi
==
null
)
currentRoi
=
new
VarROIArray
(
"Current ROI"
);
outputMap
.
add
(
currentRoi
.
getName
(),
currentRoi
);
}
@Override
@Override
public
void
initializeLoop
()
public
void
initializeLoop
()
{
{
...
@@ -70,8 +87,9 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
...
@@ -70,8 +87,9 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
public
void
beforeIteration
()
public
void
beforeIteration
()
{
{
// set result in element
// set result in element
element
.
setValue
(
SequenceUtil
.
getSubSequence
(
inputSequence
.
getValue
(),
ROI
roi
=
rois
.
getValue
()[
getIterationCounter
().
getValue
().
intValue
()];
rois
.
getValue
()[
getIterationCounter
().
getValue
().
intValue
()]));
element
.
setValue
(
SequenceUtil
.
getSubSequence
(
inputSequence
.
getValue
(),
roi
));
currentRoi
.
setValue
(
new
ROI
[]
{
roi
});
}
}
@Override
@Override
...
@@ -80,20 +98,12 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
...
@@ -80,20 +98,12 @@ public class SequenceRegionBatch extends Batch implements SequenceBlock, PluginL
return
getIterationCounter
().
getValue
().
intValue
()
>=
rois
.
getValue
().
length
;
return
getIterationCounter
().
getValue
().
intValue
()
>=
rois
.
getValue
().
length
;
}
}
@Override
public
void
declareInput
(
VarList
inputMap
)
{
super
.
declareInput
(
inputMap
);
inputMap
.
add
(
"ROIs"
,
rois
);
}
@Override
@Override
public
void
declareLoopVariables
(
List
<
Var
<?>>
loopVariables
)
public
void
declareLoopVariables
(
List
<
Var
<?>>
loopVariables
)
{
{
super
.
declareLoopVariables
(
loopVariables
);
super
.
declareLoopVariables
(
loopVariables
);
loopVariables
.
add
(
inputSequence
);
loopVariables
.
add
(
r
oi
s
);
loopVariables
.
add
(
currentR
oi
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment