Skip to content

Conversation

@Celian-abd
Copy link
Contributor

Context

(Remake of #2408)
Currently, even if we set the PT volumeId into the configuration of Rectangle/Circle/EllipticalRoiTools, it will always show the cachedStats of the CT on the fusion viewport.

As we can see here :

Capture d’écran 2025-10-20 164430

Changes & Results

  • Added a way to check if a volumeId is provided in the tool configuration
  • Select the correct cachedStats to show following the volumeId

If we set PT volumeId in the tool configuration :
Capture d’écran 2025-10-20 164845

Testing

Example PET-CT
You can modify or delete the prefered volumeId in the tool configuration :
fusionToolGroup.addTool(RectangleROITool.toolName, { volumeId: ptVolumeId });

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

@sedghi sedghi requested a review from wayfarer3130 October 22, 2025 13:10
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

LGTM, let's see what Bill says

@wayfarer3130
Copy link
Collaborator

I'm not at all keen on having more volume id specific tools - that means you have to know exactly what volumes to use when you create creating the tool group, and when you make any changes to the volumes available, they have to apply to the tool group.
I'd much rather see some sort of filter allowing a TYPE of volume to be applied based on some sort of criteria. For example, in this case just having a filter of modality = PT would work.
If it is necessary to identify the specific volumes, it should be disconnected from the tool group, and instead isolate that knowledge in a separate class. For example, it would be possible to provide a Set class with volume ids in it, and that class could provide notifications when the volume ids in it change so that as a new volume got loaded, it could be added to the right volume set class.

Copy link
Member

sedghi commented Oct 22, 2025

I like the idea, but asking people to do this would be a breaking change since i think we already say use volumeId. I suggest we implement it in the next version.

@salimkanoun
Copy link
Contributor

Hi there I agree with both of you, the current implementation is too complex.
However using modality is probably not enough neither as I saw fused MRI on which you fuse ADC and T1/T2 series so both will be MR modality.

I would suggest to use image index in the viewport, as you can control it in the hanging protocol I think it might be possible to specify which image index is used by the tool group.

* Used for deciding which set of cached stats is appropriate to display
* for a given viewport.
*/
public static isSpecifiedTargetId(desiredTargetId: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Celian-abd - my preference is to provide a function that determines the preferred target id rather than hard coding the value. That way it is possible to have more flexible determination and to work with multiple merged viewports at a single time by creating a custom function that works against both viewports.

* for a given viewport.
*/
public static isSpecifiedTargetId(desiredTargetId: string) {
return (_viewport, { targetId }) => targetId.includes(desiredTargetId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sedghi - this code is wrong as the target id doesn't have to include the desired target id as a substring in general. The right solution is to get the volume id associated with the given image id, and check for equality. HOwever, without passing in the set of image ids associated with the volume, I don't see an easy way of doing that. Should I just pass in a Set of the image ids that are preferred and use imageIds.has(imageId)?

@wayfarer3130
Copy link
Collaborator

@sedghi - I've updated the PR with changes that I think should work with the API generally. It isn't perfect, but I think is acceptable as the API should be fairly future compatible.
@Celian-abd - can you look at the change I made and add your agreement that they resolve your issue?

@wayfarer3130 wayfarer3130 requested a review from sedghi October 24, 2025 14:03
@Celian-abd
Copy link
Contributor Author

@wayfarer3130 Looks good to me, thanks a lot !

@sedghi
Copy link
Member

sedghi commented Oct 29, 2025

@wayfarer3130 can you fix the volumeId and imageid thing i sent in slack and we merge this

@wayfarer3130
Copy link
Collaborator

@wayfarer3130 can you fix the volumeId and imageid thing i sent in slack and we merge this

@sedghi - it really wasn't clear what you wanted changed from the comment in slack

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.

4 participants