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

Allow unloaded channels to be enabled #179

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/aics-image-viewer/components/App/ChannelUpdater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ const ChannelUpdater: React.FC<ChannelUpdaterProps> = ({ index, channelState, vi
}, [...deps, image, version]);
};

useImageEffect(
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid Jan 9, 2024

Choose a reason for hiding this comment

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

Quick question because I'm not as familiar with this repo, what's different between useImageEffect and a useEffect dependent on image?

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, answered my own question. useImageEffect checks for changes to the image but only executes the body if the image is loaded.

(currentImage) => {
view3d.setVolumeChannelEnabled(currentImage, index, volumeEnabled);
view3d.updateLuts(currentImage);
},
[volumeEnabled]
);
// enable/disable channel can't be dependent on channel load state because it may trigger the channel to load
useEffect(() => {
if (image) {
view3d.setVolumeChannelEnabled(image, index, volumeEnabled);
view3d.updateLuts(image);
}
}, [image, volumeEnabled]);

useImageEffect(
(currentImage) => view3d.setVolumeChannelOptions(currentImage, index, { isosurfaceEnabled }),
[isosurfaceEnabled]
);
useEffect(() => {
if (image) {
view3d.setVolumeChannelOptions(image, index, { isosurfaceEnabled });
}
}, [image, isosurfaceEnabled]);

useImageEffect((currentImage) => view3d.setVolumeChannelOptions(currentImage, index, { isovalue }), [isovalue]);

Expand Down
Loading