-
Notifications
You must be signed in to change notification settings - Fork 327
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
feat: ROI threshold to consider two volumes for thresholding #325
feat: ROI threshold to consider two volumes for thresholding #325
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
The CI is failing with this error
|
@@ -10,6 +10,7 @@ type VolumeInputCallback = (params: { | |||
volumeActor: VolumeActor; | |||
/** unique volume Id in the cache */ | |||
volumeId: string; | |||
preset?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to put this here, the callback isn't getting a preset, it is using the preset
from the surrounding
@@ -21,14 +28,17 @@ export type ThresholdRangeOptions = { | |||
*/ | |||
function thresholdVolumeByRange( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add documentation to function since you changed the surface parameters
let hits, total; | ||
let range; | ||
|
||
// this callback function will test voxels in the finer volume and counts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finer volume -> volume with finer resolution
* @param options - the options for thresholding | ||
* @returns segmented volume | ||
*/ | ||
function thresholdVolumeByRange( | ||
segmentationVolume: Types.IImageVolume, | ||
referenceVolume: Types.IImageVolume, | ||
thresholdVolumeInformation: ThresholdInformation[], | ||
options: ThresholdRangeOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should explain in detail what are the overlap types (you have it in the paragraph below) Just add it in the @param options
instead of the code body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if (!overlapType) { | ||
overlapType = 0; // default is any overlap | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do this in the function argument by saying overlayType=0
to have it default to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
const overlapType = options?.overlapType || 0;
let overlaps, total, range; | ||
|
||
/** | ||
* As we are working with volumes of different dimensions, there will be no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence here is wrong as it is not always different dimensions. It should be something like "as there is a chance the volumes might have different dimensions and spacing ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const callbackOverlap = ({ value }) => { | ||
total = total + 1; | ||
if (value >= range.lower && value <= range.upper) { | ||
overlaps = overlaps + 1; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this inside testOverlapRange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for (let i = 0; i < 2; i++) { | ||
for (let j = 0; j < 2; j++) { | ||
for (let k = 0; k < 2; k++) { | ||
const point = voxelCenter; | ||
point[0] = point[0] + ((i * 2 - 1) * voxelSpacing[0]) / 2; | ||
point[1] = point[1] + ((j * 2 - 1) * voxelSpacing[1]) / 2; | ||
point[2] = point[2] + ((k * 2 - 1) * voxelSpacing[2]) / 2; | ||
voxelCornersWorld.push(point); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a wrong logic. The bounds (corners) to check depends on whether the referenceVoxelSpacing (you need to make that clear that is the other one spacing), is coarser or finer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But i guess the logic is true the other way around, what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you are right, please double check the two scenarios again.
The bounds should always be computed wrt the larger spacing, otherwise the overlaps are computed wrongly
Added spacing check between the segmentation volume and the volumes for range test to correctly define the base volume |
…tonejs#325) * Adding ROI Threshold based on multiple volumes * Add sliders for petVolume * Refactoring threshold function parameters * Working with LPS coords * Running required checks * Adding perfusion colormap * Fix CI error in PR * Fixing CI function parameter checking error * Fixing CI error related to api change * Removing unnecessary extra parameter * Minor parameter adjustment * Add test coverType option * Add some comments * Convert parameter in optional and set defaul value * Convert parameter in optional and set defaul value * Fixing CI errors * Refactoring and comment threshold functions * Refactoring code based on PR reviews * Add spacing check between volumes in roi threshold * fix build Co-authored-by: Alireza <[email protected]>
New feature : Add the possibility of use CT volume data in ROI Thresholding via rectangle tool