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

feat: Segmentation state restructure to add main representation #19

Merged
merged 20 commits into from
Mar 28, 2022

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Mar 26, 2022

  • re work the segmentation state to include segmentation main representation and derived representations

Copy link
Member

@swederik swederik left a comment

Choose a reason for hiding this comment

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

Minor comments! LGTM

getSegmentationState,
getSegmentationDataByUID,
getSegmentationRepresentations,
getSegmentationRepresentationByUID,
Copy link
Member

Choose a reason for hiding this comment

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

Is the ByUID necessary? How else would you get it. Don't we have gets notation, not getAnnotationByUID? Let's try to be consistent with whatever we have for annotations

Copy link
Member Author

Choose a reason for hiding this comment

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

makes sense, one thing: are we keeping getSegmentationRepresentations or getRepresentations and getRepresentation? I like the getRepresentation (without segmentation), since it is derived from csTools.segmentation.state.getRepresentation, Don't know really .....
Also I guess you have mentioned somewhere else that getSegmentationRepresentations sounds like it will return the representations FOR a segmentation (which is not the case), and it is returning ALL segmentation representations for a ToolGroup.

Copy link
Member Author

Choose a reason for hiding this comment

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

tagging @JamesAPetts

Copy link
Member Author

Choose a reason for hiding this comment

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

James: one end point with optional ids as second argument, getSegmentationRepresentations

*
* @param toolGroupId - the UID of the tool group that contains the
* segmentation
* @param segmentIndex - the index of the segment to lock/unlock
* @param locked - boolean
*/
// Todo: shouldn't this be a based on a segmentationUID instead of a toolGroupId?
// Todo: shouldn't this be a based on a segmentationId instead of a toolGroupId?
Copy link
Member

@swederik swederik Mar 26, 2022

Choose a reason for hiding this comment

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

Yes I think it should, since currently we don't allow locking to occur in local toolgroups, only at the global level...

I can imagine it might be easy to have an API to do it for whatever is currently active, so maybe we should keep this and rename it? setSegmentIndexLockedInActiveSegmentation? But I hate how much of a duplicate it would be. Consumer could easily write it themselves

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I don't like it either, but now sure what is the best way. Tagging @JamesAPetts

Copy link
Member Author

Choose a reason for hiding this comment

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

setSegmentIndexLocked that gets the segmentationId, segmentIndex, locked

common/reviews/api/tools.api.md Show resolved Hide resolved
segmentationInputArray: SegmentationPublicInput[]
): void {
if (!segmentationInputArray || !segmentationInputArray.length) {
throw new Error('The segmentationInputArray undefined or empty array')
Copy link
Member

Choose a reason for hiding this comment

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

is undefined or an empty array

packages/tools/src/types/LabelmapTypes.ts Outdated Show resolved Hide resolved
packages/tools/src/types/SegmentationStateTypes.ts Outdated Show resolved Hide resolved
@@ -94,7 +94,7 @@ describe('Segmentation State -- ', () => {
this.renderingEngine.destroy()
metaData.removeProvider(fakeMetaDataProvider)
unregisterAllImageLoaders()
ToolGroupManager.destroyToolGroupByToolGroupId('segToolGroup')
ToolGroupManager.destroyToolGroupById('segToolGroup')
Copy link
Member

Choose a reason for hiding this comment

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

do we need ById? What else would you destroy it with?

Copy link
Member Author

Choose a reason for hiding this comment

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

@JamesAPetts what do you think

@swederik swederik merged commit b6eda97 into main Mar 28, 2022
@swederik swederik deleted the segmentation-state-restructure branch March 28, 2022 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants