(full_vol_dim, crop_size)
| 201 | |
| 202 | |
| 203 | def find_random_crop_dim(full_vol_dim, crop_size): |
| 204 | assert full_vol_dim[0] >= crop_size[0], "crop size is too big" |
| 205 | assert full_vol_dim[1] >= crop_size[1], "crop size is too big" |
| 206 | assert full_vol_dim[2] >= crop_size[2], "crop size is too big" |
| 207 | |
| 208 | if full_vol_dim[0] == crop_size[0]: |
| 209 | slices = crop_size[0] |
| 210 | else: |
| 211 | slices = np.random.randint(full_vol_dim[0] - crop_size[0]) |
| 212 | |
| 213 | if full_vol_dim[1] == crop_size[1]: |
| 214 | w_crop = crop_size[1] |
| 215 | else: |
| 216 | w_crop = np.random.randint(full_vol_dim[1] - crop_size[1]) |
| 217 | |
| 218 | if full_vol_dim[2] == crop_size[2]: |
| 219 | h_crop = crop_size[2] |
| 220 | else: |
| 221 | h_crop = np.random.randint(full_vol_dim[2] - crop_size[2]) |
| 222 | |
| 223 | return (slices, w_crop, h_crop) |
| 224 | |
| 225 | |
| 226 | def find3Dlabel_boundaries(segmentation_map): |
no outgoing calls
no test coverage detected