Skip to content
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
2 changes: 2 additions & 0 deletions src/dicom.imageio/dicominput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ DICOMInput::seek_subimage(int subimage, int miplevel)

m_spec = ImageSpec(m_img->getWidth(), m_img->getHeight(), nchannels,
format);
if (!check_open(m_spec, { 0, 1 << 20, 0, 1 << 20, 0, 1 << 16, 0, 1 << 16 }))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's a very big image... 62bits required if utilizing the entire space there :) I wasn't able to find the format limits going through their docs but this seems reasonable until we're told otherwise.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These are the limits on individual dimensions. There's a separate limit on the total (w x h x d x chans x channelsize). It won't really allocate for a 1M x 1M image unless the app raises that limit via an attribute, but why not let it do 1M x 16? DICOM is for scientific and medical data, so it may have weirder shapes than the kinds of images that we generally use.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, still protected by "imagesize_MB" setting, it was just a general "Wow that would be a big image, I hope the doc never needs something like that for me."

return false;

m_bitspersample = m_img->getDepth();
if (size_t(m_bitspersample) != m_spec.format.size() * 8)
Expand Down
Loading