ENH: Update NrrdIO upstream with recent teem updates#5542
Conversation
|
This seems to work? |
Yes. I'm working with @kindlmann to move Teem and NrrdIO from SVN to git on SourceForge. What is included in this patch set is proposed testing for patch sets that are not yet included upstream in NrrdIO or Teem. I was just waiting for the dust to settle in the upstream changes before finalizing this and linking it to the stable git hashes upstream. |
9e28ab9 to
0b4972d
Compare
18d0cf9 to
f213542
Compare
|
Thank you for working on this. When a new |
@blowekamp This may not work for NrrdIO. The central part of the NrrdIO git repo is a set of scripts that extract code from the teem source code base and replace the LGPL license with a BSD license, drop chunks of code that exist in teem, but are not needed for NrrdIO, and create the mangling headers. It is starter code for other projects to adapt from, but not necessarily useful on its own. The set of scripts that extract data from teem does different things when the "itk" flag is passed in, and the "itk" variant of the extracted code has specializations for ITK that are not part of the central git repository. I'm working with Gordon to create a single codebase that is easier to maintain, but I'm not sure we will get there. |
|
I didn't see what occurs with running scripts with the itk variant in the repo: But keep in mind the standard update script unarchived the git repo, and runs some scripts and command to clean up the code for the sub-tree commit. It sounds like the approach taken may still fit into the existing update framework. Here is an example of what happens for HDF5: |
|
I'm grateful for the continued work of @hjmjohnson on this, and I do believe "we will get there" as long as we keep communicating. The new |
8bbca14 to
677ca0e
Compare
|
FYI: This is still being pursued. Upstream teem modifications are ongoing, and more extensive than originally thought. This is all good, but is taking a bit longer than anticipated. |
677ca0e to
30405c8
Compare
The .clang-format file from June 2022 teem/NrrdIO project is applied here to minimize code differences with upstream changes. This patch set will allow the upstream changes to be more easily visible when added in a subsequent patch.
The NrrdIO repository recently moved to git
```bash
ITK_SRC_ROOT=${HOME}/src/ITK
NRRDIO_SRC_ROOT=/tmp/teem
TEEM_SRC_ROOT=/tmp/teem
git clone https://git.code.sf.net/p/teem/nrrdio/nrrdio.git ${NRRDIO_SRC_ROOT}
git clone ssh://hjmjohnson@git.code.sf.net/p/teem/teem.git ${TEEM_SRC_ROOT}
cp ${NRRDIO_SRC_ROOT}/*.py ${NRRDIO_SRC_ROOT}/*.sh ${NRRDIO_SRC_ROOT}/*.in ${ITK_SOURCE_ROOT}/Modules/ThirdParty/NrrdIO/src/NrrdIO
cd ${ITK_SOURCE_ROOT}/Modules/ThirdParty/NrrdIO/src/NrrdIO
TEEM_SRC_ROOT=${TEEM_SRC_ROOT} ./0-gen.sh itk # <- this extracts nrrdio from teem code with itk mangling
```
These changes represent the head of NrrdIO as of 2026-1-17, with
synchronization between the ITK codebase and the NrrdIO codebase.
30405c8 to
8cb80e6
Compare
|
@kindlmann. I have finally returned to this and replaced nrrdio in ITK with the latest version from Jan 2026. There is very little that changes in the c code from upstream nrrdio and ITK files:
/* THE FOLLOWING INCLUDE IS ONLY FOR THE ITK DISTRIBUTION.
This header mangles the symbols in the NrrdIO library, preventing
conflicts in applications linked against two versions of NrrdIO. */
#include "itk_NrrdIO_mangle.h"
'# include <zlib.h>' Hans |
dzenanz
left a comment
There was a problem hiding this comment.
Changes mostly look good. I am compiling this locally.
| add_definitions(-DTEEM_BUILD=1) | ||
|
|
||
| set(NRRDIO_COMPRESSION_LIBRARIES "") | ||
| if ( NOT "${NRRDIO_PREFIX}" STREQUAL "ITK" ) # <-- ITK START_REMOVE |
There was a problem hiding this comment.
Should this comment be # <-- ITK START_REPLACE?
|
This might interact with changes in PR #5721. |
My current working local changes keep the directory properties for third party libraries. Making third party modules more targets based is being separated. |
|
Most projects fail to build locally due to this missing symbol: This is an incremental, in-place build. I guess that matter? |
I think it does matter. I needed to do a clean build on windows. There is a NrrdIO.h in your build tree that likely needs to be removed. It used to be configured, but is no longer needed to be configured. |
|
@dzenanz I have local builds working on windows and mac and the CI is passing. Do you think we need to add something like if (EXISTS ${CMAKE_BUILD_DIR}/NrrdIO.h)
file(REMOVE ${CMAKE_BUILD_DIR}/NrrdIO.h)
endif()
to deal with the incremental build issue?
|
|
That would be helpful. After removing |
I don't think it's realistic to support incremental build like this, in general. It can add a lot of bloat to the CMake code that is difficult to figure out out down the road. |
|
Good point Brad. This is a one-time incremental build breakage. Finding and removing the offending file is not hard, and clean builds don't have this problem. |
|
Thank you Hans for this big update! And also @kindlmann! |
|
I locally encounter the following link errors, using VS2022 (Debug):
Any clue? |
|
Hans already answered it. Removing the outdated header from build dir fixes it. |
Update for synchronizing with the upstream teem project
This commit updates the ThirdParty NrrdIO library to the latest version
from the upstream Teem project. This update includes several
modernization efforts, bug fixes, and new features.
Major changes include:
(
encodingZRL.c) that supports reading ZRL-compressed NRRD files.mangle.pl,tail.pl,unteem.pl)with Python equivalents (
mangle.py,tail.py,unteem.py).0-gen.shto provide a reliable, documented way toregenerate NrrdIO from Teem sources.
clang-formatto improve consistency..clang-formatconfiguration file to the source directory.NrrdIO.handNrrdIO.h.infor better maintainability.dio.c,qnanhibit.c, andassociated CMake tests.
000-README.txtto0-README.txt.CMakeLists.txtto use modern CMake patterns.rules for mangled headers.
0-README.txtandLICENSE.These changes ensure that ITK's NRRD support remains compatible with
the latest upstream developments while improving the developer
experience for maintaining the third-party module.
PR Checklist