-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Phil Tooley
committed
Apr 29, 2019
1 parent
8bee15a
commit 7aa6acb
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
testdata/integration/regression/mask_test_3d/create_3d_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import numpy as np | ||
|
||
from flannel import io as fio | ||
|
||
image_shape = (140, 100, 60) | ||
block_shape = (50, 40, 40) | ||
block1_fixed_offset = (10, 10, 10) | ||
block2_fixed_offset = (80, 10, 10) | ||
block1_moved_offset = (10, 50, 10) | ||
block2_moved_offset = (80, 50, 10) | ||
mask_shape = (70, 100, 60) | ||
mask_offset = (0, 0, 0) | ||
|
||
def slice_from_offsets(shape, offset): | ||
return tuple(slice(x, x+y) for x, y in zip(offset, shape)) | ||
|
||
|
||
def main(): | ||
"""Create 3D masking test data | ||
""" | ||
|
||
print("Saving fixed.image") | ||
fixed = np.zeros(image_shape) | ||
fixed[slice_from_offsets(block_shape, block1_fixed_offset)] = 1 | ||
fixed[slice_from_offsets(block_shape, block2_fixed_offset)] = 1 | ||
fio.save_image(fixed, "fixed.image") | ||
|
||
print("Saving moved.image") | ||
moved = np.zeros(image_shape) | ||
moved[slice_from_offsets(block_shape, block1_moved_offset)] = 1 | ||
moved[slice_from_offsets(block_shape, block2_moved_offset)] = 1 | ||
fio.save_image(moved, "moved.image") | ||
|
||
print("Saving mask.mask") | ||
mask = np.zeros(image_shape) | ||
mask[slice_from_offsets(mask_shape, mask_offset)] = 1 | ||
fio.save_mask(mask, "mask.mask") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fixed=fixed.image | ||
moved=moved.image | ||
nodespacing=10 | ||
registered=registered_nomask.xdmf | ||
map=map_nomask.xdmf | ||
save_intermediate_frames=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fixed=fixed.image | ||
moved=moved.image | ||
mask=mask.mask | ||
nodespacing=10 | ||
registered=registered_withmask.xdmf | ||
map=map_withmask.xdmf | ||
save_intermediate_frames=true |