Open Nic-Ma opened 4 years ago
Mark: @yiheng-wang-nv is working on this task, I will refactor the PosNegCrop related transforms when it's merged. Thanks.
Hi @wyli and @yiheng-wang-nv ,
I have a draft proposal in my simple mind: We can enhance or develop another utility for https://github.com/Project-MONAI/MONAI/blob/master/monai/transforms/utils.py#L191
RandCropByPosNegLabeld
transformMaybe we can convert to Tensor and execute on GPU to accelerate it?
Thanks.
Hi,
Thank you for this wonderful project.
File "/home/ramchand/.local/lib/python3.7/site-packages/monai/transforms/utils.py", line 334, in generate_pos_neg_label_crop_centers raise ValueError("The size of the proposed random crop ROI is larger than the image size.")
ValueError: The size of the proposed random crop ROI is larger than the image size. RuntimeError: applying transform <monai.transforms.croppad.dictionary.RandCropByPosNegLabeld object at 0x7ffecef93550>
Could you please help me to solve this error. as My image size is variable(no of slices are different in each nifti file.eg. (342, 342, 91) and I am using Unet. (128,128,128). I am using following combination of transform.
train_transforms = Compose( [ LoadImaged(keys=["image", "label"]), AddChanneld(keys=["image", "label"]), Spacingd(keys=["image", "label"], pixdim=( 1.5, 1.5, 1.0), mode=("bilinear", "nearest")), Orientationd(keys=["image", "label"], axcodes="RAS"), ScaleIntensityRanged( keys=["image"], a_min=-400, a_max=1500, b_min=0.0, b_max=1.0, clip=True, ), CropForegroundd(keys=["image", "label"], source_key="image"), RandCropByPosNegLabeld( keys=["image", "label"], label_key="label", spatial_size=(96, 96, 96), pos=1, neg=1, num_samples=4, image_key="image", image_threshold=0, ),ToTensord(keys=["image", "label"]), ] )
Thanks a million!
hi @ramchandracheke, could you create a new discussion and we'll try and help you there: https://github.com/Project-MONAI/MONAI/discussions.
Thanks @rijobro for your reply. Yes I will create it.
Is your feature request related to a problem? Please describe. Currently, the balance sampling’s positive window is defined by the corresponding label of the window’s central location. We need the flexibility to define the positive windows by thresholding the percentage of positive pixels in a window instead of only central data. Consider as "positive" a patch that has some foreground voxels anywhere above percentage, and "negative" a patch that has none (rather than looking at the central voxel only).
Hi, I am having the same issue described above. I would like to crop patches containing a certain percentage of positive or negative labels, instead of considering the center voxel only. Has this been solved somehow? Thanks
Is your feature request related to a problem? Please describe. Currently, the balance sampling’s positive window is defined by the corresponding label of the window’s central location. We need the flexibility to define the positive windows by thresholding the percentage of positive pixels in a window instead of only central data. Consider as "positive" a patch that has some foreground voxels anywhere above percentage, and "negative" a patch that has none (rather than looking at the central voxel only).