Skip to content

GridPatchDataset or ordered SpatialCropSamples #719

@jillianlee

Description

@jillianlee

Is your feature request related to a problem? Please describe.
I was looking to train a 2D segmentation network on all the slices of a 3D volume. Currently, the GridPatchDataset is a bit odd to use? I get a few errors from just using the utils.misc.first function

grid_ds = monai.data.GridPatchDataset(check_ds_array, patch_size = (160, 160, 1))
check_loader = monai.data.DataLoader(grid_ds, batch_size=1)
check_data = monai.utils.misc.first(check_loader)

AttributeError: 'str' object has no attribute 'shape'

There also is no current getitem function for GridPatchDataset.

Describe the solution you'd like
Ideally it would be a transform that would take in an image of size (160, 160, N) and generate N arrays of size (160, 160).

Describe alternatives you've considered
Currently, there are issues #299 and #606 discussing random patch style datasets, both of which have been helpful. Issue 299 however seems to only take 1 single 2D sample from each input volume, instead of taking N samples along the Z direction.

In issue 606 you mention RandSpatialCropSamples which I have tried, but my concern is that it may re-sample the same random_center multiple times. A version or mode of this function that can generate samples in order, or a mode that can ensure each center is only randomly selected once would be great!

Thanks!
Jillian

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions