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(vtkPiecewiseWidget): Support vertical movement of points #488

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

bnmajor
Copy link
Contributor

@bnmajor bnmajor commented Nov 6, 2023

Vertical shift is allowed when holding control and left-click+dragging up/down. Shifting the points changes opacity.

Initial pass at fixing #188

Copy link

netlify bot commented Nov 6, 2023

Deploy Preview for volview-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a998a42
🔍 Latest deploy log https://app.netlify.com/sites/volview-dev/deploys/65539cc2becfcd00081395a3
😎 Deploy Preview https://deploy-preview-488--volview-dev.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 configuration.

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 6, 2023

@aylward @floryst I would love some feedback to make sure this is on track/meets the expectations of the issue. Thanks!

@aylward
Copy link
Contributor

aylward commented Nov 6, 2023

Looks great...but I think the opacity value is inverted...

When I raise up the opacity curve...more becomes transparent...
image

And when I lower it, less becomes transparent...
image

This seems to be the opposite of what I'd expect and what the transfer function curve shows...

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 7, 2023

Looks great...but I think the opacity value is inverted...

I am sorry about that, the values are fixed now!

@aylward aylward assigned aylward and unassigned aylward Nov 7, 2023
@aylward aylward self-requested a review November 7, 2023 16:20
Copy link
Contributor

@aylward aylward left a comment

Choose a reason for hiding this comment

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

LGTM!

@aylward
Copy link
Contributor

aylward commented Nov 7, 2023

Actually - one request, if the opacity value is 0, let's not cause it to shift (that is, only apply the increase/decrease to non-zero opacity values - zero should always remain zero. That way, the user will be able to select/threshold the background and change the non-zero opacities assigned to the data up/down without the background becoming an issue.

Copy link
Contributor

@aylward aylward left a comment

Choose a reason for hiding this comment

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

Please see follow-on comment for one more change request - zero opacity values should always remain zero, i.e., should not be shifted up/down.

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 7, 2023

Actually - one request, if the opacity value is 0, let's not cause it to shift (that is, only apply the increase/decrease to non-zero opacity values - zero should always remain zero. That way, the user will be able to select/threshold the background and change the non-zero opacities assigned to the data up/down without the background becoming an issue.

Makes sense! I've pushed a change to handle this so only non-zero values are shifted.

@aylward
Copy link
Contributor

aylward commented Nov 7, 2023

Weird...without changing anything, the appearance of the prostatex MRI is different in your version:

Here is the original default rendering
image

Here is the default render provided by your version
image

This version perhaps has some kind of color saturation happening?
image

...Using your controls to slightly reduce global opacity removes the weird effect. So, perhaps your global opacity begins with a non-zero value or such?

@aylward
Copy link
Contributor

aylward commented Nov 7, 2023

Also - maybe you need to clip opacities to 1.0. If I raise the global opacity really high using an all white transfer function (white is the only color in the transfer function), black stuff still appears and some odd shading wonkiness happens...

image

// Non-zero values should be affected by shift
// but preset values of zero should not
const shifted = y - shiftAlpha;
const yVal = y || shifted ? shifted : -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not certain || shifted is needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should also clip range?

@floryst
Copy link
Collaborator

floryst commented Nov 8, 2023

Sorry for ambiguity of the review. I meant to specify that ctrlKeyIsDown should be renamed to something more descriptive, since (1) it's not obvious what it does and (2) we don't want to imply that the ctrl key is the only key we can use for controlling the vertical/alpha opacity shift.

You can revert 9c8bc0d. As an aside, the naming of opacityShiftAlpha is mostly fine, though "alpha" and "opacity" generally refer to the same concept.

@aylward
Copy link
Contributor

aylward commented Nov 8, 2023

All issues I had found have been resolved. Works great!!

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 8, 2023

Sorry for ambiguity of the review. I meant to specify that ctrlKeyIsDown should be renamed to something more descriptive, since (1) it's not obvious what it does and (2) we don't want to imply that the ctrl key is the only key we can use for controlling the vertical/alpha opacity shift.

You can revert 9c8bc0d.

Ah, I'm sorry for the misunderstanding there. That makes sense.

As an aside, the naming of opacityShiftAlpha is mostly fine, though "alpha" and "opacity" generally refer to the same concept.

Agreed, the name is redundant. We're really just shifting the values so what about:

  • ctrlKeyIsDown -> shiftOpacityValues
  • opacityAlphaShift -> opacityValueShift

@bnmajor bnmajor force-pushed the shift-opacity branch 2 times, most recently from d021471 to 2a706ab Compare November 8, 2023 18:07
@aylward
Copy link
Contributor

aylward commented Nov 8, 2023

Still works great!

This is an outstanding extension - can create exceptionally nice views quickly.

One question - why CTRL and not SHIFT?

s

@aylward
Copy link
Contributor

aylward commented Nov 8, 2023

Oops - just found a bug...switch to certain transfer functions, and this happens...

Untitled video - Made with Clipchamp

I think the transfer function is correct - but the display of that transfer function over the histogram is wrong.

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 8, 2023

Still works great!

This is an outstanding extension - can create exceptionally nice views quickly.

One question - why CTRL and not SHIFT?

s

Great question! No reason, happy to change it to shift (or any key that might be preferred)

@bnmajor
Copy link
Contributor Author

bnmajor commented Nov 8, 2023

Oops - just found a bug...switch to certain transfer functions, and this happens...
I think the transfer function is correct - but the display of that transfer function over the histogram is wrong.

Funky... I'll check that out.

@bnmajor bnmajor changed the title feat(vtkPiecewiseWidget): Support horizontal movement of points feat(vtkPiecewiseWidget): Support vertical movement of points Nov 8, 2023
@aylward
Copy link
Contributor

aylward commented Nov 8, 2023

One more bug - seems like the transfer function being used by the LOD-reduced rendering is not being updated - only the final / high-quality transfer function is being adjusted.

You can see this by adjusting the opacity higher, and then moving the image - while moving it uses the un-adjusted transfer function with the LOD-reduced image. When you stop, it generates the high-quality image using the shifted opacities...

Untitled video - Made with Clipchamp (1)

@bnmajor bnmajor force-pushed the shift-opacity branch 2 times, most recently from 055df79 to d9c2986 Compare November 9, 2023 19:57
@aylward
Copy link
Contributor

aylward commented Nov 9, 2023

All looks good to me!

@floryst
Copy link
Collaborator

floryst commented Nov 13, 2023

Agreed, the name is redundant. We're really just shifting the values so what about:

  • ctrlKeyIsDown -> shiftOpacityValues
  • opacityAlphaShift -> opacityValueShift

These names sound good to me. Let's go with these renames.

Vertical shift is allowed when holding control and left-click+dragging up/down.
Shifting the points changes opacity.
The opacity should be increased when the points are shifted up and decreased
when shifted down.
@aylward
Copy link
Contributor

aylward commented Nov 14, 2023

FYI: Still works great!

@floryst
Copy link
Collaborator

floryst commented Nov 14, 2023

LGTM!

@floryst floryst added this pull request to the merge queue Nov 14, 2023
Merged via the queue into Kitware:main with commit 411e5a8 Nov 14, 2023
6 checks passed
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.

3 participants