| 101 | } |
| 102 | |
| 103 | public static boolean BasicImageTest() |
| 104 | { |
| 105 | long[] v = {1,1}; |
| 106 | VectorUInt32 idx = new VectorUInt32( v ); |
| 107 | |
| 108 | int size = 10; |
| 109 | short val = 42; |
| 110 | |
| 111 | Image image = new Image(size, size, PixelIDValueEnum.sitkUInt8); |
| 112 | |
| 113 | image.setPixelAsUInt8(idx, val); |
| 114 | |
| 115 | try |
| 116 | { |
| 117 | if (size != image.getWidth()) |
| 118 | { |
| 119 | throw new Exception("Bad width"); |
| 120 | } |
| 121 | } |
| 122 | catch (Exception e) |
| 123 | { |
| 124 | return false; |
| 125 | } |
| 126 | |
| 127 | short newval; |
| 128 | |
| 129 | newval = image.getPixelAsUInt8(idx); |
| 130 | |
| 131 | try |
| 132 | { |
| 133 | if (newval != val) |
| 134 | { |
| 135 | throw new Exception("Bad pixel value"); |
| 136 | } |
| 137 | } |
| 138 | catch (Exception e) |
| 139 | { |
| 140 | return false; |
| 141 | } |
| 142 | return true; |
| 143 | } |
| 144 | |
| 145 | public static boolean ImageBufferTest() |
| 146 | { |