[med-svn] [Git][med-team/ciftilib][master] 11 commits: New upstream version 1.6.0

Andreas Tille gitlab at salsa.debian.org
Sun Jan 17 14:29:45 GMT 2021



Andreas Tille pushed to branch master at Debian Med / ciftilib


Commits:
9e42295a by Andreas Tille at 2021-01-17T15:23:02+01:00
New upstream version 1.6.0
- - - - -
2e58203e by Andreas Tille at 2021-01-17T15:23:07+01:00
Update upstream source from tag 'upstream/1.6.0'

Update to upstream version '1.6.0'
with Debian dir aef4d934e80556836ac264c7bc81cb9a79f8e848
- - - - -
9f7c8d11 by Andreas Tille at 2021-01-17T15:23:35+01:00
New upstream version

- - - - -
bd5c6c19 by Andreas Tille at 2021-01-17T15:23:49+01:00
routine-update: Standards-Version: 4.5.1

- - - - -
c49e6a87 by Andreas Tille at 2021-01-17T15:23:49+01:00
routine-update: debhelper-compat 13

- - - - -
d8939261 by Andreas Tille at 2021-01-17T15:23:56+01:00
routine-update: Add salsa-ci file

- - - - -
0e78c779 by Andreas Tille at 2021-01-17T15:23:57+01:00
routine-update: Rules-Requires-Root: no

- - - - -
76270ad8 by Andreas Tille at 2021-01-17T15:23:58+01:00
Set upstream metadata fields: Repository.

Changes-By: lintian-brush

- - - - -
53d11285 by Andreas Tille at 2021-01-17T15:23:59+01:00
routine-update: watch file standard 4

- - - - -
9118b11c by Andreas Tille at 2021-01-17T15:26:00+01:00
Refresh patches

- - - - -
c7e312b7 by Andreas Tille at 2021-01-17T15:29:11+01:00
Upload to unstable

- - - - -


20 changed files:

- .travis.yml
- CMakeLists.txt
- CiftiLib.pc.in
- USAGE
- debian/changelog
- debian/control
- − debian/patches/0001-force-endian-of-datatype-example-to-make-tests-pass-.patch
- debian/patches/0002-Fix-compilation-with-Boost-1.71.patch
- debian/patches/series
- + debian/salsa-ci.yml
- debian/upstream/metadata
- debian/watch
- example/datatype.cxx
- example/xmlinfo.cxx
- src/Cifti/VolumeSpace.cxx
- src/CiftiFile.cxx
- src/Common/AString.h
- src/Common/BinaryFile.cxx
- src/Nifti/NiftiHeader.cxx
- src/NiftiIO.h


Changes:

=====================================
.travis.yml
=====================================
@@ -1,3 +1,8 @@
+os: linux
+arch:
+ - amd64
+ - ppc64le
+ 
 language: cpp
 sudo: false
 
@@ -30,7 +35,7 @@ before_install:
     - cd ../build
 
 script:
-    - cmake -D BUILD_SHARED_LIBS:BOOL=$SHARED -D IGNORE_QT:BOOL=$IGNORE_QT ../CiftiLib
+    - cmake -D CMAKE_CXX_FLAGS="-W -Wall -Wno-narrowing" -D BUILD_SHARED_LIBS:BOOL=$SHARED -D IGNORE_QT:BOOL=$IGNORE_QT ../CiftiLib
     - export LD_LIBRARY_PATH=$(if [[ $CXX == "clang++" ]]; then echo -n '/usr/local/clang/lib'; fi)
     - make -j 4
     - example/xmlinfo ../CiftiLib/example/data/ones.dscalar.nii


=====================================
CMakeLists.txt
=====================================
@@ -22,6 +22,22 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/"
 
 INCLUDE(UseDoxygen)
 
