Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bioimage Analysis
ROI blocks
Commits
d93dc65d
Commit
d93dc65d
authored
Aug 18, 2020
by
Daniel Felipe GONZALEZ OBANDO
Browse files
Get and set position allow to use ROI center position
parent
199d07ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/stef/roi/bloc/property/GetROIPosition.java
View file @
d93dc65d
...
...
@@ -5,6 +5,7 @@ import icy.plugin.interface_.PluginBundled;
import
icy.plugin.interface_.PluginLibrary
;
import
icy.roi.ROI
;
import
icy.type.point.Point5D
;
import
icy.type.rectangle.Rectangle5D
;
import
plugins.adufour.blocks.tools.roi.ROIBlock
;
import
plugins.adufour.blocks.util.VarList
;
import
plugins.adufour.vars.lang.VarDouble
;
...
...
@@ -26,6 +27,10 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
protected
VarDouble
posT
=
new
VarDouble
(
"position T"
,
0
d
);
protected
VarDouble
posC
=
new
VarDouble
(
"position C"
,
0
d
);
protected
VarDouble
posXCenter
=
new
VarDouble
(
"position X(center)"
,
0
d
);
protected
VarDouble
posYCenter
=
new
VarDouble
(
"position Y(center)"
,
0
d
);
protected
VarDouble
posZCenter
=
new
VarDouble
(
"position Z(center)"
,
0
d
);
@Override
public
void
run
()
{
...
...
@@ -33,14 +38,18 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
{
if
(
roi
!=
null
)
{
final
Point5D
pos
=
roi
.
getPosition5D
();
final
Rectangle5D
bounds
=
roi
.
getBounds5D
();
posX
.
setValue
(
Double
.
valueOf
(
bounds
.
getX
()));
posY
.
setValue
(
Double
.
valueOf
(
bounds
.
getY
()));
posZ
.
setValue
(
Double
.
valueOf
(
bounds
.
getZ
()));
posT
.
setValue
(
Double
.
valueOf
(
bounds
.
getT
()));
posC
.
setValue
(
Double
.
valueOf
(
bounds
.
getC
()));
posXCenter
.
setValue
(
Double
.
valueOf
(
bounds
.
getCenterX
()));
posYCenter
.
setValue
(
Double
.
valueOf
(
bounds
.
getCenterY
()));
posZCenter
.
setValue
(
Double
.
valueOf
(
bounds
.
getCenterZ
()));
posX
.
setValue
(
Double
.
valueOf
(
pos
.
getX
()));
posY
.
setValue
(
Double
.
valueOf
(
pos
.
getY
()));
posZ
.
setValue
(
Double
.
valueOf
(
pos
.
getZ
()));
posT
.
setValue
(
Double
.
valueOf
(
pos
.
getT
()));
posC
.
setValue
(
Double
.
valueOf
(
pos
.
getC
()));
// stop here
break
;
}
...
...
@@ -61,6 +70,10 @@ public class GetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
outputMap
.
add
(
"posZ"
,
posZ
);
outputMap
.
add
(
"posT"
,
posT
);
outputMap
.
add
(
"posC"
,
posC
);
outputMap
.
add
(
"posXCenter"
,
posXCenter
);
outputMap
.
add
(
"posYCenter"
,
posYCenter
);
outputMap
.
add
(
"posZCenter"
,
posZCenter
);
}
@Override
...
...
src/plugins/stef/roi/bloc/property/SetROIPosition.java
View file @
d93dc65d
...
...
@@ -8,8 +8,11 @@ import icy.plugin.interface_.PluginBundled;
import
icy.plugin.interface_.PluginLibrary
;
import
icy.roi.ROI
;
import
icy.type.point.Point5D
;
import
icy.type.point.Point5D.Double
;
import
icy.type.rectangle.Rectangle5D
;
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.VarROIArray
;
import
plugins.stef.roi.bloc.RoiBlocks
;
...
...
@@ -27,16 +30,33 @@ public class SetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
protected
VarDouble
posZ
=
new
VarDouble
(
"position Z"
,
-
1
d
);
protected
VarDouble
posT
=
new
VarDouble
(
"position T"
,
-
1
d
);
protected
VarDouble
posC
=
new
VarDouble
(
"position C"
,
-
1
d
);
protected
VarBoolean
useCenter
=
new
VarBoolean
(
"Set XYZ Center"
,
false
);
@Override
public
void
run
()
{
final
Point5D
pos
=
new
Point5D
.
Double
(
posX
.
getValue
().
doubleValue
(),
posY
.
getValue
().
doubleValue
(),
posZ
.
getValue
().
doubleValue
(),
posT
.
getValue
().
doubleValue
(),
posC
.
getValue
().
doubleValue
());
final
Point5D
.
Double
pos
=
new
Point5D
.
Double
(
posX
.
getValue
().
doubleValue
(),
posY
.
getValue
().
doubleValue
(),
posZ
.
getValue
().
doubleValue
(),
posT
.
getValue
().
doubleValue
(),
posC
.
getValue
().
doubleValue
());
for
(
ROI
roi
:
roiSet
)
{
if
((
roi
!=
null
)
&&
roi
.
canSetPosition
())
roi
.
setPosition5D
(
pos
);
{
if
(
useCenter
.
getValue
())
{
Rectangle5D
bounds
=
roi
.
getBounds5D
();
Point5D
.
Double
newPos
=
(
Double
)
pos
.
clone
();
newPos
.
setX
(
pos
.
getX
()
-
bounds
.
getSizeX
()
/
2
);
newPos
.
setY
(
pos
.
getY
()
-
bounds
.
getSizeY
()
/
2
);
newPos
.
setZ
(
pos
.
getZ
()
-
bounds
.
getSizeZ
()
/
2
);
roi
.
setPosition5D
(
newPos
);
}
else
{
roi
.
setPosition5D
(
pos
);
}
}
}
}
@Override
...
...
@@ -48,6 +68,7 @@ public class SetROIPosition extends Plugin implements ROIBlock, PluginLibrary, P
inputMap
.
add
(
"posZ"
,
posZ
);
inputMap
.
add
(
"posT"
,
posT
);
inputMap
.
add
(
"posC"
,
posC
);
inputMap
.
add
(
"useXYZCenter"
,
useCenter
);
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment