Skip to content

Commit 3731c42

Browse files
committed
DICOM: Use file index if positon and location tag is missing.
1 parent 740de91 commit 3731c42

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Assets/Scripts/Importing/DICOMImporter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ private class DICOMSliceFile
3333
private IEnumerable<string> fileCandidates;
3434
private string datasetName;
3535

36+
private int iFallbackLoc = 0;
37+
3638
public DICOMImporter(IEnumerable<string> files, string name = "DICOM_Dataset")
3739
{
3840
this.fileCandidates = files;
@@ -162,8 +164,9 @@ private DICOMSliceFile ReadDICOMFile(string filePath)
162164
}
163165
else
164166
{
165-
Debug.LogError($"Missing location/position tag in file: {filePath}.\n The file will not be imported");
166-
return null;
167+
Debug.LogError($"Missing location/position tag in file: {filePath}.\n The file will not be imported correctly.");
168+
// Fallback: use counter as location
169+
slice.location = (float)iFallbackLoc++;
167170
}
168171

169172
// Read intercept

0 commit comments

Comments
 (0)