diff --git a/frontend/javascripts/libs/format_utils.ts b/frontend/javascripts/libs/format_utils.ts index e56f0e1a28..9b29e05edb 100644 --- a/frontend/javascripts/libs/format_utils.ts +++ b/frontend/javascripts/libs/format_utils.ts @@ -513,9 +513,12 @@ export function formatBytes(nbytes: number) { } export function formatVoxels(voxelCount: number) { - if (voxelCount == null || !Number.isFinite(voxelCount)) { + if (voxelCount == null) { return ""; } + if (!Number.isFinite(voxelCount)) { + return "Infinity"; + } if (voxelCount > 2 ** 50) { return `${(voxelCount / 2 ** 50).toPrecision(4)} PVx`; } diff --git a/frontend/javascripts/oxalis/model/accessors/dataset_accessor.ts b/frontend/javascripts/oxalis/model/accessors/dataset_accessor.ts index 006efbbbb6..fc863b0a36 100644 --- a/frontend/javascripts/oxalis/model/accessors/dataset_accessor.ts +++ b/frontend/javascripts/oxalis/model/accessors/dataset_accessor.ts @@ -351,28 +351,13 @@ function getDatasetExtentAsProduct(extent: { height: number; depth: number; }) { - const safeMultiply = (a: number, b: number) => { - const result = a * b; - if (!Number.isFinite(result)) { - throw new Error("Dataset extent product exceeds maximum safe number"); - } - return result; - }; - return safeMultiply(safeMultiply(extent.width, extent.height), extent.depth); + return extent.width * extent.height * extent.depth; } export function getDatasetExtentInVoxelAsProduct(dataset: APIDataset) { - try { - return getDatasetExtentAsProduct(getDatasetExtentInVoxel(dataset)); - } catch (e) { - console.error(e); - } + return getDatasetExtentAsProduct(getDatasetExtentInVoxel(dataset)); } export function getDatasetExtentInUnitAsProduct(dataset: APIDataset) { - try { - return getDatasetExtentAsProduct(getDatasetExtentInUnit(dataset)); - } catch (e) { - console.error(e); - } + return getDatasetExtentAsProduct(getDatasetExtentInUnit(dataset)); } export function determineAllowedModes(settings?: Settings): { preferredMode: APIAllowedMode | null | undefined; diff --git a/frontend/javascripts/oxalis/view/right-border-tabs/dataset_info_tab_view.tsx b/frontend/javascripts/oxalis/view/right-border-tabs/dataset_info_tab_view.tsx index 545f630e4b..fd95bc5dfc 100644 --- a/frontend/javascripts/oxalis/view/right-border-tabs/dataset_info_tab_view.tsx +++ b/frontend/javascripts/oxalis/view/right-border-tabs/dataset_info_tab_view.tsx @@ -131,20 +131,17 @@ export function DatasetExtentRow({ dataset }: { dataset: APIDataset }) { const extentInLength = getDatasetExtentAsString(dataset, false); const extentProductInVx = getDatasetExtentInVoxelAsProduct(dataset); const extentProductInUnit = getDatasetExtentInUnitAsProduct(dataset); - const formattedExtentinUnit = - extentProductInUnit != null - ? formatNumberToVolume( - extentProductInUnit, - LongUnitToShortUnitMap[dataset.dataSource.scale.unit], - ) - : "Unable to calculate"; + const formattedExtentinUnit = formatNumberToVolume( + extentProductInUnit, + LongUnitToShortUnitMap[dataset.dataSource.scale.unit], + ); const renderDSExtentTooltip = () => { return (