|
| 1 | +/** |
| 2 | + * |
| 3 | + */ |
| 4 | +package inra.ijpb.label.distmap; |
| 5 | + |
| 6 | +import ij.ImageStack; |
| 7 | +import inra.ijpb.data.image.ImageUtils; |
| 8 | + |
| 9 | +/** |
| 10 | + * A collection of static method for creating test images shared by different |
| 11 | + * test cases. |
| 12 | + */ |
| 13 | +public class TestImages |
| 14 | +{ |
| 15 | + /** |
| 16 | + * Creates a test image composed of eight cuboids with various sizes. |
| 17 | + * |
| 18 | + * @return a test image composed of eight cuboids with various sizes. |
| 19 | + */ |
| 20 | + public static final ImageStack createStack_eightCuboids() |
| 21 | + { |
| 22 | + ImageStack stack = ImageStack.create(15, 15, 15, 8); |
| 23 | + ImageUtils.fillRect3d(stack, 1, 1, 1, 3, 3, 3, 3); |
| 24 | + ImageUtils.fillRect3d(stack, 5, 1, 1, 9, 3, 3, 4); |
| 25 | + ImageUtils.fillRect3d(stack, 1, 5, 1, 3, 9, 3, 7); |
| 26 | + ImageUtils.fillRect3d(stack, 5, 5, 1, 9, 9, 3, 8); |
| 27 | + ImageUtils.fillRect3d(stack, 1, 1, 5, 3, 3, 9, 11); |
| 28 | + ImageUtils.fillRect3d(stack, 5, 1, 5, 9, 3, 9, 12); |
| 29 | + ImageUtils.fillRect3d(stack, 1, 5, 5, 3, 9, 9, 15); |
| 30 | + ImageUtils.fillRect3d(stack, 5, 5, 5, 9, 9, 9, 17); |
| 31 | + |
| 32 | + return stack; |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Creates a test image composed of eight adjacent cubes that also touch the |
| 37 | + * image borders. |
| 38 | + * |
| 39 | + * @return a test image composed of eight adjacent cubes. |
| 40 | + */ |
| 41 | + public static final ImageStack createStack_eightAdjacentCubes() |
| 42 | + { |
| 43 | + ImageStack stack = ImageStack.create(10, 10, 10, 8); |
| 44 | + ImageUtils.fillRect3d(stack, 0, 0, 0, 5, 5, 5, 3); |
| 45 | + ImageUtils.fillRect3d(stack, 5, 0, 0, 5, 5, 5, 4); |
| 46 | + ImageUtils.fillRect3d(stack, 0, 5, 0, 5, 5, 5, 7); |
| 47 | + ImageUtils.fillRect3d(stack, 5, 5, 0, 5, 5, 5, 8); |
| 48 | + ImageUtils.fillRect3d(stack, 0, 0, 5, 5, 5, 5, 11); |
| 49 | + ImageUtils.fillRect3d(stack, 5, 0, 5, 5, 5, 5, 12); |
| 50 | + ImageUtils.fillRect3d(stack, 0, 5, 5, 5, 5, 5, 15); |
| 51 | + ImageUtils.fillRect3d(stack, 5, 5, 5, 5, 5, 5, 17); |
| 52 | + |
| 53 | + return stack; |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * private constructor to prevent instantiation. |
| 58 | + */ |
| 59 | + private TestImages() |
| 60 | + { |
| 61 | + } |
| 62 | +} |
0 commit comments