Feat: Axis-based Image Stretching#2443
Conversation
|
@sedghi when you have a moment, could you kindly review this PR at your earliest convenience? |
|
how we can test it? |
@sedghi Added an example demonstrating the stretch behavior in |
|
Are you aware of other viewers how they do this feature? i'm trying to evaluate the result at least to some other library or product that has this feature |
|
Hi, |
|
@jmannau lovely, would you be able to test this PR against the viewer you have? |
|
Happy to. But we’re very short on time until the new year. I’ll see what we can do |
|
@jmannau We are aiming to include this change along with the CS3D dependent version of the upcoming OHIF 3.12 release, which is expected to be released later this year. Thank you! |
|
We need to define some requirements as part of this change for what it is that the circle, sphere and elliptical tools are doing. Circle and circle brushes are harder because of the differences in how things get saved. The circle brush is never saved in image coordinates, so I think we could fairly easily display a circle in the current transformed coordinates. |
|
For the volume (mpr and 3d) use cases, we should define what the aspect ratio means and how it applies in terms of the transform. In general, one can have 3 vectors that the transform is applied along, and those 3 are orthonormal, with a scaling factor defining them. I think this is something we need to figure out how to incorporate into the transform directly rather than trying to figure out which axial/sagittal/coronal it is closest to. That may actually be easier if we used a generic canvas stretch direction vector and orthogonal scale vector rather than x,y scaling. That way the transform for rotation simply rotates the stretch vector. |
ac399d7 to
e54895a
Compare
|
@wayfarer3130 The implementation has been updated to use canvas-space stretching, ensuring that the stretch is applied relative to the canvas axes regardless of the MPR view rotation. This maintains consistent stretching behavior even when the image is rotated. Could you please re-review the PR and share your feedback? |
|
@wayfarer3130 Could you please take a look at this PR and provide your feedbacks? |
…/arul-trenser/cornerstone3D into feat-axis-based-image-stretching
wayfarer3130
left a comment
There was a problem hiding this comment.
It is looking close - I added the ability to test with CPU rendering, and to have different viewport types, with the crosshairs bound to ctrl+click to allow orientation changes.
I am still noticing the changing the aspect ratio does not fit to viewport. I suspect you need a reset camera operation that has a don't change aspect ratio and that it should get called when you change the aspect ratio. Then, the fit to viewport needs to take into account the updated aspect ratio size.
Keeping the image fitted to the viewport after applying aspect ratio changes would cause the image to shrink rather than stretch. The intended behavior of the stretch feature is to keep the image centered and expand it outward along the selected axis while preserving the original size of the non-stretched axis. This allows users to view and annotate details more accurately in parallel to the stretched direction. Could you share the use case for refitting the image to the viewport after stretching? Understanding this use case will help us assess whether supporting this behavior as the default would be beneficial to end users. Thanks! cc: @kgoettler |
Fixed the above scenario by adding a configuration option to control whether the viewport should fit after applying the stretch. The current default behavior is to fit the viewport after stretch. @wayfarer3130 Could you please take a look at this PR and provide your feedbacks? |
|
@arul-trenser - could you fix the OHIF downstream tests? This should be passing for those. |
The point is to be able to visually see fractures or other features that are narrow in the direction of stretch and wide orthogonal For example, rib fractures. If the zoom factor is reset so that the image stays in view, then the user can then use the zoom and pan tools to go through the entire image to look for such features. If they have adjusted it and don't initially see the full image, it is possible that a small portion of the image will not be visible AND will not be noticed to be offscreen. So, in terms of safety I would prefer to start with displaying the full image after changing the aspect ratio. |


Context
Changes & Results
This PR introduces axis-based image stretching using camera projection matrix manipulation.
Usage Example
Stretch along the X-axis:
Stretch along the X-axis:
Testing
Basic Stretching along X and Y axis:
axialBasedStretching.mp4
Segmentation Brush Tool Behavior in Stretched Viewport:
brushWorkingWithStretch.mp4
Circle ROI Tool Behavior in Stretched Viewport
circleAnnotationInStretch.mp4
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment