Skip to content

Commit 9e28ab9

Browse files
committed
ENH: Update NrrdIO from upstream
The NrrdIO repository recently moved to git ``` git clone https://git.code.sf.net/p/teem/nrrdio/nrrdio.git NrrdIO ``` These changes represent the head of NrrdIO as of 2025-10-03, with synchronization between the ITK codebase and the NrrdIO codebase.
1 parent a8fb816 commit 9e28ab9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3287
-3451
lines changed

Modules/ThirdParty/NrrdIO/src/NrrdIO/754.c

Lines changed: 245 additions & 325 deletions
Large diffs are not rendered by default.
Lines changed: 103 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
1-
PROJECT(ITK3P_NrrdIO)
2-
INCLUDE_REGULAR_EXPRESSION("^.*.h$")
1+
#
2+
# NrrdIO: stand-alone code for basic nrrd functionality
3+
# Copyright (C) 2013, 2012, 2011, 2010, 2009 University of Chicago
4+
# Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann
5+
# Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah
6+
#
7+
# This software is provided 'as-is', without any express or implied
8+
# warranty. In no event will the authors be held liable for any
9+
# damages arising from the use of this software.
10+
#
11+
# Permission is granted to anyone to use this software for any
12+
# purpose, including commercial applications, and to alter it and
13+
# redistribute it freely, subject to the following restrictions:
14+
#
15+
# 1. The origin of this software must not be misrepresented; you must
16+
# not claim that you wrote the original software. If you use this
17+
# software in a product, an acknowledgment in the product
18+
# documentation would be appreciated but is not required.
19+
#
20+
# 2. Altered source versions must be plainly marked as such, and must
21+
# not be misrepresented as being the original software.
22+
#
23+
# 3. This notice may not be removed or altered from any source distribution.
24+
#
25+
cmake_minimum_required(VERSION 3.20...3.31)
26+
project(ITK3P_NrrdIO)
27+
include_regular_expression("^.*.h$")
328

429
#
530
# This CMake file configures the NrrdIO library build. NrrdIO
@@ -8,17 +33,52 @@ INCLUDE_REGULAR_EXPRESSION("^.*.h$")
833
# package. See http://teem.sourceforge.net for more information.
934
#
1035

11-
SET(nrrdio_SRCS 754.c mop.c array.c parseAir.c dio.c sane.c endianAir.c
12-
string.c enum.c miscAir.c biffbiff.c biffmsg.c accessors.c defaultsNrrd.c
13-
enumsNrrd.c arraysNrrd.c methodsNrrd.c reorder.c axis.c simple.c comment.c
14-
keyvalue.c endianNrrd.c parseNrrd.c gzio.c read.c write.c format.c
15-
formatNRRD.c encoding.c encodingRaw.c encodingAscii.c encodingHex.c
16-
encodingGzip.c subset.c encodingBzip2.c formatEPS.c formatPNG.c
17-
formatPNM.c formatText.c formatVTK.c )
18-
19-
# Turn on TEEM_BUILD and TEEM_STATIIC so that the proper dll export
20-
# def's are used on windows builds.
21-
ADD_DEFINITIONS(-DTEEM_BUILD)
36+
SET(nrrdio_SRCS
37+
754.c
38+
accessors.c
39+
array.c
40+
arraysNrrd.c
41+
axis.c
42+
biffbiff.c
43+
biffmsg.c
44+
comment.c
45+
defaultsNrrd.c
46+
encoding.c
47+
encodingAscii.c
48+
encodingBzip2.c
49+
encodingGzip.c
50+
encodingHex.c
51+
encodingRaw.c
52+
encodingZRL.c
53+
endianAir.c
54+
endianNrrd.c
55+
enum.c
56+
enumsNrrd.c
57+
format.c
58+
formatEPS.c
59+
formatNRRD.c
60+
formatPNG.c
61+
formatPNM.c
62+
formatText.c
63+
formatVTK.c
64+
gzio.c
65+
keyvalue.c
66+
methodsNrrd.c
67+
miscAir.c
68+
mop.c
69+
parseAir.c
70+
parseNrrd.c
71+
read.c
72+
reorder.c
73+
sane.c
74+
simple.c
75+
string.c
76+
subset.c
77+
write.c
78+
)
79+
# Turn on TEEM_BUILD so that the proper dll export def's are
80+
# used on windows builds.
81+
ADD_DEFINITIONS(-DTEEM_BUILD=1)
2282

