Skip to content

Commit d3f3121

Browse files
committed
Over zealous XA enhanced DICOM warnings (#949)
1 parent 3604dd0 commit d3f3121

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

console/makefile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,30 @@ endif
2626

2727
#run "make" for default build
2828
#run "JPEGLS=1 make" for JPEGLS build
29-
JFLAGS=
30-
ifeq "$(JPEGLS)" "1"
31-
JFLAGS=-std=c++14 -DmyEnableJPEGLS charls/jpegls.cpp charls/jpegmarkersegment.cpp charls/interface.cpp charls/jpegstreamwriter.cpp charls/jpegstreamreader.cpp
29+
#run "JPEGLS=2 make" for JPEGLS build with system CharLS
30+
# JPEGLS=0 : disable JPEG-LS
31+
# JPEGLS=1 : use local ./charls source files
32+
# JPEGLS=2 : use system-installed CharLS via pkg-config
33+
34+
ifeq ($(JPEGLS),1)
35+
CFLAGS += -DmyEnableJPEGLS
36+
CHARLS_SRCS = charls/jpegls.cpp charls/jpegmarkersegment.cpp charls/interface.cpp \
37+
charls/jpegstreamwriter.cpp charls/jpegstreamreader.cpp
38+
CFILES := $(CHARLS_SRCS) $(CFILES)
39+
endif
40+
41+
ifeq ($(JPEGLS),2)
42+
CFLAGS += -DmyEnableJPEGLS
43+
CHARLS_CFLAGS := $(shell pkg-config --cflags charls 2>/dev/null)
44+
CHARLS_LIBS := $(shell pkg-config --libs charls 2>/dev/null)
45+
ifeq ($(CHARLS_CFLAGS),)
46+
CHARLS_CFLAGS := -I/usr/include -I/opt/homebrew/include
47+
endif
48+
ifeq ($(CHARLS_LIBS),)
49+
CHARLS_LIBS := -lcharls -L/usr/lib -L/opt/homebrew/lib
50+
endif
51+
CFLAGS += $(CHARLS_CFLAGS)
52+
CFILES += $(CHARLS_LIBS)
3253
endif
3354

3455
#run "JNIfTI=0 make" to disable JNIFTI build

console/nii_dicom.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5313,7 +5313,9 @@ struct TDICOMdata readDICOMx(char *fname, struct TDCMprefs *prefs, struct TDTI4D
53135313
lPos = lPos + 4;
53145314
// https://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_8.2.html
53155315
// detect and skip Basic Offset Table
5316-
bool isBasicOffsetTable = (d.imageBytes < 1) && ((lLength == 4 * numberOfFrames) || (lLength <= 0));
5316+
bool isBasicOffsetTable = (d.imageBytes < 1) && ((lLength == 4 * numberOfFrames) || (lLength <= 0));
5317+
if ((numberOfFrames < 2) && (lLength == 4))
5318+
isBasicOffsetTable = true;
53175319
if (lLength == 0xFFFFFFFF) {
53185320
// printf("Fragment has undefined length\n");
53195321
// to do: see pixelmed microscopy https://www.aliza-dicom-viewer.com/download/datasets

console/nii_dicom_batch.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6881,8 +6881,9 @@ void sliceTimingXA(struct TDCMsort *dcmSort, struct TDICOMdata *dcmList, struct
68816881
if (hdr->dim[3] > kMaxEPI3D) {
68826882
printWarning("Unable to set Siemens XA sliceTiming due to excessive slices per volume (%d).\n", hdr->dim[3]);
68836883
return;
6884-
} else {
6885-
printWarning("4D Siemens XA images should be exported as enhanced not classic DICOM. Slice times and other properties may be inaccurate.\n");
6884+
} else if (nConvert > hdr->dim[4]) {
6885+
// XA enhanced DICOM saves 1 file per 3D volume, classic DICOM saves multiple volumes
6886+
printWarning("4D Siemens XA images should be exported as enhanced not classic DICOM. Slice times and other properties may be inaccurate %d.\n");
68866887
}
68876888
if ((nConvert == (hdr->dim[3] * hdr->dim[4])) && (hdr->dim[3] < (kMaxEPI3D - 1)) && (hdr->dim[3] > 1)) {
68886889
// issue875 use 2nd volume

0 commit comments

Comments
 (0)