Skip to content

Commit

Permalink
Merge pull request #687 from PaulHax/mem-cap
Browse files Browse the repository at this point in the history
feat(updateRenderedImage): set max image bytes to 1073741824
  • Loading branch information
thewtex authored May 9, 2023
2 parents 75236a2 + e5867b5 commit 8fd7a7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Rendering/VTKJS/Images/updateRenderedImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { worldBoundsToIndexBounds } from '../../../IO/MultiscaleSpatialImage'
import componentTypeToTypedArray from '../../../IO/componentTypeToTypedArray'

export const RENDERED_VOXEL_MAX = 512 * 512 * 512 * 2
const RENDERED_IMAGE_BYTES_MAX = 837970176
const RENDERED_IMAGE_BYTES_MAX = RENDERED_VOXEL_MAX * 2 // 2 byte pixel type = 1073741824

const getVoxelCount = async (image, bounds, scale) => {
const scaleInfo = image.scaleInfo[scale]
Expand Down Expand Up @@ -95,7 +95,7 @@ async function updateRenderedImage(context) {
)

const imageByteSize = await computeBytes(baseImage, voxelCount)
if (imageByteSize > RENDERED_IMAGE_BYTES_MAX)
if (!isCoarsestScale && imageByteSize > RENDERED_IMAGE_BYTES_MAX)
throw new Error(
`Image byte count over max at scale ${targetScale}. Requested: ${imageByteSize} Max: ${RENDERED_IMAGE_BYTES_MAX}`
)
Expand Down

0 comments on commit 8fd7a7a

Please sign in to comment.