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
ttk
spam
Commits
ed4db083
Commit
ed4db083
authored
Dec 11, 2020
by
Edward Andò
Browse files
[skip-ci] sketchy progress on pixelSearch
parent
5bba80f0
Pipeline
#55189
skipped
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
scripts/spam-ddic
View file @
ed4db083
...
...
@@ -392,8 +392,6 @@ if mpiRank == boss or not mpi:
imagette2
=
spam
.
helpers
.
slicePadded
(
im2
,
startStopIm2
)
# Catch
# point in im2 that we are searching around
searchCentre
=
(
numpy
.
array
(
imagette2
.
shape
,
dtype
=
'<f4'
)
-
1
)
/
2.0
+
labelDisplacementInt
-
middleOfSearchRange
#searchCentre = (numpy.array(imagette2.shape, dtype='<f4') - 1) / 2.0
...
...
scripts/spam-pixelSearch
View file @
ed4db083
...
...
@@ -372,8 +372,12 @@ returnStatus = numpy.ones((numberOfNodes), dtype=int)
# Add nodes to a queue -- mostly useful for MPI
q
=
queue
.
Queue
()
#for node in range(3):
for
node
in
range
(
numberOfNodes
):
if
args
.
LAB1
is
not
None
:
firstNode
=
1
else
:
firstNode
=
0
for
node
in
range
(
firstNode
,
numberOfNodes
):
q
.
put
(
node
)
finishedNodes
=
0
...
...
@@ -391,7 +395,36 @@ while finishedNodes != numberOfNodes:
# Get the next node off the queue
nodeNumber
=
q
.
get
()
imagetteReturns
=
getImagettes
(
nodePositions
[
nodeNumber
],
PhiField
[
nodeNumber
].
copy
(),
searchRange
.
copy
(),
boundingBoxes
[
nodeNumber
],
im1
,
im2
,
im1mask
,
args
.
MASK_COVERAGE
,
greyThreshold
)
if
args
.
LAB1
is
not
None
:
imagetteReturns
=
{}
gottenLabel
=
spam
.
label
.
getLabel
(
lab1
,
nodeNumber
,
boundingBoxes
=
boundingBoxes
,
centresOfMass
=
nodePositions
,
maskOtherLabels
=
True
,
labelDilate
=
args
.
LABEL_DILATE
,
margin
=
1
+
args
.
LABEL_DILATE
)
if
gottenLabel
is
not
None
:
imagetteReturns
[
'imagette1'
]
=
im1
[
gottenLabel
[
'slice'
]]
imagetteReturns
[
'imagette1mask'
]
=
gottenLabel
[
'subvol'
]
# 2020-09-25 OS and EA: Prepare startStop array for imagette 2 to be extracted with new slicePadded
startStopIm2
=
[
int
(
gottenLabel
[
'boundingBox'
][
0
]
-
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
0
]
),
int
(
gottenLabel
[
'boundingBox'
][
1
]
+
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
1
]
+
1
),
int
(
gottenLabel
[
'boundingBox'
][
2
]
-
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
2
]
),
int
(
gottenLabel
[
'boundingBox'
][
3
]
+
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
3
]
+
1
),
int
(
gottenLabel
[
'boundingBox'
][
4
]
-
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
4
]
),
int
(
gottenLabel
[
'boundingBox'
][
5
]
+
max
(
args
.
LABEL_DILATE
,
0
)
+
searchRange
[
5
]
+
1
)]
imagetteReturns
[
'imagette2'
]
=
spam
.
helpers
.
slicePadded
(
im2
,
startStopIm2
)
imagetteReturns
[
'searchRange'
]
=
searchRange
.
copy
()
imagetteReturns
[
'searchCentre'
]
=
nodePositions
[
nodeNumber
]
-
boundingBoxes
[
nodeNumber
,
0
::
2
]
-
searchRange
[
0
::
2
]
-
numpy
.
array
([
max
(
args
.
LABEL_DILATE
,
0
)]
*
3
)
imagetteReturns
[
'initialDisplacement'
]
=
PhiField
[
nodeNumber
,
0
:
3
,
3
].
astype
(
int
)
imagetteReturns
[
'returnStatus'
]
=
1
print
(
imagetteReturns
[
'imagette1'
].
shape
)
print
(
imagetteReturns
[
'imagette1mask'
].
shape
)
print
(
imagetteReturns
[
'imagette2'
].
shape
)
print
(
gottenLabel
[
'boundingBox'
])
print
(
startStopIm2
)
else
:
imagetteReturns
[
'returnStatus'
]
=
0
else
:
imagetteReturns
=
getImagettes
(
nodePositions
[
nodeNumber
],
PhiField
[
nodeNumber
].
copy
(),
searchRange
.
copy
(),
boundingBoxes
[
nodeNumber
],
im1
,
im2
,
im1mask
,
args
.
MASK_COVERAGE
,
greyThreshold
)
if
imagetteReturns
[
'returnStatus'
]
==
1
:
if
mpi
:
...
...
@@ -420,6 +453,7 @@ while finishedNodes != numberOfNodes:
searchRange
=
imagetteReturns
[
'searchRange'
],
searchCentre
=
imagetteReturns
[
'searchCentre'
])
initialDisplacement
=
imagetteReturns
[
'initialDisplacement'
]
print
(
returns
)
writeReturns
=
True
else
:
# Regardless of MPI or single proc
...
...
tools/DIC/correlate.py
View file @
ed4db083
...
...
@@ -830,6 +830,8 @@ def pixelSearch(imagette1, imagette2, imagette1mask=None, searchCentre=None, sea
topDiff
=
searchCentre
.
astype
(
int
)
-
imagette1halfWindowSize
+
searchRange
[
0
::
2
]
botDiff
=
numpy
.
array
(
imagette2
.
shape
)
-
searchCentre
.
astype
(
int
)
-
imagette1halfWindowSize
-
searchRange
[
1
::
2
]
print
(
"searchRange in:"
,
searchRange
)
# Check that the search range doesn't go outside imagette2, if it does, redact it
if
topDiff
[
0
]
<
0
:
searchRange
[
0
]
-=
topDiff
[
0
]
if
topDiff
[
1
]
<
0
:
searchRange
[
2
]
-=
topDiff
[
1
]
...
...
@@ -838,6 +840,8 @@ def pixelSearch(imagette1, imagette2, imagette1mask=None, searchCentre=None, sea
if
botDiff
[
1
]
<
0
:
searchRange
[
3
]
+=
botDiff
[
1
]
if
botDiff
[
2
]
<
0
:
searchRange
[
5
]
+=
botDiff
[
2
]
print
(
"searchRange out:"
,
searchRange
)
# Run the actual pixel search
# print imagette1.shape, imagette2.shape, searchCentre, searchRange
returns
=
numpy
.
zeros
(
4
,
dtype
=
'<f4'
)
...
...
tools/DIC/src/pixelSearchGC.cpp
View file @
ed4db083
...
...
@@ -109,13 +109,13 @@ void pixelSearch(py::array_t<float> im1Numpy,
// printf("zTop %i yTop %i xTop %i\n", zTop, yTop, xTop);
// // printf("zDisp %i yDisp %i xDisp %i\n", zDisp, yDisp, xDisp);
//
std::cout << "Tops: "<< zTop << " " << yTop << " " << xTop << "\n" << std::endl;
//
std::cout << "Bots: "<< zBot << " " << yBot << " " << xBot << "\n" << std::endl;
std
::
cout
<<
"Tops: "
<<
zTop
<<
" "
<<
yTop
<<
" "
<<
xTop
<<
"
\n
"
<<
std
::
endl
;
std
::
cout
<<
"Bots: "
<<
zBot
<<
" "
<<
yBot
<<
" "
<<
xBot
<<
"
\n
"
<<
std
::
endl
;
/* Check we're not outside the boundaries... */
if
(
zTop
>=
0
&&
yTop
>=
0
&&
xTop
>=
0
&&
zBot
<=
(
int
)
im2z
&&
yBot
<=
(
int
)
im2y
&&
xBot
<=
(
int
)
im2x
)
{
std
::
cout
<<
"yo"
<<
std
::
endl
;
/* reset calculations */
/* three components to our NCC calculation (see documentation/C-remi.odt) */
float
a
,
b
,
c
;
...
...
tools/helpers/optionsParser.py
View file @
ed4db083
...
...
@@ -2095,6 +2095,13 @@ def pixelSearch(parser):
type
=
argparse
.
FileType
(
'r'
),
help
=
"Path to tiff file containing a labelled image 1 that defines zones to correlate. Disactivates -hws and -ns options"
)
parser
.
add_argument
(
'-ld'
,
'--label-dilate'
,
type
=
int
,
default
=
1
,
dest
=
'LABEL_DILATE'
,
help
=
"Only if -lab1 is defined: Number of times to dilate labels. Default = 1"
)
parser
.
add_argument
(
'-mf1'
,
'--maskFile1'
,
dest
=
'MASK1'
,
...
...
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