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

Use the voi function, window and rescale of the decoded frame #601

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dougyau
Copy link
Contributor

@dougyau dougyau commented Nov 13, 2024

When decoding a single frame, frame_number is set to 1 but the voi_lut_function, the rescale and the window data is kept as an array. This change will use the data corresponding to the frame it will fallback to the first element if possible.

@dougyau dougyau changed the title Use the voi lut function, window and rescale corresponding to the frame Use the voi function, window and rescale of the decoded frame Nov 13, 2024
@Enet4 Enet4 added A-lib Area: library C-pixeldata Crate: dicom-pixeldata labels Nov 13, 2024
Comment on lines 2168 to 2169
} else if !rescale_data.is_empty() {
vec![rescale_data[0]]
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe even better:

Suggested change
} else if !rescale_data.is_empty() {
vec![rescale_data[0]]
} else if let Some(resc) = rescale_data.get(0) {
vec![*resc]

The same trick can be done in the other cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched the code from the if blocks to a functional style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lib Area: library C-pixeldata Crate: dicom-pixeldata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants