Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91422521
div_thresh_overlay.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 10, 23:20
Size
1 KB
Mime Type
text/x-python
Expires
Tue, Nov 12, 23:20 (2 d)
Engine
blob
Format
Raw Data
Handle
22261048
Attached To
R6289 Motion correction paper
div_thresh_overlay.py
View Options
from
skimage
import
io
import
numpy
as
np
import
cv2
#path = 'div_2_170608_fly1_007/div_l1000g0'
#path = 'div_4_170609_fly1_000/div_l1000g0'
path
=
'div_1_170426_fly1_013/div_l1000g0'
paths
=
[
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l100g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l200g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l300g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l400g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l500g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l600g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l700g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l800g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l900g10'
,
'/mnt/internal_hdd/aymanns/Chen2018/divergence/div_2_170608_fly1_007/div_l1000g10'
]
for
path
in
paths
:
div
=
io
.
imread
(
path
+
'/div_out.tif'
)
#wapred1 = io.imread(path+'/warped1.tif')
mask
=
np
.
where
(
div
<-
1.2
)
z
=
np
.
zeros
(
div
.
shape
,
dtype
=
np
.
uint8
)
z
[
mask
]
=
255
io
.
imsave
(
path
+
'/thresh_div.tif'
,
z
.
astype
(
np
.
float32
))
artefact
=
False
for
i
in
range
(
len
(
z
)):
#print(z[i])
output
=
cv2
.
connectedComponentsWithStats
(
z
[
i
],
8
,
cv2
.
CV_32S
)
#print(output[2])
stats
=
output
[
2
]
if
np
.
any
(
stats
[
1
:,
cv2
.
CC_STAT_AREA
]
>
20
):
print
(
i
,
stats
)
artefact
=
True
break
print
(
path
,
artefact
)
Event Timeline
Log In to Comment