Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
1880685e
Commit
1880685e
authored
Apr 19, 2021
by
Aliaksandr Halavatyi
Browse files
option in embryo focusing job to ignore xy positions from calculations
parent
4af06eda
Changes
2
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
1880685e
...
...
@@ -15,7 +15,7 @@
<groupId>
embl.almf
</groupId>
<version>
1.0.
6-snapshot
</version>
<version>
1.0.
7-SNAPSHOT
</version>
<name>
Fly_Embryo_Feedback
</name>
<inceptionYear>
2017
</inceptionYear>
...
...
src/main/java/feedback/fly/embryo/jobs/Job_FocusEmbryoAutoDatasetSplit.java
View file @
1880685e
...
...
@@ -16,10 +16,14 @@ import de.embl.cba.morphometry.Utils;
import
ij.IJ
;
import
net.imagej.ImageJ
;
import
ij.ImagePlus
;
import
ij.ImageStack
;
import
ij.Prefs
;
import
ij.gui.Arrow
;
import
ij.gui.Overlay
;
import
ij.gui.PointRoi
;
import
ij.gui.Roi
;
import
ij.plugin.ImageCalculator
;
import
ij.process.ImageProcessor
;
import
loci.plugins.BF
;
import
loci.plugins.in.ImporterOptions
;
import
net.imagej.ops.OpService
;
...
...
@@ -32,6 +36,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
public
static
final
String
KEY_FOCUS_CHANNEL_INDEX
=
"Focus channel index"
;
public
static
final
String
KEY_WAIT_IMAGE_OPENING
=
"Wait for image opening (milliseconds)"
;
public
static
final
String
KEY_FOCUS_OFFSET
=
"Focus offset"
;
public
static
final
String
KEY_CORRECT_XY
=
"Correct XY"
;
...
...
@@ -48,6 +53,10 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
private
int
targetChannel
=
1
;
private
int
imageOpeningTimeDelay
=
3000
;
private
int
focusOffset
=
0
;
private
boolean
makeBinary
=
false
;
private
int
thresholdValue
=
300
;
private
boolean
correctXY
=
true
;
@Override
public
void
initialise
(
String
_fTag
,
String
_colNm
,
boolean
_visOnline
){
...
...
@@ -115,18 +124,38 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
this
.
showDebug
(
img
,
"Original Image"
,
fals
e
);
this
.
showDebug
(
img
,
"Original Image"
,
tru
e
);
ImagePlus
imageToProcess
=
null
;
if
(
makeBinary
)
{
Prefs
.
blackBackground
=
true
;
ImageStack
originalStack
=
img
.
getStack
();
ImageStack
binaryStack
=
new
ImageStack
(
originalStack
.
getWidth
(),
originalStack
.
getHeight
());
int
nSlices
=
originalStack
.
getSize
();
for
(
int
iSlice
=
1
;
iSlice
<=
nSlices
;
iSlice
++)
{
ImageProcessor
originalSlice
=
originalStack
.
getProcessor
(
iSlice
);
originalSlice
.
setThreshold
(
thresholdValue
,
Double
.
MAX_VALUE
,
originalSlice
.
getLutUpdateMode
());
binaryStack
.
addSlice
(
originalSlice
.
createMask
());
}
imageToProcess
=
new
ImagePlus
(
"Image to process"
,
binaryStack
);
IJ
.
run
(
imageToProcess
,
"Divide..."
,
"value=255 stack"
);
ImageCalculator
ic
=
new
ImageCalculator
();
imageToProcess
=
ic
.
run
(
"Multiply create stack"
,
img
,
imageToProcess
);
}
else
{
imageToProcess
=
img
;
}
//new WaitForUserDialog ("Select Shift Point").show();
this
.
showDebug
(
im
g
,
"Original Image"
,
fals
e
);
this
.
showDebug
(
im
ageToProcess
,
"ImageToProcess"
,
tru
e
);
//////code from Tischi
try
{
getEllipsoidParameters
(
img
);
getEllipsoidParameters
(
imageToProcess
,
img
);
}
catch
(
Exception
_ex
)
{
return
false
;
}
...
...
@@ -141,7 +170,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
}
void
getEllipsoidParameters
(
ImagePlus
_image
)
throws
Exception
{
void
getEllipsoidParameters
(
ImagePlus
_image
Process
,
ImagePlus
_imageCalibration
)
throws
Exception
{
final
FlyEmbryoRegistrationSettings
settings
=
new
FlyEmbryoRegistrationSettings
();
...
...
@@ -149,15 +178,22 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
final
FlyEmbryoSingleChannelRegistration
registration
=
new
FlyEmbryoSingleChannelRegistration
(
settings
,
opService
);
final
double
[]
calibration
=
Utils
.
getCalibration
(
_image
);
final
double
[]
calibration
=
Utils
.
getCalibration
(
_image
Calibration
);
registration
.
run
(
_image
,
0
);
registration
.
run
(
_image
Process
,
0
);
final
double
[]
centre
=
registration
.
getElliposidCentreInInputImagePixelUnits
();
final
double
[]
angles
=
registration
.
getElliposidEulerAnglesInDegrees
();
selectedXPosition
=
centre
[
0
];
selectedYPosition
=
centre
[
1
];
if
(
correctXY
)
{
selectedXPosition
=
centre
[
0
];
selectedYPosition
=
centre
[
1
];
}
else
{
selectedXPosition
=
img
.
getWidth
()/
2.0
;
selectedYPosition
=
img
.
getHeight
()/
2.0
;
}
selectedZPosition
=
centre
[
2
];
rotation
=-
angles
[
0
];
...
...
@@ -246,6 +282,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
jobCollection
.
addParameter
(
KEY_FOCUS_CHANNEL_INDEX
,
null
,
targetChannel
,
ParameterType
.
INT_PARAMETER
);
jobCollection
.
addParameter
(
KEY_WAIT_IMAGE_OPENING
,
null
,
imageOpeningTimeDelay
,
ParameterType
.
INT_PARAMETER
);
jobCollection
.
addParameter
(
KEY_FOCUS_OFFSET
,
null
,
focusOffset
,
ParameterType
.
INT_PARAMETER
);
jobCollection
.
addParameter
(
KEY_CORRECT_XY
,
null
,
correctXY
,
ParameterType
.
BOOL_PARAMETER
);
return
jobCollection
;
...
...
@@ -256,6 +293,7 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
this
.
targetChannel
=
(
Integer
)
_jobParameterCollection
.
getParameterValue
(
KEY_FOCUS_CHANNEL_INDEX
);
this
.
imageOpeningTimeDelay
=
(
Integer
)
_jobParameterCollection
.
getParameterValue
(
KEY_WAIT_IMAGE_OPENING
);
this
.
focusOffset
=
(
Integer
)
_jobParameterCollection
.
getParameterValue
(
KEY_FOCUS_OFFSET
);
this
.
correctXY
=
(
Boolean
)
_jobParameterCollection
.
getParameterValue
(
KEY_CORRECT_XY
);
}
...
...
@@ -267,11 +305,11 @@ public class Job_FocusEmbryoAutoDatasetSplit extends Job_Default{
// start ImageJ
new
ImageJ
().
ui
().
showUI
();
String
tblPth
=
"
X
:\\
group\\Aliaksandr\\User_
dat
a
\\
Crocker-fly-feedback\\03082019_march_test
"
;
String
tblFnm
=
"summary_
t
est
03
_.txt"
;
String
tblPth
=
"
C
:\\
temp
dat\\
Raquel\\Raquel-LSM880_15042021_finok
"
;
String
tblFnm
=
"summary_
T
est
1
_.txt"
;
Job_FocusEmbryoAutoDatasetSplit
testJob
=
new
Job_FocusEmbryoAutoDatasetSplit
();
testJob
.
initialise
(
null
,
"Focus.Image"
,
false
);
testJob
.
testJobMicTable
(
11
,
tblPth
,
tblFnm
);
testJob
.
testJobMicTable
(
3
,
tblPth
,
tblFnm
);
}
}
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