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

(extensions/cornerstone) more reusable cornerstone-extension and minor fixes, increased vtk 25.11.1 #3016

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ouwen
Copy link
Contributor

@Ouwen Ouwen commented Nov 11, 2022

Exposes some internals of extensions/cornerstone to be reusable.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for ohif-platform-viewer ready!

Name Link
🔨 Latest commit 84afd86
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-viewer/deploys/63de031fa4e9b600093e1db0
😎 Deploy Preview https://deploy-preview-3016--ohif-platform-viewer.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Nov 11, 2022

Deploy Preview for ohif-platform-docs canceled.

Name Link
🔨 Latest commit 84afd86
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/63de031fb5ebfa00090473cd

@codecov
Copy link

codecov bot commented Nov 11, 2022

Codecov Report

Merging #3016 (4bf3528) into v3-stable (9f1e813) will increase coverage by 13.11%.
The diff coverage is n/a.

❗ Current head 4bf3528 differs from pull request most recent head 84afd86. Consider uploading reports for the commit 84afd86 to get more accurate results

Impacted file tree graph

@@              Coverage Diff               @@
##           v3-stable    #3016       +/-   ##
==============================================
+ Coverage      25.15%   38.27%   +13.11%     
==============================================
  Files            119       98       -21     
  Lines           2862     2098      -764     
  Branches         555      432      -123     
==============================================
+ Hits             720      803       +83     
+ Misses          1856     1060      -796     
+ Partials         286      235       -51     
Impacted Files Coverage Δ
...tform/core/src/services/CineService/CineService.js 12.50% <0.00%> (-6.25%) ⬇️
.../services/MeasurementService/MeasurementService.js 47.23% <0.00%> (-1.96%) ⬇️
platform/core/src/classes/CommandsManager.js 90.69% <0.00%> (-1.14%) ⬇️
platform/core/src/classes/MetadataProvider.js 4.54% <0.00%> (-0.72%) ⬇️
...core/src/services/ToolBarService/ToolBarService.js 1.21% <0.00%> (-0.28%) ⬇️
platform/viewer/src/index.js 0.00% <0.00%> (ø)
platform/viewer/src/appInit.js 0.00% <0.00%> (ø)
platform/core/src/utils/index.js 100.00% <0.00%> (ø)
platform/core/src/utils/isImage.js 100.00% <0.00%> (ø)
platform/core/src/services/ServicesManager.js 100.00% <0.00%> (ø)
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 980b44f...84afd86. Read the comment docs.

@Ouwen Ouwen force-pushed the gradienthealth/update_cornerstone_extension branch 2 times, most recently from 4bf3528 to f0229d0 Compare November 21, 2022 06:58
@Ouwen Ouwen changed the title (extensions/cornerstone) expose setVolume, setStack events, and CornerstoneCacheService (extensions/cornerstone) more reusable cornerstone-extension and minor fixes, increased vtk 25.11.1 Nov 21, 2022
@Ouwen
Copy link
Contributor Author

Ouwen commented Nov 21, 2022

feat: increased vtk 25.11.1, more reusable cornerstone-extension and minor fixes

Reusability
 - Use React.forwardRef on cornerstone viewport to allow more reusability
 - disableHeader and viewerLayoutHeight optional props added to ViewerLayout
 - Disable border option added to viewpane and viewgridcomp of mode
 - Expose Expose getActiveViewportEnabledElement command
 - Expose setEnabledElement on common utils
 - Optional Overlay Disable Props

Fixes
 - Fix(Overlay was not grabbing instanceNumber)
 - Add resetCamera in commandsManager for VolumeViewport
 - Move CornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED so CornerstoneViewportService can update the active element before event fires
 - Fix CornerstoneCacheService reference
 - Filter requestImageIds to prevent null values
 - Reference Line error log

@sedghi awesome segmentation release.
I made some minor fixes to extensions/cornerstone based on some of behavior which I think are bugs.
I also exposed some of the extensions/cornerstone APIs so other modes/extensions could reuse services/utils/components.

