Get the example data to be used. Use MarsAtlas as it only contains 1 image for quick download and that image is parcellated.
(keys)
| 201 | |
| 202 | |
| 203 | def get_data(keys): |
| 204 | """Get the example data to be used. |
| 205 | |
| 206 | Use MarsAtlas as it only contains 1 image for quick download and |
| 207 | that image is parcellated. |
| 208 | """ |
| 209 | cache_dir = MONAIEnvVars.data_dir() or tempfile.mkdtemp() |
| 210 | fname = "MarsAtlas-MNI-Colin27.zip" |
| 211 | url = "https://www.dropbox.com/s/ndz8qtqblkciole/" + fname + "?dl=1" |
| 212 | out_path = os.path.join(cache_dir, "MarsAtlas-MNI-Colin27") |
| 213 | zip_path = os.path.join(cache_dir, fname) |
| 214 | |
| 215 | download_and_extract(url, zip_path, out_path) |
| 216 | |
| 217 | image, label = sorted(glob(os.path.join(out_path, "*.nii"))) |
| 218 | |
| 219 | transforms = Compose( |
| 220 | [ |
| 221 | LoadImaged(keys), |
| 222 | EnsureChannelFirstd(keys), |
| 223 | ScaleIntensityd(CommonKeys.IMAGE), |
| 224 | Rotate90d(keys, spatial_axes=(0, 2)), |
| 225 | ] |
| 226 | ) |
| 227 | data = transforms({CommonKeys.IMAGE: image, CommonKeys.LABEL: label}) |
| 228 | max_size = max(data[keys[0]].shape) |
| 229 | padder = SpatialPadd(keys, (max_size, max_size, max_size)) |
| 230 | return padder(data) |
| 231 | |
| 232 | |
| 233 | def update_docstring(code_path, transform_name): |
no test coverage detected
searching dependent graphs…