[med-svn] r15654 - trunk/packages/insighttoolkit/branches/3.20.1/debian/patches
Mathieu Malaterre
malat at moszumanska.debian.org
Sun Dec 29 11:43:39 UTC 2013
Author: malat
Date: 2013-12-29 11:43:39 +0000 (Sun, 29 Dec 2013)
New Revision: 15654
Added:
trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/tiff5.patch
Modified:
trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/series
Log:
prepare patch
Modified: trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/series
===================================================================
--- trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/series 2013-12-29 11:16:35 UTC (rev 15653)
+++ trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/series 2013-12-29 11:43:39 UTC (rev 15654)
@@ -14,3 +14,4 @@
ITKNrrdIOmath.patch
bug667417.patch
nan-i386.patch
+tiff5.patch
Added: trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/tiff5.patch
===================================================================
--- trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/tiff5.patch (rev 0)
+++ trunk/packages/insighttoolkit/branches/3.20.1/debian/patches/tiff5.patch 2013-12-29 11:43:39 UTC (rev 15654)
@@ -0,0 +1,113 @@
+Description: Move to TIFF5 API
+Author: Mathieu Malaterre <malat at debian.org>
+Bug-Debian: http://bugs.debian.org/732709
+
+Index: insighttoolkit-3.20.1+git20120521/Code/IO/itkTIFFImageIO.cxx
+===================================================================
+--- insighttoolkit-3.20.1+git20120521.orig/Code/IO/itkTIFFImageIO.cxx 2013-12-29 12:39:21.046971349 +0100
++++ insighttoolkit-3.20.1+git20120521/Code/IO/itkTIFFImageIO.cxx 2013-12-29 12:39:26.394971467 +0100
+@@ -291,8 +291,8 @@
+ unsigned int width,
+ unsigned int height )
+ {
+- unsigned int isize = TIFFScanlineSize(m_InternalImage->m_Image);
+- unsigned int cc;
++ uint64 isize = TIFFScanlineSize64(m_InternalImage->m_Image);
++ uint64 cc;
+ int row;
+ tdata_t buf = _TIFFmalloc(isize);
+
+@@ -445,8 +445,8 @@
+ unsigned int width,
+ unsigned int height )
+ {
+- unsigned int isize = TIFFScanlineSize(m_InternalImage->m_Image);
+- unsigned int cc;
++ uint64 isize = TIFFScanlineSize64(m_InternalImage->m_Image);
++ uint64 cc;
+ int row, inc;
+ tdata_t buf = _TIFFmalloc(isize);
+
+@@ -1697,7 +1697,16 @@
+
+ int predictor;
+
+- TIFF *tif = TIFFOpen(m_FileName.c_str(), "w");
++ const char *mode = "w";
++ // if the size of the image if greater then 2GB then use big tiff
++ if ( this->GetImageSizeInBytes() > SizeType( 1073741824u ) * 3 )
++ {
++ // adding the 8 enable big tiff
++ mode = "w8";
++ }
++
++
++ TIFF *tif = TIFFOpen(m_FileName.c_str(), mode );
+ if ( !tif )
+ {
+ itkExceptionMacro("Error while trying to open file for writing: "
+@@ -1856,6 +1865,21 @@
+ TIFFClose(tif);
+ }
+
++// With the TIFF 4.0 (aka bigtiff ) interface the tiff field structure
++// was renamed and became an opaque type requiring function to
++// access. The follow are some macros for portable access.
++#ifdef TIFF_INT64_T // detect if libtiff4
++#define itkTIFFFieldReadCount( TIFFField ) TIFFFieldReadCount( TIFFField )
++#define itkTIFFFieldPassCount( TIFFField ) TIFFFieldPassCount( TIFFField )
++#define itkTIFFFieldDataType( TIFFField ) TIFFFieldDataType( TIFFField )
++#define itkTIFFField TIFFField
++#else
++#define itkTIFFFieldReadCount( TIFFFieldInfo ) ((TIFFFieldInfo)->field_readcount)
++#define itkTIFFFieldPassCount( TIFFFieldInfo ) ((TIFFFieldInfo)->field_passcount)
++#define itkTIFFFieldDataType( TIFFFieldInfo ) ((TIFFFieldInfo)->field_type)
++#define itkTIFFField TIFFFieldInfo
++#endif
++
+ bool TIFFImageIO::CanFindTIFFTag( unsigned int t )
+ {
+ // m_InternalImage needs to be valid
+@@ -1866,7 +1890,7 @@
+ }
+
+ ttag_t tag = t; // 32bits integer
+- const TIFFFieldInfo *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
++ const itkTIFFField *fld = TIFFFieldWithTag(m_InternalImage->m_Image, tag);
+ if( fld == NULL )
+ {
+ return false;
+@@ -1884,7 +1908,7 @@
+ }
+ ttag_t tag = t;
+ void *raw_data = NULL;
+- const TIFFFieldInfo *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
++ const itkTIFFField *fld = TIFFFieldWithTag( m_InternalImage->m_Image, tag );
+ if( fld == NULL )
+ {
+ itkExceptionMacro( << "fld is NULL" );
+@@ -1892,21 +1916,10 @@
+ }
+ else
+ {
+- if( fld->field_passcount )
++ if ( itkTIFFFieldDataType( fld ) != TIFF_BYTE )
+ {
+- if( TIFFGetField( m_InternalImage->m_Image, tag, &value_count, &raw_data ) != 1 )
+- {
+- itkExceptionMacro( << "Tag cannot be found" );
+- return NULL;
+- }
+- else
+- {
+- if( fld->field_type != TIFF_BYTE )
+- {
+- itkExceptionMacro( << "Tag is not of type TIFF_BYTE" );
+- return NULL;
+- }
+- }
++ itkExceptionMacro(<< "Tag is not of type TIFF_BYTE");
++ return NULL;
+ }
+ }
+ return raw_data;
More information about the debian-med-commit
mailing list