+#TSC: glibmm requires c++11, so it needs to be in the compile flags - in older cmake, this needs to be done manually
+IF (${CMAKE_VERSION} VERSION_LESS "3.1")
+    IF (CMAKE_COMPILER_IS_GNUCC)
+        include(CheckCXXCompilerFlag)
+        CHECK_CXX_COMPILER_FLAG("-std=c++11" GCC_STD11)
+        IF (${GCC_STD11})
+            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+        ELSE (${GCC_STD11})
+            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+        ENDIF (${GCC_STD11})
+    ENDIF (CMAKE_COMPILER_IS_GNUCC)
+ELSE (${CMAKE_VERSION} VERSION_LESS "3.1")
+    SET(CMAKE_CXX_STANDARD 11)
+    SET(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+ENDIF (${CMAKE_VERSION} VERSION_LESS "3.1")
+
 #QT
 IF (NOT IGNORE_QT)
     FIND_PACKAGE(Qt4 4.8.0 QUIET)


=====================================
CiftiLib.pc.in
=====================================
@@ -5,6 +5,6 @@ Name: CiftiLib
 Description: C++ Library for reading and writing CIFTI-2 and CIFTI-1 files
 Version: @CIFTILIB_VERSION@
 URL: https://github.com/Washington-University/CiftiLib
-Cflags: -I${includedir}/CiftiLib @CIFTILIB_PKGCONFIG_DEFINE@
+Cflags: -I${includedir}/CiftiLib @CIFTILIB_PKGCONFIG_DEFINE@ @OpenMP_CXX_FLAGS@
 Libs: -L${libdir} -lCifti
 @CIFTILIB_PKGCONFIG_REQUIRES_LINE@


=====================================
USAGE
=====================================
@@ -1,5 +1,6 @@
-The main object for dealing with Cifti is CiftiFile.  To set up a new CiftiFile,
-make a CiftiXML object with the mappings you want, and call setCiftiXML on the CiftiFile object.
+The only header you need to include is CiftiFile.h, it will include the other needed headers.  The main
+object for dealing with Cifti is CiftiFile.  To set up a new CiftiFile, make a CiftiXML object with the
+mappings you want, and call setCiftiXML on the CiftiFile object.
 
 The XML tells you things about the mappings, and lets you set new mappings or modify existing ones:
 
@@ -16,10 +17,12 @@ if (rowType == CiftiMappingType::SCALARS)
 See the rewrite example for how to read and write data to CiftiFile.
 
 CiftiFile internally uses NiftiIO, which is a NIfTI reader for both NIfTI-1 and NIfTI-2 single-file (.nii),
-including reading .nii.gz files if zlib is found (NOTE: .nii.gz should not be used for CIFTI files,
-as seeking is slow, and seeking backwards is impossible).
-
-Our nifti1.h and nifti2.h are slightly modified, replacing the #defines of standard values for header fields
-with constant integers.  We also declare CIFTI-specific intent codes and the extension code in nifti2.h,
-and have some macros for determining header version.
+including reading .nii.gz files if zlib is found (NOTE: .nii.gz is not allowed in the CIFTI-2 standard, as
+seeking is slow, and seeking backwards is problematic).  If you want to use our NIfTI implementation to
+read volume files, include NiftiIO.h.  We do not provide a VolumeFile object, NiftiIO only handles the
+low-level file format details.
 
+Our nifti1.h and nifti2.h are slightly modified, replacing the #defines of standard values for header
+fields with constant integers, and placing almost everything in a namespace so that it shouldn't interfere
+with an existing nifti implementation in the same codebase.  We also declare CIFTI-specific intent codes
+and the CIFTI extension code in nifti2.h, and have some macros for determining header version.


=====================================
debian/changelog
=====================================
@@ -1,9 +1,16 @@
-ciftilib (1.6.0-1) UNRELEASED; urgency=medium
+ciftilib (1.6.0-1) unstable; urgency=medium
 
   * Team upload.
+  * New upstream version
   * Remove default debian/gbp.conf
-
- -- Andreas Tille <tille at debian.org>  Sun, 17 Jan 2021 15:15:45 +0100
+  * Standards-Version: 4.5.1 (routine-update)
+  * debhelper-compat 13 (routine-update)
+  * Add salsa-ci file (routine-update)
+  * Rules-Requires-Root: no (routine-update)
+  * Set upstream metadata fields: Repository.
+  * watch file standard 4 (routine-update)
+
+ -- Andreas Tille <tille at debian.org>  Sun, 17 Jan 2021 15:26:15 +0100
 
 ciftilib (1.5.3-4) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -4,16 +4,17 @@ Uploaders: Ghislain Antony Vaillant <ghisvail at gmail.com>
 Section: libs
 Priority: optional
 Build-Depends: cmake,
-               debhelper-compat (= 12),
+               debhelper-compat (= 13),
                libboost-dev,
                libboost-filesystem-dev,
                libxml++2.6-dev,
                zlib1g-dev
 Build-Depends-Indep: doxygen
-Standards-Version: 4.4.1
+Standards-Version: 4.5.1
 Vcs-Browser: https://salsa.debian.org/med-team/ciftilib
 Vcs-Git: https://salsa.debian.org/med-team/ciftilib.git
 Homepage: https://github.com/Washington-University/CiftiLib
+Rules-Requires-Root: no
 
 Package: libcifti0
 Architecture: any


=====================================
debian/patches/0001-force-endian-of-datatype-example-to-make-tests-pass-.patch deleted
=====================================
@@ -1,30 +0,0 @@
-From: Tim Coalson <tsc5yc at mst.edu>
-Date: Mon, 1 Apr 2019 16:56:12 -0500
-Subject: force endian of datatype example to make tests pass on bigendian
- systems
-
----
- example/datatype.cxx | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/example/datatype.cxx b/example/datatype.cxx
-index a293856..1da380b 100644
---- a/example/datatype.cxx
-+++ b/example/datatype.cxx
-@@ -19,14 +19,14 @@ int main(int argc, char** argv)
-     if (argc < 3)
-     {
-         cout << "usage: " << argv[0] << " <input cifti> <output cifti>" << endl;
--        cout << "  rewrite the input cifti file to the output filename, using uint8 and data scaling." << endl;
-+        cout << "  rewrite the input cifti file to the output filename, using uint8 and data scaling, little-endian." << endl;
-         return 1;
-     }
-     try
-     {
-         CiftiFile inputFile(argv[1]);//on-disk reading by default
-         inputFile.setWritingDataTypeAndScaling(NIFTI_TYPE_UINT8, -1.0, 6.0);//tells it to use this datatype to best represent this specified range of values [-1.0, 6.0] whenever this instance is written
--        inputFile.writeFile(argv[2]);//if this is the same filename as the input, CiftiFile actually detects this and reads the input into memory first
-+        inputFile.writeFile(argv[2], CiftiVersion(), CiftiFile::LITTLE);//if this is the same filename as the input, CiftiFile actually detects this and reads the input into memory first
-         //otherwise, it will read and write one row at a time, using very little memory
-         //inputFile.setWritingDataTypeNoScaling(NIFTI_TYPE_FLOAT32);//this is how you would revert back to writing as float32 without rescaling
-     } catch (CiftiException& e) {


=====================================
debian/patches/0002-Fix-compilation-with-Boost-1.71.patch
=====================================
@@ -8,8 +8,6 @@ Method file_string() is now obsolete and just calls string().
  src/CiftiFile.cxx | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/src/CiftiFile.cxx b/src/CiftiFile.cxx
-index 9bbb16d..6b15311 100644
 --- a/src/CiftiFile.cxx
 +++ b/src/CiftiFile.cxx
 @@ -100,7 +100,7 @@ namespace


=====================================
debian/patches/series
=====================================
@@ -1,2 +1 @@
-0001-force-endian-of-datatype-example-to-make-tests-pass-.patch
 0002-Fix-compilation-with-Boost-1.71.patch


=====================================
debian/salsa-ci.yml
=====================================
@@ -0,0 +1,4 @@
+---
+include:
+  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml


=====================================
debian/upstream/metadata
=====================================
@@ -1,4 +1,4 @@
 Bug-Database: https://github.com/Washington-University/CiftiLib/issues
 Bug-Submit: https://github.com/Washington-University/CiftiLib/issues/new
-Repository: git at github.com:Washington-University/CiftiLib
+Repository: https://github.com/Washington-University/CiftiLib.git
 Repository-Browse: https://github.com/Washington-University/CiftiLib


=====================================
debian/watch
=====================================
@@ -1,3 +1,3 @@
-version=3
+version=4
 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/CiftiLib-$1\.tar\.gz/ \
 https://github.com/Washington-University/CiftiLib/tags .*/v?(\d\S*)\.tar\.gz


=====================================
example/datatype.cxx
=====================================
@@ -19,14 +19,14 @@ int main(int argc, char** argv)
     if (argc < 3)
     {
         cout << "usage: " << argv[0] << " <input cifti> <output cifti>" << endl;
-        cout << "  rewrite the input cifti file to the output filename, using uint8 and data scaling." << endl;
+        cout << "  rewrite the input cifti file to the output filename, using uint8 and data scaling, little-endian." << endl;
         return 1;
     }
     try
     {
         CiftiFile inputFile(argv[1]);//on-disk reading by default
         inputFile.setWritingDataTypeAndScaling(NIFTI_TYPE_UINT8, -1.0, 6.0);//tells it to use this datatype to best represent this specified range of values [-1.0, 6.0] whenever this instance is written
-        inputFile.writeFile(argv[2]);//if this is the same filename as the input, CiftiFile actually detects this and reads the input into memory first
+        inputFile.writeFile(argv[2], CiftiVersion(), CiftiFile::LITTLE);//if this is the same filename as the input, CiftiFile actually detects this and reads the input into memory first
         //otherwise, it will read and write one row at a time, using very little memory
         //inputFile.setWritingDataTypeNoScaling(NIFTI_TYPE_FLOAT32);//this is how you would revert back to writing as float32 without rescaling
     } catch (CiftiException& e) {


=====================================
example/xmlinfo.cxx
=====================================
@@ -21,7 +21,7 @@ int main(int argc, char** argv)
     }
     try
     {
-        CiftiFile inputFile(argv[1]);//on-disk reading by default, and we only need the XML header anyway
+        CiftiFile inputFile((string(argv[1])));//on-disk reading by default, and we only need the XML header anyway
         const CiftiXML& myXML = inputFile.getCiftiXML();
         for (int whichDim = 0; whichDim < myXML.getNumberOfDimensions(); ++whichDim)
         {


=====================================
src/Cifti/VolumeSpace.cxx
=====================================
@@ -69,7 +69,7 @@ VolumeSpace::VolumeSpace(const int64_t dims[3], const float sform[12])
 
 void VolumeSpace::setSpace(const int64_t dims[3], const vector<vector<float> >& sform)
 {
-    if (sform.size() < 2 || sform.size() > 4)
+    if (sform.size() < 3 || sform.size() > 4)
     {
         CiftiAssert(false);
         throw CiftiException("VolumeSpace initialized with wrong size sform");


=====================================
src/CiftiFile.cxx
=====================================
@@ -476,6 +476,10 @@ namespace
         int32_t intent_code = myXML.getIntentInfo(CiftiVersion(), junk);//use default writing version to check file extension, older version is missing some intent codes
         switch (intent_code)
         {
+            default:
+                cerr << "warning: unhandled cifti type in extension warning check, tell the developers what you just tried to do" << endl;
+                CiftiAssert(0);//yes, let it fall through to "unknown" in release so that it at least looks for .nii
+                //-fallthrough
             case 3000://unknown
                 if (!AString_endsWith(filename, ".nii"))
                 {
@@ -496,7 +500,7 @@ namespace
                     AString_endsWith(filename, ".pconnscalar.nii"))
                 {
                     cerr << "warning: cifti file of nonstandard mapping combination '" << AString_to_std_string(filename) << "' should NOT be saved using an already-used cifti extension, "
-                            << "please choose a different, reasonable cifti extension ending in .<something>.nii" << endl;
+                            << "please choose a different, reasonable cifti extension of the form .<something>.nii" << endl;
                 }
                 break;
             case 3001:
@@ -566,9 +570,6 @@ namespace
                     cerr << "warning: parcels by parcels by scalar cifti file '" << AString_to_std_string(filename) << "' should be saved ending in .pconnscalar.nii" << endl;
                 }
                 break;
-            default:
-                CiftiAssert(0);
-                throw CiftiException("internal error, tell the developers what you just tried to do");
         }
     }
 }


=====================================
src/Common/AString.h
=====================================
@@ -42,7 +42,23 @@
 #include <QString>
 namespace cifti
 {
-    typedef QString AString;
+    struct AString : public QString
+    {//QT doesn't convert from std::string, and conversions have to be member functions
+        AString() : QString() {}
+        
+        //some QString constructors are explicit, so instead only make conversion constructors for whatever works with assignment to QString
+        //the cast is required to avoid recursing through AString
+        template <typename T>
+        AString(const T& rhs) : QString()
+        {
+            *(static_cast<QString*>(this)) = rhs;
+        }
+        
+        AString(const std::string& rhs) : QString()
+        {
+            (*this) = fromStdString(rhs);
+        }
+    };
 #define ASTRING_TO_CSTR(mystr) ((mystr).toLocal8Bit().constData())
 #define ASTRING_UTF8_RAW(mystr) ((mystr).toUtf8().constData())
     inline std::string AString_to_std_string(const AString& mystr)


=====================================
src/Common/BinaryFile.cxx
=====================================
@@ -141,12 +141,12 @@ AString BinaryFile::getFilename() const
 
 bool BinaryFile::getOpenForRead()
 {
-    return (m_curMode | READ) != 0;
+    return (m_curMode & READ) != 0;
 }
 
 bool BinaryFile::getOpenForWrite()
 {
-    return (m_curMode | WRITE) != 0;
+    return (m_curMode & WRITE) != 0;
 }
 
 void BinaryFile::open(const AString& filename, const OpenMode& opmode)
@@ -390,6 +390,7 @@ void QFileImpl::read(void* dataOut, const int64_t& count, int64_t* numRead)
 
 void QFileImpl::seek(const int64_t& position)
 {
+    if (m_file.pos() == position) return; //QFile::seek always does a flush in qt5, so try to avoid calling it
     if (!m_file.seek(position)) throw CiftiException("seek failed in file '" + m_fileName + "'");
 }
 


=====================================
src/Nifti/NiftiHeader.cxx
=====================================
@@ -779,7 +779,7 @@ NiftiHeader::Quirks NiftiHeader::setupFrom(const nifti_2_header& header, const A
 {
     Quirks ret;
     if (header.sizeof_hdr != sizeof(nifti_2_header)) throw CiftiException("incorrect sizeof_hdr in file '" + filename + "'");
-    const char magic[] = "n+2\0\r\n\032\n";//only support single-file nifti
+    const char magic[] = "n+2\0\r\n\032\n";//only support single-file nifti, magic string detailed at https://www.nitrc.org/forum/forum.php?thread_id=2148&forum_id=1941
     for (int i = 0; i < 8; ++i)
     {
         if (header.magic[i] != magic[i]) throw CiftiException("incorrect magic in file '" + filename + "'");


=====================================
src/NiftiIO.h
=====================================
@@ -305,13 +305,14 @@ namespace cifti
     template<typename TO, typename FROM>
     TO NiftiIO::clamp(const FROM& in)
     {
-        std::numeric_limits<TO> mylimits;
-        if (mylimits.max() < in) return mylimits.max();
-        if (mylimits.is_integer)//c++11 can use lowest() instead of this mess
+        typedef std::numeric_limits<TO> mylimits;
+        if (mylimits::has_infinity && std::isinf(in)) return (TO)in;//in case we use this on float types at some point
+        if (mylimits::max() < in) return mylimits::max();
+        if (mylimits::is_integer)//c++11 can use lowest() instead of this mess
         {
-            if (mylimits.min() > in) return mylimits.min();
+            if (mylimits::min() > in) return mylimits::min();
         } else {
-            if (-mylimits.max() > in) return -mylimits.max();
+            if (-mylimits::max() > in) return -mylimits::max();
         }
         return (TO)in;
     }



View it on GitLab: https://salsa.debian.org/med-team/ciftilib/-/compare/ec05923d074ea59ccb6c31250c758dfac162f9ce...c7e312b7f8f7f7c123b404362837c2019d151275

-- 
View it on GitLab: https://salsa.debian.org/med-team/ciftilib/-/compare/ec05923d074ea59ccb6c31250c758dfac162f9ce...c7e312b7f8f7f7c123b404362837c2019d151275
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210117/ec84b70c/attachment-0001.html>


More information about the debian-med-commit mailing list