If transform requires 2D data, then convert to 2D by selecting the middle of the last dimension.
(data, ndim, is_map, is_post)
| 269 | |
| 270 | |
| 271 | def pre_process_data(data, ndim, is_map, is_post): |
| 272 | """If transform requires 2D data, then convert to 2D by selecting the middle of the last dimension.""" |
| 273 | if ndim == 2: |
| 274 | data = {k: v[..., v.shape[-1] // 2] for k, v in data.items()} |
| 275 | if is_map: |
| 276 | return data |
| 277 | return data[CommonKeys.LABEL] if is_post else data[CommonKeys.IMAGE] |
| 278 | |
| 279 | |
| 280 | def get_2d_slice(image, view: int, is_label): |
no outgoing calls
no test coverage detected
searching dependent graphs…