Installation from Git sources (master, 5.3rc03) with double vector support

Installation from Git sources (master, 5.3rc03) with double vector support

Dear developers,

I am trying to get a deformable transformation. I am now using Arch (see below) and “regular” compilation flags (as provided by Arch). I tried to re-compile and use ITK from pip. However, I get the same error as with my original system (Parabola) and with the pip installation (that’s why I tried Arch). Is there a pip package that I am missing or how do I compile it to get it to work? (If the double vector is not needed, just let me know, and I’ll be glad to stop bumping at it.) Thanks!

MWE

#!/usr/bin/env python
# This code is partially based on
# DeformableRegistration15.cxx
# which holds the Apache 2.0 license (see below).
#
# Copyright 2022 edgar
# License:
#
#    This program is free software: you can redistribute it
#    and/or modify it under the terms of the GNU General
#    Public License as published by the Free Software
#    Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be
#    useful, but WITHOUT ANY WARRANTY; without even the
#    implied warranty of MERCHANTABILITY or FITNESS FOR A
#    PARTICULAR PURPOSE. See the GNU General Public License
#    for more details.
#
#    You should have received a copy of the GNU General
#    Public License along with this program. If not, see
#    <https://www.gnu.org/licenses/>.
#
# Copyright Insight Software Consortium
#
# Licensed under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

import sys
import itk
import numpy as np
from distutils.version import StrictVersion as VS
from benchmark3d.primitives import (
    rotate_series_obj3d, smiley)
from scipy.spatial.transform import Rotation as sp_Rot

# Set outputs
output_image = "itk_versor_registration.out.vtk"
first_frame_vtk = "itk_versor_registration.in01.vtk"
last_frame_vtk = "itk_versor_registration.in04.vtk"
diff_image_after = "itk_versor_registration.diff_after.vtk"
diff_image_before = "itk_versor_registration.diff_before.vtk"

if VS(itk.Version.GetITKVersion()) < VS("5.3.0"):
    print("ITK 5.3.0 is required.")
    sys.exit(1)

# Draw a smiling face
side_size = 100
face_scale = 0.8
margin = round((side_size * (1 - face_scale)) / 2)
face = smiley(side_size=side_size, face_scale=face_scale, margin=margin)
depth_ratio = 10
vol_depth = int(side_size / depth_ratio)
obj3d = np.zeros((vol_depth, side_size, side_size),
                 dtype=np.uint8)
obj3d[:, margin:face.shape[0] + margin,
      margin:face.shape[1] + margin] = face

# Happily create a motion with
# 4 frames and a rotation about z = 30°
series_length = 4
holder = np.zeros((series_length, *obj3d.shape),
                  dtype=np.uint8)
rot_func = sp_Rot.from_rotvec
steps = series_length
angle_max = np.pi / 6
angle = angle_max / (series_length - 1)
rot_per_step = np.asarray([angle, 0, 0])
_ = rotate_series_obj3d(
    holder, obj3d, steps, rot_per_step, keep_obj3d=True,
    order=3)

# Load first and last frames as ITK data (images);
# swap axes ITK: i, j, k, Numpy: k, i, j
# (https://discourse.itk.org/t/
#   importing-image-from-array-and-axis-reorder/1192/)
fixed_image_arr = holder[0].transpose((2, 1, 0))
moving_image_arr = holder[-1].transpose((2, 1, 0))
fixed_image = itk.image_from_array(
    fixed_image_arr.astype(np.float32))
moving_image = itk.image_from_array(
    moving_image_arr.astype(np.float32))

spatial_dim = fixed_image.GetImageDimension()
fixed_image_type = type(fixed_image)
moving_image_type = type(moving_image)

# ITKElastix Test
registered_image, params = itk.elastix_registration_method(fixed_image, moving_image)

origin = [0] * spatial_dim
length_per_px_ratios = [1] * spatial_dim
[dict(img).update({
    # Set origin ([0, 0, 0]); fixed_image.GetOrigin()
    "origin": origin,
    # Axial scale (length unit / pixel for each axis)
    "spacing": length_per_px_ratios,
    # Set orientation of axes; fixed_image.GetDirection()
    "direction": np.eye(spatial_dim)})
 for img in (fixed_image, moving_image)]

# «DeformableRegistration15.cxx»
# <with itk_versor_registration.py sprinkles>
# «using CoordinateRepType = double;»
coord_type = itk.D
versor_type = coord_type
# «using RigidTransformType = itk::VersorRigid3DTransform<double>;»
versor_transform_class = itk.VersorTransform[versor_type]
# «auto rigidTransform = RigidTransformType::New();»
rigid_transform = versor_transform_class.New()
# «using TransformInitializerType =
#   itk::CenteredTransformInitializer<RigidTransformType,
#                                     FixedImageType,
#                                     MovingImageType>;
trnfm_init_class = itk.CenteredTransformInitializer[
    versor_transform_class,
    fixed_image_type,
    moving_image_type]
# «using AffineTransformType = itk::AffineTransform<double, SpaceDimension>;»
affine_transform_class = itk.AffineTransform[coord_type, spatial_dim]
# «auto affineTransform = AffineTransformType::New();»
affine_transform = affine_transform_class.New()
# «constexpr unsigned int SplineOrder = 3;»
spline_order = 3
# «using DeformableTransformType =
#     itk::BSplineTransform<CoordinateRepType, SpaceDimension, SplineOrder>;»
deformable_transform_class = itk.BSplineTransform[
    coord_type, spatial_dim, spline_order]

(Re)compilation attempts

makepkg.conf (compilation flags)

Using the standard Arch Linux compiling options (only added the -j6 for parallel processing)

#!/hint/bash
#
# /etc/makepkg.conf
#

#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
#  Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
          'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
          'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
          'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
          'rsync::/usr/bin/rsync --no-motd -z %u %o'
          'scp::/usr/bin/scp -C %u %o')

# Other common tools:
# /usr/bin/snarf
# /usr/bin/lftpget -c
# /usr/bin/wget

#-- The package required by makepkg to download VCS sources
#  Format: 'protocol::package'
VCSCLIENTS=('bzr::bzr'
            'fossil::fossil'
            'git::git'
            'hg::mercurial'
            'svn::subversion')

#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="x86_64"
CHOST="x86_64-pc-linux-gnu"

#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"
#RUSTFLAGS="-C opt-level=2"
#-- Make Flags: change this for DistCC/SMP systems
MAKEFLAGS="-j6"
#-- Debugging flags
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
#DEBUG_RUSTFLAGS="-C debuginfo=2"

#########################################################################
# BUILD ENVIRONMENT
#########################################################################
#
# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)
#  A negated environment option will do the opposite of the comments below.
#
#-- distcc:   Use the Distributed C/C++/ObjC compiler
#-- color:    Colorize output messages
#-- ccache:   Use ccache to cache compilation
#-- check:    Run the check() function if present in the PKGBUILD
#-- sign:     Generate PGP signature file
#
BUILDENV=(!distcc color !ccache check !sign)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""
#
#-- Specify a directory for package building.
#BUILDDIR=/tmp/makepkg

#########################################################################
# GLOBAL PACKAGE OPTIONS
#   These are default values for the options=() settings
#########################################################################
#
# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)
#  A negated option will do the opposite of the comments below.
#
#-- strip:      Strip symbols from binaries/libraries
#-- docs:       Save doc directories specified by DOC_DIRS
#-- libtool:    Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs:  Leave empty directories in packages
#-- zipman:     Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge:      Remove files specified by PURGE_TARGETS
#-- debug:      Add debugging flags as specified in DEBUG_* variables
#-- lto:        Add compile flags for building with link time optimization
#
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug !lto)

#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(sha256)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="--strip-all"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
STRIP_SHARED="--strip-unneeded"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="--strip-debug"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"

#########################################################################
# PACKAGE OUTPUT
#########################################################################
#
# Default: put built package and cached source in build directory
#
#-- Destination: specify a fixed directory where all packages will be placed
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"
#-- Specify a key to use for package signing
#GPGKEY=""

#########################################################################
# COMPRESSION DEFAULTS
#########################################################################
#
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)

#########################################################################
# EXTENSION DEFAULTS
#########################################################################
#
PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'

#########################################################################
# OTHER
#########################################################################
#
#-- Command used to run pacman as root, instead of trying sudo and su
#PACMAN_AUTH=()

Double and float work

This works

# Maintainer: Chris <christopher.r.mullins g-mail>
# Contributor: geosam <samuelmesa@linuxmail.org>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: joel schaerer <joel.schaerer@laposte.net>

_pkgbase=insight-toolkit
pkgname="${_pkgbase}-extra"
pkgver=5.3rc03
pkgrel=1
_pkgdesc="Cross-platform system that provides developers"
_pkgdesc="${_pkgdesc} with an extensive suite of software"
_pkgdesc="${_pkgdesc} tools for image analysis"
_pkgdesc="${_pkgdesc} (with strain, tubetk and fem modules)"
pkgdesc="${_pkgdesc}"
arch=('i686' 'x86_64')
url='http://www.itk.org/'
license=('APACHE')
depends=('fftw' 'libjpeg-turbo' 'libpng' 'zlib' 'libtiff'
         'gdcm' 'expat' 'hdf5' 'gtest' 'eigen' 'jre-openjdk'
         'jre-openjdk-headless' "cli11" "ospray" "boost" "openvr"
        "python-mpi4py" "postgresql" "pdal" "liblas" "adios2" "libharu" "cgns" "utf8cpp")
optdepends=(
  'python2: build python wrapping'
  'ruby'
  'tcl: build tcl wrapping (currently not supported)'
  'perl: build perl wrapping (currently not supported)'
  'swig: generate python wrappers'
  'pcre: for wrapping'
  'castxml-git: for wrapping and docs'
  'clang: for swig'
  'castxml-git: for ITK')
makedepends=('cmake' 'git' 'castxml' "samurai")
source=("insight-toolkit::git+https://github.com/InsightSoftwareConsortium/ITK#tag=v${pkgver}"
        "disable_remote_git.diff"
        "libdl_fix.diff"
        "SimpleITKFilters::git+file://${startdir}/Modules/SimpleITKFilters"
        "IsotropicWavelets::git+file://${startdir}/Modules/IsotropicWavelets"
        "LabelErodeDilate::git+file://${startdir}/Modules/LabelErodeDilate"
        "Montage::git+file://${startdir}/Modules/Montage"
        "MorphologicalContourInterpolation::git+file://${startdir}/Modules/MorphologicalContourInterpolation"
        "MultipleImageIterator::git+file://${startdir}/Modules//MultipleImageIterator"
        "PhaseSymmetry::git+file://${startdir}/Modules/PhaseSymmetry"
        "Strain::git+file://${startdir}/Modules/Strain"
        "TubeTK::git+file://${startdir}/Modules/TubeTK#tag=v1.0.0"
        "TwoProjectionRegistration::git+file://${startdir}/Modules/TwoProjectionRegistration"
        "MinimalPathExtraction::git+file://${startdir}/Modules/MinimalPathExtraction"
       )
sha512sums=('SKIP'
            'c5338b5919e818e3719c1273e865ecd2a1673f71df29a0cc13b02dbdc3b7dc293eb61935f45ea4a51e12ab01584f79cbd55ae426d214c21e4ad80e6ba4aefa4d'
            '972ba667ac65849f18f93d6e29003d2f02218dedc4d37cbaefe63fd587ee0fcf9aa1b0e2195b338b7a4c3943620263100b86202d255019beacdf99be50cfc511'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')
provides=(python-itk="${pkgver}" itk="${pkgver}")
conflicts=(python-itk itk)
backup=(etc/ld.so.conf.d/insight-toolkit.conf)

function _get_cores_func() {
  # Not CPU, but cores. Hopefully, the machine has enough
  # memory for that
  local _ncores
  _ncores=$(grep -m 1 'cpu cores' /proc/cpuinfo |
              cut -f2 -d":" | tr -d "[:space:]")
  # Try to use MAKEFLAGS, otherwise, _ncores
  _nproc_make="${MAKEFLAGS:-$_ncores}"
  _nproc_make="${_nproc_make##*-j}"
  _nproc_make="${_nproc_make%%[[:space:]]*}"
  _nproc_make="${_nproc_make##*[[:space:]]}"
}

prepare() {
  cd "${srcdir}"

  _basedir="${srcdir}"/"${_pkgbase}"

  patch -d "${_basedir}" -p0 \
        -i "${srcdir}"/disable_remote_git.diff
  patch -d "${srcdir}" -p0 -i "${srcdir}"/libdl_fix.diff

  cd "${_basedir}" && git submodule update --init --recursive
}

build() {
  cd "${srcdir}"
  _build_dir="${srcdir}"/"${_pkgbase}"/build

  _confopts=(
    -S "${srcdir}"/"${_pkgbase}"
    -B "${_build_dir}"

    -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr
    -DCMAKE_BUILD_TYPE:STRING=Release
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
    --log-level="NOTICE"

    -DCMAKE_CXX_FLAGS:STRING="-std=c++14 ${CXXFLAGS}"
    -DCMAKE_C_FLAGS:STRING="${CFLAGS}"
    -DITK_CXX_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
    -DITK_C_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
    -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
    -G Ninja
    # -G "Unix Makefiles"
    # -DCMAKE_BUILD_PARALLEL_LEVEL="${_nproc_make}"

    -DBUILD_TESTING:BOOL=OFF
    -DBUILD_EXAMPLES:BOOL=OFF
    -DITK_BUILD_DOCUMENTATION:BOOL=OFF
    -DITK_BUILD_DEFAULT_MODULES:BOOL=ON

    # Python
    -DITK_WRAP_PYTHON:BOOL=ON
    -DITK_USE_SYSTEM_SWIG:BOOL=ON
    -DITK_USE_SYSTEM_CASTXML:BOOL=ON

    -DITK_LEGACY_SILENT:BOOL=ON
    -DBUILD_SHARED_LIBS:BOOL=ON
    -DITK_USE_SYSTEM_LIBRARIES:BOOL=ON
    -DITK_USE_SYSTEM_JPEG:BOOL=ON
    -DITK_USE_SYSTEM_PNG:BOOL=ON
    -DITK_USE_SYSTEM_ZLIB:BOOL=ON
    -DITK_USE_SYSTEM_TIFF:BOOL=ON
    -DITK_USE_SYSTEM_GDCM:BOOL=ON
    -DITK_USE_SYSTEM_EXPAT:BOOL=ON
    -DITK_USE_SYSTEM_FFTW:BOOL=ON
    -DITK_USE_SYSTEM_HDF5:BOOL=ON
    -DITK_USE_64BITS_IDS:BOOL=ON

    -DITK_WRAP_IMAGE_DIMS:STRING="2;3;4"
    -DITK_WRAP_VECTOR_COMPONENTS:STRING="2;3;4"
    -DITK_WRAP_double:BOOL=ON
    -DITK_WRAP_float:BOOL=ON
    #-DITK_WRAP_vector_double:BOOL=ON
    #-DITK_WRAP_vector_float:BOOL=ON
    # -DITK_WRAP_signed_short:BOOL=ON
    # -DITK_WRAP_signed_char:BOOL=ON
    # -DITK_WRAP_rgb_unsigned_short:BOOL=ON
    #-DITK_WRAP_rgba_unsigned_short:BOOL=ON
    # -DITK_WRAP_unsigned_short:BOOL=ON

    # generates a compile_commands.json
    -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON

    # Reconstruction of 3D from 2D slices
    -DModule_Montage:BOOL=ON
    # Interpolate contours
    -DModule_MorphologicalContourInterpolation:BOOL=ON
    # Facilitate working on multiple images
    -DModule_MultipleImageIterator:BOOL=ON
    # Separate material phases?
    -DModule_PhaseSymmetry:BOOL=ON
    -DModule_IsotropicWavelets:BOOL=OFF # Not working
    # Improving segmentation of circles
    -DModule_LabelErodeDilate:BOOL=ON
    # Compute strain from displacement or transformation
    -DModule_Strain:BOOL=ON
    # From 2D slices to 3D registration
    -DModule_TwoProjectionRegistration:BOOL=ON
    # segmentation, registration, and analysis of tubes
    -DModule_TubeTK:BOOL=OFF
    # TubeTK requires MinimalPathExtraction module enabled
    -DModule_MinimalPathExtraction:BOOL=ON
    # Finite Element
    -DModule_ITKFEM:BOOL=ON
    -DModule_ITKFEMRegistration:BOOL=ON

    # -DModule_FixedPointInverseDisplacementField:BOOL=ON
    # -DModule_IOOpenSlide:BOOL=OFF  #
    # -DModule_IOTransformDCMTK:BOOL=OFF
    # -DITKVideoBridgeOpenCV
    # -DITKVideoBridgeVXL
  )
  printf "INFO: Running CMake...\n"
  cmake "${_confopts[@]}"
  printf "INFO: ... CMake done\n"

  printf "INFO: Cleaning TubeTK...\n"
  # Fixing TubeTK
  # The next commands should go in prepare(), but `cmake'
  # should be in build(), and the files only exist after
  # `cmake'.
  # find "${srcdir}" -type f -regex '.*\.\(supp\|cxx\|txt\|ninja\|make\|so\.1\)' -exec grep --color -nH --null -e 'libdl[^[:space:];]*\.\(so\|a\)[[:digit:].]*' \{\} +
  sed -i "s%libdl[^[:space:];]*\.so[[:digit:].]*%libdl.so.2%g" "${_build_dir}"/build.ninja
  # Get rid of triaged MinimalPathExtraction.h
  rm -fr "${srcdir}/${pkgname}"/Modules/Remote/TubeTK/include/MinimalPathExtractionExport.h
  printf "INFO: ... cleaning TubeTK, done\n"

  _get_cores_func
  # Persist after error
  local _f=1 _try_i=0 _max_try=20
  while [[ "${_i}" -lt "${_max_try}" ]] && [[ ! "${_f}" == "0" ]]; do
      _f=0
      # make -s -j6 -C "${_build_dir}" -f "${_build_dir}"/Makefile ||
      # samu -j6 -C "${_build_dir}" -f "${_build_dir}"/build.ninja ||
      samu -j6 -C "${_build_dir}" ||
        _f=$?                   # catch error
      _try_i="$(( ${_i} + 1 ))"   # counter
      sleep 3;                    # pause (to kill manually)
  done
}

package() {
  _build_dir="${srcdir}"/"${_pkgbase}"/build
  cd "${_build_dir}"

  _get_cores_func;

  # DESTDIR="${pkgdir}" make -C "${_build_dir}" \
  DESTDIR="${pkgdir}" samu -C "${_build_dir}" -f "${_build_dir}"/build.ninja \
         -j6 install 1>/dev/null

  # Based on AUR's itk-git package
  # (quick fix for
  # https://github.com/InsightSoftwareConsortium/ITK/issues/2960)
  install -dm755 "${pkgdir}"/usr/lib
  _pycmd='print("%s.%s" % (sys.version_info[:2]))'
  _pyver=$(python -c "import sys; ${_pycmd}")
  find "${pkgdir}" -type d -name "python${_pyver}" \
       -print0 -quit | xargs -0 mv -vt "${pkgdir}/usr/lib"
  python -O -m compileall "${pkgdir}/usr/lib" 1>/dev/null

  # Find required java libraries and add it to /etc/profile.d/
  #    Skipping RPATH allows that the packager system's may
  #    be different from the installer's system, but it also
  #    implies having the path to some libraries in the
  #    right place. For some reason libjawt.so,
  #    libawt_xawt.so and libjvm.so are not immediately
  #    found, so we create entries in /etc/profile.d/ with
  #    insight-toolkit.sh.
  mkdir -p "${pkgdir}"/etc/profile.d/
  echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/jvm/default/lib:/usr/lib/jvm/default/lib/server"' > "${pkgdir}"/etc/profile.d/insight-toolkit.sh
}

Double vectors have problems

With this change, I enabled the double vectors

--- PKGBUILD	2022-05-02
+++ PKGBUILD	2022-05-02
@@ -138,7 +138,7 @@
     -DITK_WRAP_VECTOR_COMPONENTS:STRING="2;3;4"
     -DITK_WRAP_double:BOOL=ON
     -DITK_WRAP_float:BOOL=ON
-    #-DITK_WRAP_vector_double:BOOL=ON
+    -DITK_WRAP_vector_double:BOOL=ON
     #-DITK_WRAP_vector_float:BOOL=ON
     # -DITK_WRAP_signed_short:BOOL=ON
     # -DITK_WRAP_signed_char:BOOL=ON

Then, I recompiled

makepkg -ef

The compilation did not go further than this

[1/1887] Generating itkPyImageFilterPython.cpp, ../itk/itkPyImageFilterPython.py
[2/1887] Generating itkPhaseSymmetryImageFilterPython.cpp, ../../Generators/Python/itk/itkPhaseSymmetryImageFilterPython.py
[3/1887] Generating itkLabelSetMorphBaseImageFilterPython.cpp, ../../Generators/Python/itk/itkLabelSetMorphBaseImageFilterPython.py
[4/1887] Generating itkLabelSetErodeImageFilterPython.cpp, ../../Generators/Python/itk/itkLabelSetErodeImageFilterPython.py
[5/1887] Generating itkLabelSetDilateImageFilterPython.cpp, ../../Generators/Python/itk/itkLabelSetDilateImageFilterPython.py
[6/1887] Generating itkPipelineMonitorImageFilterPython.cpp, ../../Generators/Python/itk/itkPipelineMonitorImageFilterPython.py

after stopping the compilation and clearing memory, the process would continue

sync;
echo 1 > /proc/sys/vm/drop_caches 2>&1

But that made the whole compilation to start again

makepkg -ef

Would restart at e.g. 2031 (this example shows 2021, because I could not get the original log)

samu: entering directory 'srcdir/insight-toolkit/build'
[1/2021] Generating
../../Typedefs/itkLevelSetNode.i,
../../Typedefs/itkNodePair.i,
../../Typedefs/itkFastMarchingStoppingCriterionBase.i,
../../Typedefs/ITKFastMarchingBase.i,
../../Typedefs/itkFastMarchingImageFilterBase.i,
../../Typedefs/itkFastMarchingExtensionImageFilter.i,
../../Typedefs/itkFastMarchingImageFilter.i,
../../Typedefs/itkFastMarchingImageToNodePairContainerAdaptor.i,
../../Typedefs/itkFastMarchingReachedTargetNodesStoppingCriterion.i,
../../Typedefs/itkFastMarchingThresholdStoppingCriterion.i,
../../Typedefs/itkFastMarchingUpwindGradientImageFilter.i,
../../Typedefs/itkFastMarchingUpwindGradientImageFilterBase.i,
../../Typedefs/itkLevelSetNodeSwigInterface.h,
../../Typedefs/itkNodePairSwigInterface.h,
../../Typedefs/itkFastMarchingStoppingCriterionBaseSwigInterface.h,
../../Typedefs/ITKFastMarchingBaseSwigInterface.h,
../../Typedefs/itkFastMarchingImageFilterBaseSwigInterface.h,
../../Typedefs/itkFastMarchingExtensionImageFilterSwigInterface.h,
../../Typedefs/itkFastMarchingImageFilterSwigInterface.h,
../../Typedefs/itkFastMarchingImageToNodePairContainerAdaptorSwigInterface.h,
../../Typedefs/itkFastMarchingReachedTargetNodesStoppingCriterionSwigInterface.h,
../../Typedefs/itkFastMarchingThresholdStoppingCriterionSwigInterface.h,
../../Typedefs/itkFastMarchingUpwindGradientImageFilterSwigInterface.h,
../../Typedefs/itkFastMarchingUpwindGradientImageFilterBaseSwigInterface.h,
../../Typedefs/itkLevelSetNode.idx,
../../Typedefs/itkNodePair.idx,
../../Typedefs/itkFastMarchingStoppingCriterionBase.idx,
../../Typedefs/ITKFastMarchingBase.idx,
../../Typedefs/itkFastMarchingImageFilterBase.idx,
../../Typedefs/itkFastMarchingExtensionImageFilter.idx,
../../Typedefs/itkFastMarchingImageFilter.idx,
../../Typedefs/itkFastMarchingImageToNodePairContainerAdaptor.idx,
../../Typedefs/itkFastMarchingReachedTargetNodesStoppingCriterion.idx,
../../Typedefs/itkFastMarchingThresholdStoppingCriterion.idx,
../../Typedefs/itkFastMarchingUpwindGradientImageFilter.idx,
../../Typedefs/itkFastMarchingUpwindGradientImageFilterBase.idx,
../../Generators/Python/itk/Configuration/ITKFastMarching_snake_case.py,
../../Generators/Python/itk-stubs/itkLevelSetNode.pyi,
../../Generators/Python/itk-stubs/itkNodePair.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingStoppingCriterionBase.pyi,
../../Generators/Python/itk-stubs/ITKFastMarchingBase.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingImageFilterBase.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingExtensionImageFilter.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingImageFilter.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingImageToNodePairContainerAdaptor.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingReachedTargetNodesStoppingCriterion.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingThresholdStoppingCriterion.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingUpwindGradientImageFilter.pyi,
../../Generators/Python/itk-stubs/itkFastMarchingUpwindGradientImageFilterBase.pyi
[2/2021] Generating ../../Typedefs/itkFlatStructuringElement.i,
../../Typedefs/itkBlackTopHatImageFilter.i,
../../Typedefs/itkClosingByReconstructionImageFilter.i,
../../Typedefs/itkDoubleThresholdImageFilter.i,
../../Typedefs/itkGrayscaleConnectedClosingImageFilter.i,
../../Typedefs/itkGrayscaleConnectedOpeningImageFilter.i,
../../Typedefs/itkGrayscaleDilateImageFilter.i,
../../Typedefs/itkGrayscaleErodeImageFilter.i,
../../Typedefs/itkGrayscaleFillholeImageFilter.i,
../../Typedefs/itkGrayscaleFunctionDilateImageFilter.i,
../../Typedefs/itkGrayscaleFunctionErodeImageFilter.i,
../../Typedefs/itkGrayscaleGeodesicDilateImageFilter.i,
../../Typedefs/itkGrayscaleGeodesicErodeImageFilter.i,
../../Typedefs/itkGrayscaleGrindPeakImageFilter.i,
../../Typedefs/itkGrayscaleMorphologicalClosingImageFilter.i,
../../Typedefs/itkGrayscaleMorphologicalOpeningImageFilter.i,
../../Typedefs/itkHConcaveImageFilter.i,
../../Typedefs/itkHConvexImageFilter.i,
../../Typedefs/itkHMaximaImageFilter.i,
../../Typedefs/itkHMinimaImageFilter.i,
../../Typedefs/itkMathematicalMorphologyEnums.i,
../../Typedefs/itkMorphologicalGradientImageFilter.i,
../../Typedefs/itkOpeningByReconstructionImageFilter.i,
../../Typedefs/itkReconstructionByDilationImageFilter.i,
../../Typedefs/itkReconstructionByErosionImageFilter.i,
../../Typedefs/itkRegionalMaximaImageFilter.i,
../../Typedefs/itkRegionalMinimaImageFilter.i,
../../Typedefs/itkValuedRegionalMaximaImageFilter.i,
../../Typedefs/itkValuedRegionalMinimaImageFilter.i,
../../Typedefs/itkWhiteTopHatImageFilter.i,
../../Typedefs/itkFlatStructuringElementSwigInterface.h,
../../Typedefs/itkBlackTopHatImageFilterSwigInterface.h,
../../Typedefs/itkClosingByReconstructionImageFilterSwigInterface.h,
../../Typedefs/itkDoubleThresholdImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleConnectedClosingImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleConnectedOpeningImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleDilateImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleErodeImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleFillholeImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleFunctionDilateImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleFunctionErodeImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleGeodesicDilateImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleGeodesicErodeImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleGrindPeakImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleMorphologicalClosingImageFilterSwigInterface.h,
../../Typedefs/itkGrayscaleMorphologicalOpeningImageFilterSwigInterface.h,
../../Typedefs/itkHConcaveImageFilterSwigInterface.h,
../../Typedefs/itkHConvexImageFilterSwigInterface.h,
../../Typedefs/itkHMaximaImageFilterSwigInterface.h,
../../Typedefs/itkHMinimaImageFilterSwigInterface.h,
../../Typedefs/itkMathematicalMorphologyEnumsSwigInterface.h,
../../Typedefs/itkMorphologicalGradientImageFilterSwigInterface.h,
../../Typedefs/itkOpeningByReconstructionImageFilterSwigInterface.h,
../../Typedefs/itkReconstructionByDilationImageFilterSwigInterface.h,
../../Typedefs/itkReconstructionByErosionImageFilterSwigInterface.h,
../../Typedefs/itkRegionalMaximaImageFilterSwigInterface.h,
../../Typedefs/itkRegionalMinimaImageFilterSwigInterface.h,
../../Typedefs/itkValuedRegionalMaximaImageFilterSwigInterface.h,
../../Typedefs/itkValuedRegionalMinimaImageFilterSwigInterface.h,
../../Typedefs/itkWhiteTopHatImageFilterSwigInterface.h,
../../Typedefs/itkFlatStructuringElement.idx,
../../Typedefs/itkBlackTopHatImageFilter.idx,
../../Typedefs/itkClosingByReconstructionImageFilter.idx,
../../Typedefs/itkDoubleThresholdImageFilter.idx,
../../Typedefs/itkGrayscaleConnectedClosingImageFilter.idx,
../../Typedefs/itkGrayscaleConnectedOpeningImageFilter.idx,
../../Typedefs/itkGrayscaleDilateImageFilter.idx,
../../Typedefs/itkGrayscaleErodeImageFilter.idx,
../../Typedefs/itkGrayscaleFillholeImageFilter.idx,
../../Typedefs/itkGrayscaleFunctionDilateImageFilter.idx,
../../Typedefs/itkGrayscaleFunctionErodeImageFilter.idx,
../../Typedefs/itkGrayscaleGeodesicDilateImageFilter.idx,
../../Typedefs/itkGrayscaleGeodesicErodeImageFilter.idx,
../../Typedefs/itkGrayscaleGrindPeakImageFilter.idx,
../../Typedefs/itkGrayscaleMorphologicalClosingImageFilter.idx,
../../Typedefs/itkGrayscaleMorphologicalOpeningImageFilter.idx,
../../Typedefs/itkHConcaveImageFilter.idx,
../../Typedefs/itkHConvexImageFilter.idx,
../../Typedefs/itkHMaximaImageFilter.idx,
../../Typedefs/itkHMinimaImageFilter.idx,
../../Typedefs/itkMathematicalMorphologyEnums.idx,
../../Typedefs/itkMorphologicalGradientImageFilter.idx,
../../Typedefs/itkOpeningByReconstructionImageFilter.idx,
../../Typedefs/itkReconstructionByDilationImageFilter.idx,
../../Typedefs/itkReconstructionByErosionImageFilter.idx,
../../Typedefs/itkRegionalMaximaImageFilter.idx,
../../Typedefs/itkRegionalMinimaImageFilter.idx,
../../Typedefs/itkValuedRegionalMaximaImageFilter.idx,
../../Typedefs/itkValuedRegionalMinimaImageFilter.idx,
../../Typedefs/itkWhiteTopHatImageFilter.idx,
../../Generators/Python/itk/Configuration/ITKMathematicalMorphology_snake_case.py,
../../Generators/Python/itk-stubs/itkFlatStructuringElement.pyi,
../../Generators/Python/itk-stubs/itkBlackTopHatImageFilter.pyi,
../../Generators/Python/itk-stubs/itkClosingByReconstructionImageFilter.pyi,
../../Generators/Python/itk-stubs/itkDoubleThresholdImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleConnectedClosingImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleConnectedOpeningImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleDilateImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleErodeImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleFillholeImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleFunctionDilateImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleFunctionErodeImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleGeodesicDilateImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleGeodesicErodeImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleGrindPeakImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleMorphologicalClosingImageFilter.pyi,
../../Generators/Python/itk-stubs/itkGrayscaleMorphologicalOpeningImageFilter.pyi,
../../Generators/Python/itk-stubs/itkHConcaveImageFilter.pyi,
../../Generators/Python/itk-stubs/itkHConvexImageFilter.pyi,
../../Generators/Python/itk-stubs/itkHMaximaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkHMinimaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkMathematicalMorphologyEnums.pyi,
../../Generators/Python/itk-stubs/itkMorphologicalGradientImageFilter.pyi,
../../Generators/Python/itk-stubs/itkOpeningByReconstructionImageFilter.pyi,
../../Generators/Python/itk-stubs/itkReconstructionByDilationImageFilter.pyi,
../../Generators/Python/itk-stubs/itkReconstructionByErosionImageFilter.pyi,
../../Generators/Python/itk-stubs/itkRegionalMaximaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkRegionalMinimaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkValuedRegionalMaximaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkValuedRegionalMinimaImageFilter.pyi,
../../Generators/Python/itk-stubs/itkWhiteTopHatImageFilter.pyi
[3/2021] Building CXX object Modules/Core/Common/src/CMakeFiles/ITKCommon.dir/__/itkBuildInformation.cxx.o
[4/2021] Linking CXX shared library Wrapping/Generators/Python/itk/libITKCommon-5.3.so.1
[5/2021] Creating library symlink Wrapping/Generators/Python/itk/libITKCommon-5.3.so
[6/2021] Linking CXX shared library Wrapping/Generators/Python/itk/libITKVideoCore-5.3.so.1

I switched to GNU Make

--- /tmp/t	2022-05-02 10:49:54.534548475 +0200
+++ /home/edgar/Progs/Pkg/insight-toolkit/PKGBUILD	2022-05-02 11:13:08.004527735 +0200
@@ -107,9 +107,9 @@
     -DITK_CXX_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
     -DITK_C_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
     -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
-    -G Ninja
-    # -G "Unix Makefiles"
-    # -DCMAKE_BUILD_PARALLEL_LEVEL="${_nproc_make}"
+    # -G Ninja
+    -G "Unix Makefiles"
+    -DCMAKE_BUILD_PARALLEL_LEVEL="${_nproc_make}"

     -DBUILD_TESTING:BOOL=OFF
     -DBUILD_EXAMPLES:BOOL=OFF
@@ -138,7 +138,7 @@
     -DITK_WRAP_VECTOR_COMPONENTS:STRING="2;3;4"
     -DITK_WRAP_double:BOOL=ON
     -DITK_WRAP_float:BOOL=ON
-    #-DITK_WRAP_vector_double:BOOL=ON
+    -DITK_WRAP_vector_double:BOOL=ON
     #-DITK_WRAP_vector_float:BOOL=ON
     # -DITK_WRAP_signed_short:BOOL=ON
     # -DITK_WRAP_signed_char:BOOL=ON
@@ -188,7 +188,7 @@
   # should be in build(), and the files only exist after
   # `cmake'.
   # find "${srcdir}" -type f -regex '.*\.\(supp\|cxx\|txt\|ninja\|make\|so\.1\)' -exec grep --color -nH --null -e 'libdl[^[:space:];]*\.\(so\|a\)[[:digit:].]*' \{\} +
-  sed -i "s%libdl[^[:space:];]*\.so[[:digit:].]*%libdl.so.2%g" "${_build_dir}"/build.ninja
+  # sed -i "s%libdl[^[:space:];]*\.so[[:digit:].]*%libdl.so.2%g" "${_build_dir}"/build.ninja
   # Get rid of triaged MinimalPathExtraction.h
   rm -fr "${srcdir}/${pkgname}"/Modules/Remote/TubeTK/include/MinimalPathExtractionExport.h
   printf "INFO: ... cleaning TubeTK, done\n"
@@ -198,9 +198,9 @@
   local _f=1 _try_i=0 _max_try=20
   while [[ "${_i}" -lt "${_max_try}" ]] && [[ ! "${_f}" == "0" ]]; do
      _f=0
-      # make -s -j6 -C "${_build_dir}" -f "${_build_dir}"/Makefile ||
       # samu -j6 -C "${_build_dir}" -f "${_build_dir}"/build.ninja ||
-      samu -j6 -C "${_build_dir}" ||
+      # samu -j6 -C "${_build_dir}" ||
+      make -s -j6 -C "${_build_dir}" ||
         _f=$?                   # catch error
       _try_i="$(( ${_i} + 1 ))"   # counter
       sleep 3;                    # pause (to kill manually)
@@ -213,8 +213,8 @@

   _get_cores_func;

-  # DESTDIR="${pkgdir}" make -C "${_build_dir}" \
-  DESTDIR="${pkgdir}" samu -C "${_build_dir}" -f "${_build_dir}"/build.ninja \
+  # DESTDIR="${pkgdir}" samu -C "${_build_dir}" -f "${_build_dir}"/build.ninja \
+  DESTDIR="${pkgdir}" make -C "${_build_dir}" \
          -j6 install 1>/dev/null

   # Based on AUR's itk-git package

It also failed

[ 45%] Building CXX object Wrapping/Modules/ITKStatistics/CMakeFiles/ITKStatisticsPython.dir/itkScalarImageToRunLengthFeaturesFilterPython.cpp.o
make[2]: *** [Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonPython.dir/build.make:650: Wrapping/Modules/ITKCommon/itkInPlaceImageFilterAPython.cpp] Error 12
make[1]: *** [CMakeFiles/Makefile2:14454: Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonPython.dir/all] Error 2
[ 45%] Building CXX object Wrapping/Modules/ITKStatistics/CMakeFiles/ITKStatisticsPython.dir/itkScalarImageToRunLengthMatrixFilterPython.cpp.o
[ 45%] Building CXX object Wrapping/Modules/ITKStatistics/CMakeFiles/ITKStatisticsPython.dir/itkScalarImageToTextureFeaturesFilterPython.cpp.o
[ 45%] Building CXX object Wrapping/Modules/ITKStatistics/CMakeFiles/ITKStatisticsPython.dir/itkWeightedCentroidKdTreeGeneratorPython.cpp.o
[ 45%] Linking CXX shared module ../../Generators/Python/itk/_ITKStatisticsPython.so
[ 46%] Built target ITKStatisticsPython
make: *** [Makefile:156: all] Error 2
Consolidate compiler generated dependencies of target itksys
Consolidate compiler generated dependencies of target itkvcl
Consolidate compiler generated dependencies of target itkdouble-conversion

but was able to pick up to some extent if the compilation was restarted.

After some attempts, I cleared the memory again

sync;
echo 1 > /proc/sys/vm/drop_caches 2>&1

But that made the whole compilation to start again

makepkg -ef

[  0%] Built target ITKData
[  0%] Built target itkdouble-conversion
[  0%] Built target ITKDoubleConversion-all
[  0%] Built target ITKEigen3-all
[  0%] Built target itksys
[  0%] Built target ITKKWSys-all
[  0%] Built target itkvcl
[  0%] Built target itktestlib
[  6%] Built target itkv3p_netlib
[  9%] Built target itkvnl
[ 11%] Built target itkvnl_algo
[ 11%] Built target ITKVNL-all
[ 11%] Built target ITKVNLInstantiation
[ 11%] Built target ITKVNLInstantiation-all
[ 13%] Built target ITKCommon
[ 13%] Built target ITKCommon-all
[ 13%] Built target ITKFiniteDifference-all
[ 13%] Built target ITKImageFilterBase-all
[ 13%] Built target ITKCurvatureFlow-all
[ 13%] Built target ITKImageAdaptors-all
[ 13%] Built target itkNetlibSlatec
[ 13%] Built target ITKNetlib-all
[ 13%] Built target ITKStatistics
[ 13%] Built target ITKStatistics-all
[ 13%] Built target ITKTransform
[ 13%] Built target ITKTransform-all
[ 13%] Built target ITKImageFunction-all
[ 13%] Built target ITKImageGrid-all
[ 13%] Built target ITKAnisotropicSmoothing-all
[ 13%] Built target ITKImageCompose-all
[ 13%] Built target ITKMesh
[ 13%] Built target ITKMesh-all
[ 13%] Built target ITKZLIB-all
[ 14%] Built target ITKMetaIO
[ 14%] Built target ITKMetaIO-all
[ 14%] Built target ITKSpatialObjects
[ 14%] Built target ITKSpatialObjects-all
[ 14%] Built target ITKImageStatistics-all
[ 14%] Built target ITKPath
[ 14%] Built target ITKPath-all
[ 14%] Built target ITKImageIntensity
[ 14%] Built target ITKImageIntensity-all
[ 14%] Built target ITKImageLabel-all
[ 15%] Built target ITKLabelMap
[ 15%] Built target ITKLabelMap-all
[ 15%] Built target ITKThresholding-all
[ 15%] Built target ITKConnectedComponents-all
[ 15%] Built target ITKMathematicalMorphology
[ 15%] Built target ITKMathematicalMorphology-all
[ 15%] Built target ITKBinaryMathematicalMorphology-all
[ 15%] Built target ITKNarrowBand-all
[ 15%] Built target ITKDistanceMap-all
[ 15%] Built target ITKQuadEdgeMesh
[ 15%] Built target ITKQuadEdgeMesh-all
[ 15%] Built target ITKFastMarching
[ 15%] Built target ITKFastMarching-all
[ 16%] Built target ITKIOImageBase
[ 16%] Built target ITKIOImageBase-all
[ 16%] Built target ITKImageCompare-all
[ 16%] Built target ITKSmoothing
[ 16%] Built target ITKSmoothing-all
[ 16%] Built target ITKImageGradient-all
[ 16%] Built target ITKImageSources-all
[ 16%] Built target ITKImageFeature
[ 16%] Built target ITKImageFeature-all
[ 16%] Built target ITKOptimizers
[ 16%] Built target ITKOptimizers-all
[ 16%] Built target ITKSignedDistanceFunction-all
[ 16%] Built target ITKLevelSets-all
[ 16%] Built target ITKAntiAlias-all
[ 16%] Built target ITKPolynomials
[ 16%] Built target ITKPolynomials-all
[ 16%] Built target ITKBiasCorrection
[ 16%] Built target ITKBiasCorrection-all
[ 16%] Built target ITKBridgeNumPy-all
[ 16%] Built target ITKClassifiers-all
[ 16%] Built target ITKColormap
[ 16%] Built target ITKColormap-all
[ 16%] Built target ITKFFT
[ 16%] Built target ITKFFT-all
[ 16%] Built target ITKConvolution
[ 16%] Built target ITKConvolution-all
[ 17%] Built target ITKDICOMParser
[ 17%] Built target ITKDICOMParser-all
[ 17%] Built target ITKDeconvolution-all
[ 17%] Built target ITKDeformableMesh
[ 17%] Built target ITKDeformableMesh-all
[ 17%] Built target ITKDenoising
[ 17%] Built target ITKDenoising-all
[ 17%] Built target ITKDiffusionTensorImage
[ 17%] Built target ITKDiffusionTensorImage-all
[ 17%] Built target ITKDisplacementField-all
[ 17%] Built target ITKEigen-all
[ 17%] Built target ITKExpat-all
[ 17%] Built target ITKIOXML
[ 17%] Built target ITKIOXML-all
[ 17%] Built target ITKIOSpatialObjects
[ 17%] Built target ITKIOSpatialObjects-all
[ 17%] Built target ITKRegistrationCommon-all
[ 18%] Built target ITKFEM
[ 18%] Built target ITKFEM-all
[ 18%] Built target ITKPDEDeformableRegistration
[ 18%] Built target ITKPDEDeformableRegistration-all
[ 18%] Built target ITKFEMRegistration
[ 18%] Built target ITKFEMRegistration-all
[ 18%] Built target ITKGDCM-all
[ 18%] Built target ITKznz
[ 19%] Built target ITKniftiio
[ 19%] Built target ITKNIFTI-all
[ 19%] Built target ITKgiftiio
[ 19%] Built target ITKGIFTI-all
[ 19%] Built target ITKGPUCommon-all
[ 19%] Built target ITKGPUFiniteDifference-all
[ 19%] Built target ITKGPUAnisotropicSmoothing-all
[ 19%] Built target ITKGPUImageFilterBase-all
[ 19%] Built target ITKGPURegistrationCommon-all
[ 19%] Built target ITKGPUPDEDeformableRegistration-all
[ 19%] Built target ITKGPUSmoothing-all
[ 19%] Built target ITKGPUThresholding-all
[ 19%] Built target gtest
[ 19%] Built target gtest_main
[ 19%] Built target ITKGoogleTest-all
[ 19%] Built target ITKHDF5-all
[ 19%] Built target ITKIOBMP
[ 19%] Built target ITKIOBMP-all
[ 19%] Built target ITKIOBioRad
[ 19%] Built target ITKIOBioRad-all
[ 19%] Built target ITKIOBruker
[ 19%] Built target ITKIOBruker-all
[ 19%] Built target ITKIOCSV
[ 19%] Built target ITKIOCSV-all
[ 19%] Built target ITKIOGDCM
[ 19%] Built target ITKIOGDCM-all
[ 19%] Built target ITKIOIPL
[ 19%] Built target ITKIOIPL-all
[ 19%] Built target ITKIOGE
[ 19%] Built target ITKIOGE-all
[ 19%] Built target ITKIOGIPL
[ 19%] Built target ITKIOGIPL-all
[ 19%] Built target ITKIOHDF5
[ 19%] Built target ITKIOHDF5-all
[ 19%] Built target ITKJPEG-all
[ 19%] Built target ITKIOJPEG
[ 19%] Built target ITKIOJPEG-all
[ 20%] Built target itkopenjpeg
[ 20%] Built target ITKOpenJPEG-all
[ 20%] Built target ITKIOJPEG2000
[ 20%] Built target ITKIOJPEG2000-all
[ 20%] Built target ITKTIFF-all
[ 20%] Built target ITKIOTIFF
[ 20%] Built target ITKIOTIFF-all
[ 20%] Built target ITKIOLSM
[ 20%] Built target ITKIOLSM-all
[ 20%] Built target itkminc2
[ 20%] Built target ITKMINC-all
[ 20%] Built target ITKIOMINC
[ 20%] Built target ITKIOMINC-all
[ 20%] Built target ITKIOMRC
[ 20%] Built target ITKIOMRC-all
[ 20%] Built target ITKVoronoi-all
[ 20%] Built target ITKIOMeshBase
[ 20%] Built target ITKIOMeshBase-all
[ 20%] Built target ITKIOMeshBYU
[ 20%] Built target ITKIOMeshBYU-all
[ 20%] Built target ITKIOMeshFreeSurfer
[ 20%] Built target ITKIOMeshFreeSurfer-all
[ 20%] Built target ITKIOMeshGifti
[ 20%] Built target ITKIOMeshGifti-all
[ 20%] Built target ITKIOMeshOBJ
[ 20%] Built target ITKIOMeshOBJ-all
[ 20%] Built target ITKIOMeshOFF
[ 20%] Built target ITKIOMeshOFF-all
[ 20%] Built target ITKIOMeshVTK
[ 20%] Built target ITKIOMeshVTK-all
[ 20%] Built target ITKIOMesh-all
[ 20%] Built target ITKIOMeta
[ 20%] Built target ITKIOMeta-all
[ 20%] Built target ITKIONIFTI
[ 20%] Built target ITKIONIFTI-all
[ 21%] Built target ITKNrrdIO
[ 21%] Built target ITKNrrdIO-all
[ 21%] Built target ITKIONRRD
[ 21%] Built target ITKIONRRD-all
[ 21%] Built target ITKPNG-all
[ 21%] Built target ITKIOPNG
[ 21%] Built target ITKIOPNG-all
[ 21%] Built target ITKIORAW-all
[ 21%] Built target ITKIOSiemens
[ 21%] Built target ITKIOSiemens-all
[ 21%] Built target ITKIOStimulate
[ 21%] Built target ITKIOStimulate-all
[ 21%] Built target ITKTransformFactory
[ 21%] Built target ITKTransformFactory-all
[ 21%] Built target ITKIOTransformBase
[ 21%] Built target ITKIOTransformBase-all
[ 21%] Built target ITKIOTransformHDF5
[ 21%] Built target ITKIOTransformHDF5-all
[ 21%] Built target ITKIOTransformInsightLegacy
[ 21%] Built target ITKIOTransformInsightLegacy-all
[ 21%] Built target ITKIOTransformMatlab
[ 21%] Built target ITKIOTransformMatlab-all
[ 21%] Built target ITKIOVTK
[ 21%] Built target ITKIOVTK-all
[ 21%] Built target ITKImageFrequency-all
[ 21%] Built target ITKImageFusion-all
[ 21%] Built target ITKImageNoise-all
[ 21%] Built target ITKIntegratedTest-all
[ 21%] Built target ITKKLMRegionGrowing
[ 21%] Built target ITKKLMRegionGrowing-all
[ 22%] Built target itklbfgs
[ 22%] Built target ITKLIBLBFGS-all
[ 22%] Built target ITKLabelVoting-all
[ 22%] Built target ITKLevelSetsv4-all
[ 22%] Built target ITKMarkovRandomFieldsClassifiers
[ 22%] Built target ITKMarkovRandomFieldsClassifiers-all
[ 22%] Built target ITKOptimizersv4
[ 22%] Built target ITKOptimizersv4-all
[ 22%] Built target ITKMetricsv4-all
[ 22%] Built target ITKQuadEdgeMeshFiltering
[ 22%] Built target ITKQuadEdgeMeshFiltering-all
[ 22%] Built target ITKRegionGrowing
[ 22%] Built target ITKRegionGrowing-all
[ 23%] Built target ITKRegistrationMethodsv4
[ 23%] Built target ITKRegistrationMethodsv4-all
[ 23%] Built target ITKSpatialFunction-all
[ 23%] Built target ITKSuperPixel-all
[ 23%] Built target ITKTestKernel
[ 23%] Built target itkTestDriver
[ 23%] Built target ITKTestKernel-all
[ 23%] Built target ITKVTK
[ 23%] Built target ITKVTK-all
[ 23%] Built target ITKVideoCore
[ 23%] Built target ITKVideoCore-all
[ 23%] Built target ITKVideoFiltering-all
[ 23%] Built target ITKVideoIO
[ 23%] Built target ITKVideoIO-all
[ 23%] Built target ITKWatersheds
[ 23%] Built target ITKWatersheds-all
[ 23%] Built target LabelErodeDilate-all
[ 23%] Built target MinimalPathExtraction
[ 23%] Built target MinimalPathExtraction-all
[ 23%] Built target Montage
[ 23%] Built target Montage-all
[ 23%] Built target MorphologicalContourInterpolation-all
[ 23%] Built target MultipleImageIterator-all
[ 23%] Built target PhaseSymmetry-all
[ 23%] Built target Strain-all
[ 23%] Built target TwoProjectionRegistration-all
[ 23%] Built target copy_python_files
[ 23%] Built target ITKPyBaseCastXML
[ 23%] Built target ITKPyBaseSwig
[ 23%] Built target ITKPyBasePython
[ 24%] Built target ITKCommonCastXML
[ 25%] Built target ITKCommonSwig
[ 25%] Generating itkImageToImageFilterAPython.cpp, ../../Generators/Python/itk/itkImageToImageFilterAPython.py
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:14946: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,3 >,2 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:14946: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,3 >,2 > >' using %template.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:14996: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,4 >,2 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:14996: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,4 >,2 > >' using %template.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15296: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,2 >,3 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15296: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,2 >,3 > >' using %template.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15396: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,4 >,3 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15396: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,4 >,3 > >' using %template.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15696: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,2 >,4 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15696: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,2 >,4 > >' using %template.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15746: Warning 401: Nothing known about base class 'itk::ImageSource< itk::Image< itk::CovariantVector< double,3 >,4 > >'. Ignored.
srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:15746: Warning 401: Maybe you forgot to instantiate 'itk::ImageSource< itk::Image< itk::CovariantVector< double,3 >,4 > >' using %template.
make[2]: *** [Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonPython.dir/build.make:632: Wrapping/Modules/ITKCommon/itkImageToImageFilterAPython.cpp] Error 12
make[1]: *** [CMakeFiles/Makefile2:14454: Wrapping/Modules/ITKCommon/CMakeFiles/ITKCommonPython.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Installation from pip

pip install -U pip
pip purge itk
pip install itk==5.3rc3

System specs

pip -V
uname -r
python --version
pip index versions itk

Hello @edgar!

This may indeed be the case. Could you please share the error you are receiving with your Python script?

Arch

@hubutui does a great job maintaining the ITK Python Arch packages. CC’ing her.

With this change, I enabled the double vectors

  • -DITK_WRAP_vector_double:BOOL=ON

srcdir/insight-toolkit/build/Wrapping/Typedefs/itkImageToImageFilterA.i:14946: Warning 401: Nothing known about base class ‘itk::ImageSource< itk::Image< itk::CovariantVector< double,3 >,2 > >’. Ignored.

Thanks for the report. I will see if I can reproduce this.

Hey! Thanks.

This is the error (I thought that I had posted it, sorry).

 Traceback (most recent call last):
    File "/home/edgar/.local/lib/python3.10/site-packages/itk/support/template_class.py", line 525, in __getitem__
      this_item = self.__template__[key]
  KeyError: (<class 'itk.itkVersorTransformPython.itkVersorTransformD'>, <class 'itk.itkImagePython.itkImageF3'>, <class 'itk.itkImagePython.itkImageF3'>)

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 17, in __PYTHON_EL_eval
    File "itk_deformable_registration.py", line 159, in <module>
      trnfm_init_class = itk.CenteredTransformInitializer[
    File "/home/edgar/.local/lib/python3.10/site-packages/itk/support/template_class.py", line 529, in __getitem__
      raise itk.TemplateTypeError(self, key)
  itk.support.extras.TemplateTypeError: itk.CenteredTransformInitializer is not wrapped for input type `itk.VersorTransform[itk.D], itk.Image[itk.F,3], itk.Image[itk.F,3]`.

  To limit the size of the package, only a limited number of
  types are available in ITK Python. To print the supported
  types, run the following command in your python environment:

      itk.CenteredTransformInitializer.GetTypes()

  Possible solutions:
  ,* If you are an application user:
  ,** Convert your input image into a supported format (see below).
  ,** Contact developer to report the issue.
  ,* If you are an application developer, force input images to be
  loaded in a supported pixel type.

      e.g.: instance = itk.CenteredTransformInitializer[itk.VersorRigid3DTransform[itk.D], itk.Image[itk.SS,3], itk.Image[itk.SS,3]].New(my_input)

  ,* (Advanced) If you are an application developer, build ITK Python yourself and
  turned to `ON` the corresponding CMake option to wrap the pixel type or image
  dimension you need. When configuring ITK with CMake, you can set
  `ITK_WRAP_${type}` (replace ${type} with appropriate pixel type such as
  `double`). If you need to support images with 4 or 5 dimensions, you can add
  these dimensions to the list of dimensions in the CMake variable
  `ITK_WRAP_IMAGE_DIMS`.

  Supported input types:

  itk.VersorRigid3DTransform[itk.D]
  itk.VersorRigid3DTransform[itk.D]
  itk.VersorRigid3DTransform[itk.D]
  itk.VersorRigid3DTransform[itk.D]
  itk.VersorRigid3DTransform[itk.D]
  itk.MatrixOffsetTransformBase[itk.D,2,2]
  itk.MatrixOffsetTransformBase[itk.D,2,2]
  itk.MatrixOffsetTransformBase[itk.D,2,2]
  itk.MatrixOffsetTransformBase[itk.D,2,2]
  itk.MatrixOffsetTransformBase[itk.D,2,2]

I rebuilt the package, and this worked (indicating that the double_vector flag is indeed getting in the way):

    -DITK_WRAP_IMAGE_DIMS:STRING="2;3;4"
    -DITK_WRAP_VECTOR_COMPONENTS:STRING="2;3;4"
    -DITK_WRAP_double:BOOL=ON
    -DITK_WRAP_float:BOOL=ON
    -DITK_WRAP_vector_float:BOOL=ON
    # -DITK_WRAP_vector_double:BOOL=ON
    -DITK_WRAP_signed_short:BOOL=ON
    -DITK_WRAP_signed_char:BOOL=ON
    -DITK_WRAP_rgb_unsigned_short:BOOL=ON
    -DITK_WRAP_rgba_unsigned_short:BOOL=ON
    -DITK_WRAP_unsigned_short:BOOL=ON

After installing the compiled package, I still have the same error, but I can do:

>>> itk.SS
<itkCType signed short>

Yes, I know, she even created an alternative repository outside of the AUR. However, when I tried the PKGBUILD on her repository and the ones on AUR, they didn’t work for me, because of the type of compiler, dependencies (non-free software) and need to connect to internet during compilation.

Thank you very much. Again.

itk-git from AUR is not maintained by me Hope this PKGBUILD from ArchLinux CN repo helps.

As you may remember, the vector_double is active in your PKGBUILD, but it is not working for me. Thanks : ) .

@edgar I was able to reproduce your build error and addressed it here:

2 Likes

Great! Thanks. I will try to build.
[edit]
I just changed

source=("insight-toolkit::git+https://github.com/InsightSoftwareConsortium/ITK#commit=c10ff28"

in the PKGBUILD, and was able to build the package. Thanks!

[edit]
Also, I now have this:
versor_transform_class = itk.VersorRigid3DTransform[versor_type]

(which may not need the recompilation process :b ).

1 Like