Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Zellige-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
IdA Public
Zellige-core
Merge requests
!24
#6
closed - Display of program state
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
#6
closed - Display of program state
feature_gui
into
dev
Overview
0
Commits
19
Pipelines
1
Changes
87
Closed
Céline TREBEAU
requested to merge
feature_gui
into
dev
3 years ago
Overview
0
Commits
19
Pipelines
1
Changes
87
Expand
addition of log appender programmatically instead of the use of logback.xml file to avoid conflict with the logback.xml file in FIJI
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
c5eede3d
19 commits,
3 years ago
87 files
+
1878
−
1641
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
87
Search (e.g. *.vue) (Ctrl+P)
src/main/java/fr/pasteur/ida/zellige/command/ZelligeCommand.java deleted
100644 → 0
+
0
−
256
Options
package
fr.pasteur.ida.zellige.command
;
import
fr.pasteur.ida.zellige.ReferenceSurfaceExtraction
;
import
fr.pasteur.ida.zellige.steps.construction.exception.NoSurfaceFoundException
;
import
fr.pasteur.ida.zellige.steps.construction.rounds.ConstructionParameters
;
import
fr.pasteur.ida.zellige.steps.projection.DisplayParameters
;
import
fr.pasteur.ida.zellige.steps.projection.NoPossibleDisplayException
;
import
fr.pasteur.ida.zellige.steps.projection.ProjectionParameters
;
import
fr.pasteur.ida.zellige.steps.selection.classification.ClassificationParameters
;
import
fr.pasteur.ida.zellige.steps.selection.exception.DataValidationException
;
import
fr.pasteur.ida.zellige.steps.selection.exception.EmptyOutputException
;
import
fr.pasteur.ida.zellige.steps.selection.exception.NoClassificationException
;
import
fr.pasteur.ida.zellige.steps.selection.postTreatment.PostTreatmentParameters
;
import
fr.pasteur.ida.zellige.steps.selection.pretreatment.PretreatmentParameters
;
import
ij.IJ
;
import
net.imagej.Dataset
;
import
net.imagej.ImageJ
;
import
net.imagej.ImgPlus
;
import
net.imagej.display.ImageDisplayService
;
import
net.imagej.ops.OpService
;
import
net.imglib2.type.NativeType
;
import
net.imglib2.type.numeric.RealType
;
import
net.imglib2.util.Util
;
import
org.scijava.command.ContextCommand
;
import
org.scijava.log.LogService
;
import
org.scijava.plugin.Parameter
;
import
org.scijava.plugin.Plugin
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.FileSystems
;
@Plugin
(
type
=
ZelligeCommand
.
class
,
name
=
"Zellige"
,
menuPath
=
"Plugins > Process > Zellige"
)
public
class
ZelligeCommand
<
T
extends
RealType
<
T
>
&
NativeType
<
T
>
>
extends
ContextCommand
{
@Parameter
protected
OpService
ops
;
@Parameter
private
ImageDisplayService
imageDisplayService
;
@Parameter
private
LogService
logService
;
@Parameter
(
label
=
"Amplitude threshold"
,
min
=
"0"
,
max
=
"255"
,
stepSize
=
"1"
)
private
int
amplitude
=
5
;
@Parameter
(
label
=
"Otsu threshold"
,
min
=
"0"
,
max
=
"255"
,
stepSize
=
"1"
)
private
int
otsu
=
5
;
@Parameter
(
label
=
"XY blur radius"
,
min
=
"0"
,
max
=
"10"
)
private
int
sigmaXY
=
1
;
@Parameter
(
label
=
"Z blur radius"
,
min
=
"0"
,
max
=
"10"
)
private
int
sigmaZ
=
1
;
@Parameter
(
label
=
"Min Island size"
,
min
=
"0"
,
max
=
"50"
,
stepSize
=
"5"
)
private
int
islandSize
=
5
;
@Parameter
(
label
=
"Island connectivity"
,
min
=
"4"
,
max
=
"8"
,
stepSize
=
"4"
)
private
int
connexity
=
4
;
@Parameter
(
label
=
"1st round Starting OSE size"
,
min
=
"0"
,
max
=
"1"
,
stepSize
=
"0.1"
)
private
double
startingOsSize1
=
0.8
;
@Parameter
(
label
=
"1st round overlap "
,
min
=
"0"
,
max
=
"50"
)
private
int
overlap1
=
10
;
@Parameter
(
label
=
"1st round matching rate"
,
min
=
"0.5"
,
max
=
"1"
,
stepSize
=
"0.05"
)
private
double
connexityRate1
=
0.8
;
@Parameter
(
label
=
"2nd round Starting OSE size"
,
min
=
"0"
,
max
=
"1"
,
stepSize
=
"0.1"
)
private
double
startingOsSize2
=
0.1
;
@Parameter
(
label
=
"2nd round overlap"
,
min
=
"0"
,
max
=
"50"
,
stepSize
=
"5"
)
private
int
overlap2
=
10
;
@Parameter
(
label
=
"2nd round matching rate"
,
min
=
"0.5"
,
max
=
"1"
,
stepSize
=
"0.05"
)
private
double
connexityRate2
=
0.9
;
@Parameter
(
label
=
"Min surface size (rel to XY image size)"
,
min
=
"0.05"
,
max
=
"1"
,
stepSize
=
"0.1"
)
private
double
surfaceMinSizeFactor
;
@Parameter
(
label
=
"Projection width (deltaZ)"
,
min
=
"0"
)
private
int
delta
;
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
currentFolder
=
FileSystems
.
getDefault
()
.
getPath
(
""
)
.
toAbsolutePath
()
.
toString
();
String
imageFilePath
=
"doc/Cochlée1.tif"
;
// Launch ImageJ.
ImageJ
ij
=
new
ImageJ
();
ij
.
launch
(
args
);
// Load the image.
Object
obj
=
ij
.
io
().
open
(
new
File
(
currentFolder
,
imageFilePath
).
getAbsolutePath
()
);
// Display it.
ij
.
ui
().
show
(
obj
);
ij
.
command
().
run
(
ZelligeCommand
.
class
,
true
);
}
@Override
public
void
run
()
{
/*
* Get current dataset.
*/
Dataset
dataset
=
imageDisplayService
.
getActiveDataset
();
if
(
null
==
dataset
)
{
logService
.
error
(
"Please open an image before running Zellige."
);
return
;
}
/*
* Wrap it into an ImgLib2 'Plus' image.
*/
@SuppressWarnings
(
"unchecked"
)
ImgPlus
<
T
>
img
=
(
ImgPlus
<
T
>
)
dataset
.
getImgPlus
();
long
[]
dims
=
new
long
[
dataset
.
numDimensions
()
];
dataset
.
dimensions
(
dims
);
IJ
.
log
(
"Zellige received the image: "
+
img
.
getName
()
);
IJ
.
log
(
"Size: "
+
Util
.
printInterval
(
img
)
);
IJ
.
log
(
"Type: "
+
img
.
firstElement
().
getClass
().
toGenericString
()
);
IJ
.
log
(
"Dimensionality: "
+
img
.
numDimensions
()
+
"D"
);
for
(
int
d
=
0
;
d
<
img
.
numDimensions
();
d
++
)
{
IJ
.
log
(
" - dimension "
+
d
+
": ["
+
img
.
axis
(
d
).
type
()
+
"], 1 unit = "
+
img
.
averageScale
(
d
)
+
" "
+
img
.
axis
(
d
).
unit
()
);
}
// Fixed parameters for now...
String
filter
=
"GaussianBlur"
;
double
filterParameter
=
2
;
IJ
.
log
(
"Input image : "
+
dataset
.
getName
()
);
IJ
.
log
(
"filter : "
+
filter
);
IJ
.
log
(
"filter parameter : "
+
filterParameter
);
IJ
.
log
(
"amplitude : "
+
amplitude
);
IJ
.
log
(
"threshold : "
+
otsu
);
IJ
.
log
(
"connexity : "
+
connexity
);
IJ
.
log
(
"island size : "
+
islandSize
);
IJ
.
log
(
"sigmaXY : "
+
sigmaXY
);
IJ
.
log
(
"sigmaZ : "
+
sigmaZ
);
IJ
.
log
(
"starting os size1 : "
+
startingOsSize1
);
IJ
.
log
(
"overlap1 :"
+
overlap1
);
IJ
.
log
(
"connexityRate1 :"
+
connexityRate1
);
IJ
.
log
(
"starting os size2 : "
+
startingOsSize2
);
IJ
.
log
(
"overlap2 :"
+
overlap2
);
IJ
.
log
(
"connexityRate2 :"
+
connexityRate2
);
IJ
.
log
(
"surface Minimum size factor : "
+
surfaceMinSizeFactor
);
IJ
.
log
(
"delta : "
+
delta
);
PretreatmentParameters
pretreatmentParameters
=
null
;
try
{
pretreatmentParameters
=
new
PretreatmentParameters
(
filter
,
filterParameter
);
}
catch
(
DataValidationException
e
)
{
e
.
printStackTrace
();
}
ClassificationParameters
classificationParameters
=
null
;
try
{
classificationParameters
=
new
ClassificationParameters
(
amplitude
,
otsu
);
}
catch
(
DataValidationException
e
)
{
e
.
printStackTrace
();
}
PostTreatmentParameters
postTreatmentParameters
=
null
;
try
{
postTreatmentParameters
=
new
PostTreatmentParameters
(
sigmaXY
,
sigmaZ
,
islandSize
,
connexity
);
}
catch
(
DataValidationException
e
)
{
e
.
printStackTrace
();
}
ProjectionParameters
projectionParameters
=
null
;
// no other method implemented yet.
try
{
projectionParameters
=
new
ProjectionParameters
(
delta
,
"MIP"
);
}
catch
(
DataValidationException
e
)
{
e
.
printStackTrace
();
}
ConstructionParameters
[]
constructionParameters
=
new
ConstructionParameters
[]{
new
ConstructionParameters
(
startingOsSize1
,
overlap1
,
connexityRate1
,
surfaceMinSizeFactor
),
new
ConstructionParameters
(
startingOsSize2
,
overlap2
,
connexityRate2
,
surfaceMinSizeFactor
)
};
DisplayParameters
displayParameters
=
new
DisplayParameters
(
true
,
false
,
false
,
true
,
false
,
true
);
if
(
img
.
numDimensions
()
==
3
)
// Is it a stack ?
{
ReferenceSurfaceExtraction
<
T
>
rse
=
new
ReferenceSurfaceExtraction
<>
(
img
,
img
.
factory
()
);
try
{
rse
.
select
(
pretreatmentParameters
,
classificationParameters
,
postTreatmentParameters
);
}
catch
(
NoClassificationException
|
EmptyOutputException
|
DataValidationException
e
)
{
e
.
printStackTrace
();
}
try
{
rse
.
construct
(
constructionParameters
);
}
catch
(
NoSurfaceFoundException
e
)
{
e
.
printStackTrace
();
}
try
{
rse
.
project
(
projectionParameters
,
displayParameters
);
IJ
.
log
(
" Number of surfaces found : "
+
rse
.
getReferenceSurfaces
().
size
()
);
}
catch
(
NoPossibleDisplayException
e
)
{
e
.
printStackTrace
();
}
}
else
{
System
.
out
.
println
(
" This image has to be a z-stack ! "
);
}
}
}
Loading