@Ouwen Ouwen force-pushed the gradienthealth/update_cornerstone_extension branch 2 times, most recently from 1b122c3 to 54a0704 Compare November 21, 2022 07:17
Comment on lines +10 to +15
const {
disableViewportImageScrollbar,
disableViewportOverlay,
disableViewportImageSliceLoadingIndicator,
disableViewportOrientationMarkers,
} = props;
Copy link
Member

Choose a reason for hiding this comment

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

can we group these? maybe into viewportProperties or something? we are using viewportOptions in hanging protocol but I don't believe these belong there, maybe they do, what do you think?

} = props;

const [scrollbarHeight, setScrollbarHeight] = useState('100px');

const elementRef = useRef();

React.useImperativeHandle(ref, () => elementRef.current);
Copy link
Member

Choose a reason for hiding this comment

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

why you are adding a useImperativeHandle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If a parent passes ref into the DOM which is forwarded, it should refer to the internal elementRef.current

However, if a parent is not passing any ref, the internal of the component should still just rely on elementRef.

Comment on lines +34 to +35
VIEWPORT_STACK_SET: 'event::cornerstone::viewportservice:viewportstackset',
VIEWPORT_VOLUME_SET: 'event::cornerstone::viewportservice:viewportvolumeset',
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need these two events?
We already have STACK_VIEWPORT_NEW_STACK and VOLUME_VIEWPORT_NEW_VOLUME in cs3d

@@ -32,6 +32,8 @@ function ViewerLayout({
rightPanels = [],
leftPanelDefaultClosed = false,
rightPanelDefaultClosed = false,
disableHeader = false,
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment that this can be used for mobile use case for instance (since people might think why one wants to remove the toolbar)

@@ -352,7 +353,9 @@ export default function ModeRoute({
studyInstanceUIDs[0] !== undefined &&
renderLayoutData({
...layoutTemplateData.current.props,
ViewportGridComp: ViewportGridWithDataSource,
ViewportGridComp: ViewportGridWithDataSourceFactory(
layoutTemplateData.current?.props?.viewportGridProps
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this file should be touched. proprs that are returned from modes are layout specific, and all of them are passed to the layout specified (currently we have only one layout that accepts leftPanels, rightPanels). You can just use this viewportGridProps there

servicesManager,
viewportComponents,
dataSource,
modeViewportPaneStyles = {},
Copy link
Member

Choose a reason for hiding this comment

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

What is this, there are too many things happening. There is viewoprtGridProps, modeViewportPaneStyles and there is customStyle what is their relationship with each other

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm the challenge is in trying to customize the viewportPane. The desired feature is to turn on and off the border. To toggle this the Mode injects viewportGridProps = { modeViewportPaneStyles = {} }. I figured if there were future viewport grid props they could easily be added via the mode viewportGridProps config.

@Ouwen Ouwen force-pushed the gradienthealth/update_cornerstone_extension branch from 54a0704 to b73eee9 Compare February 1, 2023 03:44
…minor fixes

Reusability
 - Use React.forwardRef on cornerstone viewport to allow more reusability
 - disableHeader and viewerLayoutHeight optional props added to ViewerLayout
 - Disable border option added to viewpane and viewgridcomp of mode
 - Expose Expose getActiveViewportEnabledElement command
 - Expose setEnabledElement on common utils
 - Optional Overlay Disable Props

Fixes
 - Fix(Overlay was not grabbing instanceNumber)
 - Add resetCamera in commandsManager for VolumeViewport
 - Move CornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED so CornerstoneViewportService can update the active element before event fires
 - Fix CornerstoneCacheService reference
 - Filter requestImageIds to prevent null values
 - Reference Line error log
@Ouwen Ouwen force-pushed the gradienthealth/update_cornerstone_extension branch from b73eee9 to 84afd86 Compare February 4, 2023 07:02
@sedghi sedghi changed the base branch from v3-stable to master June 19, 2023 13:35
@sedghi
Copy link
Member

sedghi commented Jun 19, 2023

@Ouwen Also for this one, any one free you have to work on this?

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.

None yet

2 participants