2383
if(NOT BUILD_SHARED_LIBS)
2484
set(TEEM_STATIC 1)
@@ -44,53 +104,45 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestQnanhibit.cmake)
44104
test_qnanhibit(QNANHIBIT_VALUE ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
45105
if(QNANHIBIT_VALUE)
46106
set(QNANHIBIT 1 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.")
47-
else(QNANHIBIT_VALUE)
107+
else()
48108
set(QNANHIBIT 0 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.")
49-
endif(QNANHIBIT_VALUE)
109+
endif()
50110

51111
#The QNANHIBIT variable is configured by the root level CMakeLists.txt
52-
IF(QNANHIBIT)
53-
ADD_DEFINITIONS(-DTEEM_QNANHIBIT=1)
54-
ELSE(QNANHIBIT)
55-
ADD_DEFINITIONS(-DTEEM_QNANHIBIT=0)
56-
ENDIF(QNANHIBIT)
57-
58-
#DirectIO is the fast way to do multi-gigabyte I/O and currently only available
59-
#for SGI platforms. Use of DirectIO is enabled manually for now.
60-
#OPTION(USE_DIRECTIO "Use DirectIO for Nrrd file IO. Only valid on SGI systems." 0)
61-
#MARK_AS_ADVANCED(USE_DIRECTIO)
62-
#IF(USE_DIRECTIO)
63-
# ADD_DEFINITIONS(-DTEEM_DIO=1)
64-
#ELSE(USE_DIRECTIO)
65-
ADD_DEFINITIONS(-DTEEM_DIO=0)
66-
#ENDIF(USE_DIRECTIO)
67-
68-
# Tell NRRD to enable nrrdEncodingGzip
69-
ADD_DEFINITIONS(-DTEEM_ZLIB=1)
70-
71-
ADD_LIBRARY(ITKNrrdIO ${nrrdio_SRCS} )
72-
73-
IF(UNIX)
74-
TARGET_LINK_LIBRARIES(ITKNrrdIO ${ITKZLIB_LIBRARIES} m)
75-
ELSE(UNIX)
76-
TARGET_LINK_LIBRARIES(ITKNrrdIO ${ITKZLIB_LIBRARIES})
77-
ENDIF(UNIX)
78-
79-
IF(ITK_LIBRARY_PROPERTIES)
80-
SET_TARGET_PROPERTIES(ITKNrrdIO PROPERTIES ${ITK_LIBRARY_PROPERTIES})
81-
ENDIF(ITK_LIBRARY_PROPERTIES)
82-
83-
INSTALL(TARGETS ITKNrrdIO
112+
if(QNANHIBIT)
113+
add_definitions(-DTEEM_QNANHIBIT=1)
114+
else()
115+
add_definitions(-DTEEM_QNANHIBIT=0)
116+
endif()
117+
118+
119+
# Possibly turn on usage of zlib compression (requires linking with libz)
120+
# (i.e., programs compiled with ITKNrrdIO must also be compiled with zlib)
121+
add_definitions(-DTEEM_ZLIB=1)
122+
123+
add_library(ITKNrrdIO ${nrrdio_SRCS} )
124+
125+
if(UNIX)
126+
target_link_libraries(ITKNrrdIO ${ITKZLIB_LIBRARIES} m)
127+
else()
128+
target_link_libraries(ITKNrrdIO ${ITKZLIB_LIBRARIES})
129+
endif()
130+
131+
if(ITK_LIBRARY_PROPERTIES)
132+
set_target_properties(ITKNrrdIO PROPERTIES ${ITK_LIBRARY_PROPERTIES})
133+
endif()
134+
135+
install(TARGETS ITKNrrdIO
84136
EXPORT ${ITK3P_INSTALL_EXPORT_NAME}
85137
RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries
86138
LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries
87139
ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development
88140
)
89141

90-
INSTALL(FILES ${ITK3P_NrrdIO_BINARY_DIR}/NrrdIO.h ${ITK3P_NrrdIO_BINARY_DIR}/itk_NrrdIO_mangle.h
142+
install(FILES ${ITK3P_NrrdIO_BINARY_DIR}/NrrdIO.h ${ITK3P_NrrdIO_BINARY_DIR}/itk_NrrdIO_mangle.h
91143
DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR} # TODO: itk_NrrdIO.h #include "itkNrrdIO/NrrdIO.h"
92144
COMPONENT Development)
93145

94-
IF(CMAKE_COMPILER_IS_GNUCXX)
95-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
96-
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
146+
if(CMAKE_COMPILER_IS_GNUCXX)
147+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
148+
endif()

0 commit comments

Comments
 (0)