After increasing the patchsize from 8x8x8 to 64x64x64 and adding a field "patch-spacing" with the "image-spacing", the adapter does not error for task 10, but for task 11 I get "AssertionError: Coordinates don't match!" for several patch sizes.
Perhaps I am not approaching the issue of sending my features to the platform correctly. My model outputs voxel features, where each voxel or small group of voxels is represented by an embedding of size C. Currently, I am trying to average the voxel features to obtain patch features.
Do you have an idea how I could verify my patch representations? I used SimpleITK for metadata handling to be able to reuse as much of the baseline code as possible. I adapted it like:
# voxel_features_original are voxel features (C, spatials...) with the exact same shape as sitk_image (no padding)
for x, y, z in itertools.product(
*[range(0, voxel_features_original.shape[dim + 1], patch_size[dim]) for dim in range(3)]
):
patch = voxel_features_original[
:,
x : x + patch_size[0],
y : y + patch_size[1],
z : z + patch_size[2],
]
patches.append(patch)
matrix_coordinates = (x, y, z)
coordinates.append(sitk_image.TransformIndexToPhysicalPoint(matrix_coordinates))
patch_and_coords = [
{
"coordinates": coordinates[i],
"features": torch.mean(patches[i], dim=(1, 2, 3)).tolist(),
}
for i in range(len(patches))
]
return [
{
"title": image_input["interface"]["slug"],
"patches": patch_and_coords,
"meta": {
"patch-size": list(patch_size),
"patch-spacing": list(sitk_image.GetSpacing()),
"image-size": list(sitk_image.GetSize()),
"image-origin": list(sitk_image.GetOrigin()),
"image-spacing": list(sitk_image.GetSpacing()),
"image-direction": list(sitk_image.GetDirection()),
},
}
]