Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checks for mask size and dimensions. #223

Merged
merged 3 commits into from
Mar 24, 2017

Conversation

JoostJM
Copy link
Collaborator

@JoostJM JoostJM commented Mar 22, 2017

Add function to check if ROI is large enough for computation.
First checks if label is present in the mask, then checks if the number of dimensions in which the size > 1 is at least the minimum number of dimensions (default: 1). Finally an an optional check for a minimum number of voxels in the tumor region can be performed (switched off by default).

This check is performed in featureextractor after the loading of the image and any image pre-processing steps (e.g. resampling), but before features are extracted or filters applied.

Addresses #18
cc @Radiomics/developers

JoostJM added 3 commits March 24, 2017 12:01
Add function to check if ROI is large enough for computation. First checks if label is present in the mask, then checks if the number of dimensions in which the size > 1 is at least the minimum number of dimensions (default: 1). Finally an an optional check for a minimum number of voxels in the tumor region can be performed (switched off by default).

This check is performed in `featureextractor` after the loading of the image and any image pre-processing steps (e.g. resampling), but before features are extracted or filters applied.
Add a check that ensures that the ROI defined in the mask occupies a physical space that is contained within the physical space of the image. If this is not the case, log an error and cancel extraction for that combination.

Additionally, calculate the resampling grid using only the maskNode. This prevents unexpected behaviour of the defined resampling grid when image and mask with different geometry is used.

Standardize use of quote and double quote when defining strings in PyRadiomics (use single quote to identify a string, 3 double quotes for a docstring)
Add FAQ explaining PyRadiomics behavior when using image and mask with different geometry.

Additionally, add an example script, usable from the commandline, that resamples a mask to a reference image. This allows users to force a mask to the same geometry as the image, so it can be used in PyRadiomics without resampling.
@@ -74,7 +74,8 @@ def main():

provenance = extractor.getProvenance(imagePath, maskPath, mask)

image, mask, bb = imageoperations.cropToTumorMask(image, mask)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid using "Tumor". Maybe "cropToMaskBoundingBox", or "cropToMaskROI".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I understand this is not related to the essence of this specific PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I understand this is not related to the essence of this specific PR

No, it's not, but it's still a good suggestion. I am running over the documentation for errors, will update this then also.

@fedorov
Copy link
Collaborator

fedorov commented Mar 24, 2017

LGTM otherwise!

@JoostJM JoostJM merged commit ec8720b into AIM-Harvard:master Mar 24, 2017
@JoostJM JoostJM deleted the add-roi-checks branch March 24, 2017 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants