Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SLIC - SuperPixels
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
SLIC - SuperPixels
Commits
2e602803
Commit
2e602803
authored
6 years ago
by
Daniel Felipe González Obando
Browse files
Options
Downloads
Patches
Plain Diff
Added pixel size and name to result sequence
parent
0c39bd3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SLIC/src/algorithms/danyfel80/islic/SLICTask.java
+7
-0
7 additions, 0 deletions
SLIC/src/algorithms/danyfel80/islic/SLICTask.java
SLIC/src/plugins/danyfel80/islic/SLIC.java
+47
-7
47 additions, 7 deletions
SLIC/src/plugins/danyfel80/islic/SLIC.java
with
54 additions
and
7 deletions
SLIC/src/algorithms/danyfel80/islic/SLICTask.java
+
7
−
0
View file @
2e602803
...
@@ -425,6 +425,13 @@ public class SLICTask {
...
@@ -425,6 +425,13 @@ public class SLICTask {
List
<
int
[]>
rgbs
=
labs
.
stream
().
map
(
lab
->
CIELab
.
toRGB
(
lab
.
x
,
lab
.
y
,
lab
.
z
)).
collect
(
Collectors
.
toList
());
List
<
int
[]>
rgbs
=
labs
.
stream
().
map
(
lab
->
CIELab
.
toRGB
(
lab
.
x
,
lab
.
y
,
lab
.
z
)).
collect
(
Collectors
.
toList
());
superPixelsResult
=
new
Sequence
(
superPixelsResult
=
new
Sequence
(
new
IcyBufferedImage
(
sequence
.
getWidth
(),
sequence
.
getHeight
(),
3
,
DataType
.
UBYTE
));
new
IcyBufferedImage
(
sequence
.
getWidth
(),
sequence
.
getHeight
(),
3
,
DataType
.
UBYTE
));
superPixelsResult
.
setPixelSizeX
(
sequence
.
getPixelSizeX
());
superPixelsResult
.
setPixelSizeY
(
sequence
.
getPixelSizeY
());
superPixelsResult
.
setPixelSizeZ
(
sequence
.
getPixelSizeZ
());
superPixelsResult
.
setPositionX
(
sequence
.
getPositionX
());
superPixelsResult
.
setPositionY
(
sequence
.
getPositionY
());
superPixelsResult
.
setPositionZ
(
sequence
.
getPositionZ
());
superPixelsResult
.
beginUpdate
();
superPixelsResult
.
beginUpdate
();
double
[][]
spData
=
Array2DUtil
.
arrayToDoubleArray
(
superPixelsResult
.
getDataXYC
(
0
,
0
),
double
[][]
spData
=
Array2DUtil
.
arrayToDoubleArray
(
superPixelsResult
.
getDataXYC
(
0
,
0
),
...
...
This diff is collapsed.
Click to expand it.
SLIC/src/plugins/danyfel80/islic/SLIC.java
+
47
−
7
View file @
2e602803
...
@@ -2,19 +2,23 @@ package plugins.danyfel80.islic;
...
@@ -2,19 +2,23 @@ package plugins.danyfel80.islic;
import
algorithms.danyfel80.islic.SLICTask
;
import
algorithms.danyfel80.islic.SLICTask
;
import
icy.gui.dialog.MessageDialog
;
import
icy.gui.dialog.MessageDialog
;
import
plugins.adufour.blocks.lang.Block
;
import
plugins.adufour.blocks.util.VarList
;
import
plugins.adufour.ezplug.EzPlug
;
import
plugins.adufour.ezplug.EzPlug
;
import
plugins.adufour.ezplug.EzVarBoolean
;
import
plugins.adufour.ezplug.EzVarBoolean
;
import
plugins.adufour.ezplug.EzVarDouble
;
import
plugins.adufour.ezplug.EzVarDouble
;
import
plugins.adufour.ezplug.EzVarInteger
;
import
plugins.adufour.ezplug.EzVarInteger
;
import
plugins.adufour.ezplug.EzVarSequence
;
import
plugins.adufour.ezplug.EzVarSequence
;
public
class
SLIC
extends
EzPlug
{
public
class
SLIC
extends
EzPlug
implements
Block
{
private
EzVarSequence
inSequence
;
private
EzVarSequence
inSequence
;
private
EzVarInteger
inSPSize
;
private
EzVarInteger
inSPSize
;
private
EzVarDouble
inSPReg
;
private
EzVarDouble
inSPReg
;
private
EzVarBoolean
inIsROIOutput
;
private
EzVarBoolean
inIsROIOutput
;
private
EzVarSequence
outSequence
;
@Override
@Override
protected
void
initialize
()
{
protected
void
initialize
()
{
inSequence
=
new
EzVarSequence
(
"Sequence"
);
inSequence
=
new
EzVarSequence
(
"Sequence"
);
...
@@ -31,6 +35,29 @@ public class SLIC extends EzPlug {
...
@@ -31,6 +35,29 @@ public class SLIC extends EzPlug {
addEzComponent
(
inIsROIOutput
);
addEzComponent
(
inIsROIOutput
);
}
}
@Override
public
void
declareInput
(
VarList
inputMap
)
{
inSequence
=
new
EzVarSequence
(
"Sequence"
);
inSPSize
=
new
EzVarInteger
(
"Superpixel size"
);
inSPReg
=
new
EzVarDouble
(
"Superpixels regularity"
);
inIsROIOutput
=
new
EzVarBoolean
(
"Output as ROIs"
,
false
);
inSPSize
.
setValue
(
30
);
inSPReg
.
setValue
(
0.2
);
inputMap
.
add
(
inSequence
.
name
,
inSequence
.
getVariable
());
inputMap
.
add
(
inSPSize
.
name
,
inSPSize
.
getVariable
());
inputMap
.
add
(
inSPReg
.
name
,
inSPReg
.
getVariable
());
inputMap
.
add
(
inIsROIOutput
.
name
,
inIsROIOutput
.
getVariable
());
}
@Override
public
void
declareOutput
(
VarList
outputMap
)
{
outSequence
=
new
EzVarSequence
(
"Result"
);
outputMap
.
add
(
outSequence
.
name
,
outSequence
.
getVariable
());
}
@Override
@Override
protected
void
execute
()
{
protected
void
execute
()
{
long
procTime
,
startTime
,
endTime
;
long
procTime
,
startTime
,
endTime
;
...
@@ -39,8 +66,10 @@ public class SLIC extends EzPlug {
...
@@ -39,8 +66,10 @@ public class SLIC extends EzPlug {
task
=
new
SLICTask
(
inSequence
.
getValue
(),
inSPSize
.
getValue
(),
inSPReg
.
getValue
(),
inIsROIOutput
.
getValue
());
task
=
new
SLICTask
(
inSequence
.
getValue
(),
inSPSize
.
getValue
(),
inSPReg
.
getValue
(),
inIsROIOutput
.
getValue
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
MessageDialog
.
showDialog
(
"Initialization Error"
,
if
(!
this
.
isHeadLess
())
{
String
.
format
(
"SLIC could not start properly: "
+
e
.
getMessage
()),
MessageDialog
.
ERROR_MESSAGE
);
MessageDialog
.
showDialog
(
"Initialization Error"
,
String
.
format
(
"SLIC could not start properly: "
+
e
.
getMessage
()),
MessageDialog
.
ERROR_MESSAGE
);
}
return
;
return
;
}
}
startTime
=
System
.
currentTimeMillis
();
startTime
=
System
.
currentTimeMillis
();
...
@@ -48,16 +77,27 @@ public class SLIC extends EzPlug {
...
@@ -48,16 +77,27 @@ public class SLIC extends EzPlug {
task
.
execute
();
task
.
execute
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
MessageDialog
.
showDialog
(
"Runtime Error"
,
String
.
format
(
"SLIC could not run properly: "
+
e
.
getMessage
()),
if
(!
this
.
isHeadLess
())
{
MessageDialog
.
ERROR_MESSAGE
);
MessageDialog
.
showDialog
(
"Runtime Error"
,
String
.
format
(
"SLIC could not run properly: "
+
e
.
getMessage
()),
MessageDialog
.
ERROR_MESSAGE
);
}
return
;
return
;
}
}
endTime
=
System
.
currentTimeMillis
();
endTime
=
System
.
currentTimeMillis
();
procTime
=
endTime
-
startTime
;
procTime
=
endTime
-
startTime
;
MessageDialog
.
showDialog
(
String
.
format
(
"SLIC finished in %d milliseconds"
,
procTime
));
System
.
out
.
println
(
String
.
format
(
"SLIC finished in %d milliseconds"
,
procTime
));
System
.
out
.
println
(
String
.
format
(
"SLIC finished in %d milliseconds"
,
procTime
));
addSequence
(
task
.
getResultSequence
());
if
(!
this
.
inIsROIOutput
.
getValue
())
{
task
.
getResultSequence
().
setName
(
inSequence
.
getValue
().
getName
()
+
String
.
format
(
"_SLIC(size=%s,reg=%.2f)"
,
inSPSize
.
getValue
().
intValue
(),
inSPReg
.
getValue
().
doubleValue
()));
}
if
(!
this
.
isHeadLess
())
{
MessageDialog
.
showDialog
(
String
.
format
(
"SLIC finished in %d milliseconds"
,
procTime
));
addSequence
(
task
.
getResultSequence
());
}
else
{
outSequence
.
setValue
(
task
.
getResultSequence
());
}
}
}
@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