Skip to content

Commit 551641e

Browse files
authored
Merge pull request #745 from Kitware/fix-slice-with-numberofframes
fix(dicom): load images with NumberOfFrames == 1
2 parents c3bee77 + 19f0ef6 commit 551641e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/utils/allocateImageFromChunks.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
55
import { Vector3 } from '@kitware/vtk.js/types';
66
import { mat3, vec3 } from 'gl-matrix';
77
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
8-
import { vtkWarningMacro } from '@kitware/vtk.js/macros';
98

109
const ImagePositionPatientTag = NAME_TO_TAG.get('ImagePositionPatient')!;
1110
const ImageOrientationPatientTag = NAME_TO_TAG.get('ImageOrientationPatient')!;
@@ -90,10 +89,13 @@ export function allocateImageFromChunks(sortedChunks: Chunk[]) {
9089
? Number(meta.get(NumberOfFrames))
9190
: null;
9291

93-
// If we have NumberOfFrames, chances are it's a multi-frame DICOM.
94-
if (numberOfFrames !== null && sortedChunks.length > 1) {
95-
vtkWarningMacro(
96-
'Found a multi-frame chunk in a group of chunks of size > 1'
92+
if (
93+
numberOfFrames !== null &&
94+
numberOfFrames > 1 &&
95+
sortedChunks.length > 1
96+
) {
97+
throw new Error(
98+
'First chunk in a group of chunks (size > 1) is a multi-frame chunk'
9799
);
98100
}
99101

0 commit comments

Comments
 (0)