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
ALMF
feedback-fly-embryo-crocker
Commits
c0c4f03d
Commit
c0c4f03d
authored
Apr 21, 2021
by
Aliaksandr Halavatyi
Browse files
Modifying the code to match updates in fly-reg
parent
2a5d5fd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
c0c4f03d
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<groupId>
embl.almf
</groupId>
<groupId>
embl.almf
</groupId>
<version>
1.0.
8
-SNAPSHOT
</version>
<version>
1.0.
9
-SNAPSHOT
</version>
<name>
Fly_Embryo_Feedback
</name>
<name>
Fly_Embryo_Feedback
</name>
<inceptionYear>
2017
</inceptionYear>
<inceptionYear>
2017
</inceptionYear>
...
@@ -100,13 +100,13 @@
...
@@ -100,13 +100,13 @@
<dependency>
<dependency>
<groupId>
embl.almf
</groupId>
<groupId>
embl.almf
</groupId>
<artifactId>
AutoMicTools_
</artifactId>
<artifactId>
AutoMicTools_
</artifactId>
<version>
1.1.
17
-SNAPSHOT
</version>
<version>
1.1.
20
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
de.embl.cba
</groupId>
<groupId>
de.embl.cba
</groupId>
<artifactId>
fly-reg
</artifactId>
<artifactId>
fly-reg
</artifactId>
<version>
0.1.
1
</version>
<version>
0.1.
3-SNAPSHOT
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
@@ -172,7 +172,7 @@
...
@@ -172,7 +172,7 @@
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.
5.1
</version>
<version>
3.
7.0
</version>
<configuration>
<configuration>
<source>
1.8
</source>
<source>
1.8
</source>
<target>
1.8
</target>
<target>
1.8
</target>
...
...
src/main/java/feedback/fly/embryo/jobs/Job_FocusEmbryoAutoDatasetSplit.java
View file @
c0c4f03d
...
@@ -10,9 +10,10 @@ import automic.online.jobs.Job_Default;
...
@@ -10,9 +10,10 @@ import automic.online.jobs.Job_Default;
import
automic.parameters.ParameterCollection
;
import
automic.parameters.ParameterCollection
;
import
automic.parameters.ParameterType
;
import
automic.parameters.ParameterType
;
import
automic.table.TableModel
;
import
automic.table.TableModel
;
import
automic.geom.Position3DWithRotation
;
import
de.embl.cba.flyreg.FlyEmbryoNerveCordRegistration
;
import
de.embl.cba.flyreg.FlyEmbryoNerveCordRegistration
;
import
de.embl.cba.flyreg.FlyEmbryoRegistrationSettings
;
import
de.embl.cba.flyreg.FlyEmbryoRegistrationSettings
;
import
de.embl.cba.morphometry.Utils
;
import
ij.IJ
;
import
ij.IJ
;
import
net.imagej.ImageJ
;
import
net.imagej.ImageJ
;
import
ij.ImagePlus
;
import
ij.ImagePlus
;
...
@@ -27,10 +28,12 @@ import ij.process.ImageProcessor;
...
@@ -27,10 +28,12 @@ import ij.process.ImageProcessor;
import
loci.plugins.BF
;
import
loci.plugins.BF
;
import
loci.plugins.in.ImporterOptions
;
import
loci.plugins.in.ImporterOptions
;
import
net.imagej.ops.OpService
;
import
net.imagej.ops.OpService
;
import
net.imglib2.RandomAccessibleInterval
;
import
net.imglib2.type.NativeType
;
import
net.imglib2.type.NativeType
;
import
net.imglib2.type.numeric.RealType
;
import
net.imglib2.type.numeric.RealType
;
public
class
Job_FocusEmbryoAutoDatasetSplit
extends
Job_Default
{
public
class
Job_FocusEmbryoAutoDatasetSplit
extends
Job_Default
{
public
static
final
String
KEY_FOCUS_CHANNEL_INDEX
=
"Focus channel index"
;
public
static
final
String
KEY_FOCUS_CHANNEL_INDEX
=
"Focus channel index"
;
...
@@ -40,13 +43,10 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -40,13 +43,10 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
private
OpService
opService
=
null
;
private
static
OpService
opService
=
null
;
private
ImagePlus
img
=
null
;
private
ImagePlus
img
=
null
;
private
Double
selectedXPosition
;
Position3DWithRotation
selectedPosition
;
private
Double
selectedYPosition
;
private
Double
selectedZPosition
;
private
Double
rotation
;
private
Double
halfLength
;
private
Double
halfLength
;
...
@@ -61,17 +61,15 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -61,17 +61,15 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
@Override
@Override
public
void
initialise
(
String
_fTag
,
String
_colNm
,
boolean
_visOnline
){
public
void
initialise
(
String
_fTag
,
String
_colNm
,
boolean
_visOnline
){
super
.
initialise
(
_fTag
,
_colNm
,
_visOnline
);
super
.
initialise
(
_fTag
,
_colNm
,
_visOnline
);
opService
=
new
ImageJ
().
op
();
if
(
opService
==
null
)
opService
=
new
ImageJ
().
op
();
}
}
@Override
@Override
protected
void
cleanIterOutput
(){
protected
void
cleanIterOutput
(){
img
=
null
;
img
=
null
;
selectedXPosition
=
null
;
selectedPosition
=
null
;
selectedYPosition
=
null
;
selectedYPosition
=
null
;
rotation
=
null
;
halfLength
=
null
;
halfLength
=
null
;
}
}
...
@@ -155,61 +153,60 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -155,61 +153,60 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
//////code from Tischi
//////code from Tischi
try
{
try
{
getEllipsoidParameters
(
imageToProcess
,
img
);
selectedPosition
=
getEllipsoidParameters
(
imageToProcess
,
img
);
}
catch
(
Exception
_ex
)
{
}
catch
(
Exception
_ex
)
{
return
false
;
return
false
;
}
}
////
////
if
(!
correctXY
)
{
selectedPosition
.
setX
(
img
.
getWidth
()/
2.0
);
selectedPosition
.
setX
(
img
.
getHeight
()/
2.0
);
}
halfLength
=
img
.
getWidth
()/
3.0
;
halfLength
=
img
.
getWidth
()/
3.0
;
if
(
rotation
>
90
)
double
angle
=
selectedPosition
.
getAngle
();
rotation
=
rotation
-
180
;
if
(
angle
>
90
)
selectedPosition
.
setAngle
(
angle
-
180
);
return
true
;
return
true
;
}
}
void
getEllipsoidParameters
(
ImagePlus
_imageProcess
,
ImagePlus
_imageCalibration
)
throws
Exception
{
static
<
T
extends
RealType
<
T
>
&
NativeType
<
T
>
>
Position3DWithRotation
getEllipsoidParameters
(
ImagePlus
_imageProcess
,
ImagePlus
_imageCalibration
)
throws
Exception
{
final
FlyEmbryoRegistrationSettings
settings
=
new
FlyEmbryoRegistrationSettings
();
final
FlyEmbryoRegistrationSettings
settings
=
new
FlyEmbryoRegistrationSettings
();
settings
.
onlyComputeEllipsoidParameters
=
true
;
settings
.
onlyComputeEllipsoidParameters
=
true
;
final
FlyEmbryoNerveCordRegistration
registration
=
new
FlyEmbryoNerveCordRegistration
(
settings
,
opService
);
final
FlyEmbryoNerveCordRegistration
<
T
>
registration
=
new
FlyEmbryoNerveCordRegistration
<>
(
settings
,
opService
);
final
double
[]
calibration
=
Utils
.
getCalibration
(
_imageCalibration
);
registration
.
run
(
_imageProcess
,
0
);
registration
.
run
(
_imageProcess
,
0
);
final
double
[]
centre
=
registration
.
getElliposidCentreInInputImagePixelUnits
();
final
double
[]
centre
=
registration
.
getElliposidCentreInInputImagePixelUnits
();
final
double
[]
angles
=
registration
.
getElliposidEulerAnglesInDegrees
();
final
double
[]
angles
=
registration
.
getElliposidEulerAnglesInDegrees
();
if
(
correctXY
)
{
selectedXPosition
=
centre
[
0
];
selectedYPosition
=
centre
[
1
];
}
else
{
return
new
Position3DWithRotation
(
centre
[
0
],
centre
[
1
],
centre
[
2
],
-
angles
[
0
]);
selectedXPosition
=
img
.
getWidth
()/
2.0
;
selectedYPosition
=
img
.
getHeight
()/
2.0
;
}
selectedZPosition
=
centre
[
2
];
rotation
=-
angles
[
0
];
}
}
@Override
@Override
protected
Overlay
createOverlay
(){
protected
Overlay
createOverlay
(){
Overlay
o
=
new
Overlay
();
Overlay
o
=
new
Overlay
();
if
(
selectedXPosition
!=
null
)
{
if
(
selectedPosition
!=
null
)
{
Roi
pointRoi
=
new
PointRoi
(
selectedXPosition
,
selectedYPosition
);
double
roiX
=
selectedPosition
.
getX
();
pointRoi
.
setPosition
((
int
)(
selectedZPosition
+
1
));
double
roiY
=
selectedPosition
.
getY
();
int
roiZ
=(
int
)(
selectedPosition
.
getZ
()+
1
);
Roi
pointRoi
=
new
PointRoi
(
roiX
,
roiY
);
pointRoi
.
setPosition
(
roiZ
);
o
.
add
(
pointRoi
);
o
.
add
(
pointRoi
);
Double
angleRadians
=
rotation
/
180
*
Math
.
PI
;
Double
angleRadians
=
selectedPosition
.
getAngle
()
/
180
*
Math
.
PI
;
Roi
lineRoi
=
new
Arrow
(
selectedXPosition
,
selectedYPosition
,
selectedXPosition
+
halfLength
*
Math
.
cos
(
angleRadians
),
selectedYPosition
-
halfLength
*
Math
.
sin
(
angleRadians
));
Roi
lineRoi
=
new
Arrow
(
roiX
,
roiY
,
roiX
+
halfLength
*
Math
.
cos
(
angleRadians
),
roiY
-
halfLength
*
Math
.
sin
(
angleRadians
));
lineRoi
.
setStrokeColor
(
Color
.
PINK
);
lineRoi
.
setStrokeColor
(
Color
.
PINK
);
lineRoi
.
setStrokeWidth
(
1
);
lineRoi
.
setStrokeWidth
(
1
);
o
.
add
(
lineRoi
);
o
.
add
(
lineRoi
);
...
@@ -221,8 +218,8 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -221,8 +218,8 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
public
void
visualise
(
int
_xvis
,
int
_yvis
){
public
void
visualise
(
int
_xvis
,
int
_yvis
){
this
.
visualiseImg
(
img
,
getOverlay
(),
_xvis
,
_yvis
);
this
.
visualiseImg
(
img
,
getOverlay
(),
_xvis
,
_yvis
);
if
(
selected
Z
Position
!=
null
)
if
(
selectedPosition
!=
null
)
img
.
setPosition
((
int
)(
selected
Z
Position
+
1
));
img
.
setPosition
((
int
)(
selectedPosition
.
getZ
()
+
1
));
}
}
...
@@ -230,7 +227,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -230,7 +227,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
@Override
@Override
public
void
postProcessSuccess
()
throws
Exception
{
public
void
postProcessSuccess
()
throws
Exception
{
ZeissKeys
.
submitCommandsToMicroscope
(
"trigger2"
,
""
+
selected
X
Position
,
""
+
selected
Y
Position
,
""
+
selected
Z
Position
,
""
+
rotation
,
""
,
""
,
""
,
""
,
""
);
ZeissKeys
.
submitCommandsToMicroscope
(
"trigger2"
,
""
+
selectedPosition
.
getX
()
,
""
+
selectedPosition
.
getY
()
,
""
+
selectedPosition
.
getZ
(),
""
+
selectedPosition
.
getAngle
()
,
""
,
""
,
""
,
""
,
""
);
int
tableRowCounter
=(
int
)
this
.
getSharedValue
(
"Table Row Counter"
);
int
tableRowCounter
=(
int
)
this
.
getSharedValue
(
"Table Row Counter"
);
...
@@ -239,10 +236,10 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
...
@@ -239,10 +236,10 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
File
experimentTableFile
=
new
File
(
currentTable
.
getRootPath
(),
"summary_"
+
Exper_nm
+
".txt"
);
File
experimentTableFile
=
new
File
(
currentTable
.
getRootPath
(),
"summary_"
+
Exper_nm
+
".txt"
);
TableModel
experimentTable
=
new
TableModel
(
experimentTableFile
);
TableModel
experimentTable
=
new
TableModel
(
experimentTableFile
);
experimentTable
.
setNumericValue
(
selected
X
Position
,
tableRowCounter
,
"Correction.X"
);
experimentTable
.
setNumericValue
(
selectedPosition
.
getX
()
,
tableRowCounter
,
"Correction.X"
);
experimentTable
.
setNumericValue
(
selected
Y
Position
,
tableRowCounter
,
"Correction.Y"
);
experimentTable
.
setNumericValue
(
selectedPosition
.
getY
()
,
tableRowCounter
,
"Correction.Y"
);
experimentTable
.
setNumericValue
(
selected
Z
Position
,
tableRowCounter
,
"Focus.Z"
);
experimentTable
.
setNumericValue
(
selectedPosition
.
getZ
()
,
tableRowCounter
,
"Focus.Z"
);
experimentTable
.
setNumericValue
(
rotation
,
tableRowCounter
,
"Rotation"
);
experimentTable
.
setNumericValue
(
selectedPosition
.
getAngle
()
,
tableRowCounter
,
"Rotation"
);
experimentTable
.
writeNewFile
(
"summary_"
+
Exper_nm
+
".txt"
,
true
);
experimentTable
.
writeNewFile
(
"summary_"
+
Exper_nm
+
".txt"
,
true
);
...
...
src/main/java/feedback/fly/embryo/jobs/Job_SelectMultipleEmbryosAuto.java
View file @
c0c4f03d
...
@@ -11,14 +11,12 @@ import automic.parameters.ParameterCollection;
...
@@ -11,14 +11,12 @@ import automic.parameters.ParameterCollection;
import
automic.parameters.ParameterType
;
import
automic.parameters.ParameterType
;
import
automic.utils.ArrIndUtils
;
import
automic.utils.ArrIndUtils
;
import
automic.utils.DebugVisualiserSettings
;
import
automic.utils.DebugVisualiserSettings
;
import
automic.utils.FileUtils
;
import
automic.utils.roi.ParticleFilterer
;
import
automic.utils.roi.ParticleFilterer
;
import
automic.utils.roi.ROIManipulator2D
;
import
automic.utils.roi.ROIManipulator2D
;
import
ij.IJ
;
import
ij.IJ
;
import
ij.ImageJ
;
import
ij.ImageJ
;
import
ij.ImagePlus
;
import
ij.ImagePlus
;
import
ij.gui.Overlay
;
import
ij.gui.Overlay
;
import
ij.gui.PointRoi
;
import
ij.gui.Roi
;
import
ij.gui.Roi
;
import
ij.plugin.Duplicator
;
import
ij.plugin.Duplicator
;
import
ij.plugin.ZProjector
;
import
ij.plugin.ZProjector
;
...
...
src/test/java/algorithm/tests/FindEmbryoOrientationTischi.java
View file @
c0c4f03d
...
@@ -6,7 +6,6 @@ import java.io.File;
...
@@ -6,7 +6,6 @@ import java.io.File;
import
de.embl.cba.flyreg.FlyEmbryoNerveCordRegistration
;
import
de.embl.cba.flyreg.FlyEmbryoNerveCordRegistration
;
import
de.embl.cba.flyreg.FlyEmbryoRegistrationSettings
;
import
de.embl.cba.flyreg.FlyEmbryoRegistrationSettings
;
//import de.embl.cba.flyreg.FlyEmbryoSingleChannelRegistration;
import
ij.ImagePlus
;
import
ij.ImagePlus
;
import
loci.plugins.BF
;
import
loci.plugins.BF
;
...
@@ -33,7 +32,7 @@ public class FindEmbryoOrientationTischi {
...
@@ -33,7 +32,7 @@ public class FindEmbryoOrientationTischi {
final
FlyEmbryoRegistrationSettings
settings
=
new
FlyEmbryoRegistrationSettings
();
final
FlyEmbryoRegistrationSettings
settings
=
new
FlyEmbryoRegistrationSettings
();
settings
.
onlyComputeEllipsoidParameters
=
true
;
settings
.
onlyComputeEllipsoidParameters
=
true
;
final
FlyEmbryoNerveCordRegistration
registration
=
new
FlyEmbryoNerveCordRegistration
(
settings
,
opService
);
final
FlyEmbryoNerveCordRegistration
<
T
>
registration
=
new
FlyEmbryoNerveCordRegistration
<>
(
settings
,
opService
);
registration
.
run
(
imagePlus
,
0
);
registration
.
run
(
imagePlus
,
0
);
...
...
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