66#ifndef TIFF_UTILS_HPP
77#define TIFF_UTILS_HPP
88
9+ #ifdef HAVE_LIBTIFF
910
1011#include < string>
11- #ifdef HAVE_LIBTIFF
12- #include < tiffio.h>
13- #endif
12+ #include < tiffio.h>
1413#include < sstream>
1514#include " data_structures/Mesh/PixelData.hpp"
1615
@@ -58,9 +57,7 @@ namespace TiffUtils {
5857 outputStr << " NOT SUPPORTED" ;
5958 }
6059 outputStr << " , Photometric: " << iPhotometric;
61- #ifdef HAVE_LIBTIFF
6260 outputStr << " , StripSize: " << TIFFStripSize (iFile);
63- #endif /* HAVE_LIBTIFF */
6461
6562 return outputStr.str ();
6663 }
@@ -71,12 +68,7 @@ namespace TiffUtils {
7168 bool isFileOpened () const { return iFile != nullptr ; }
7269
7370 TiffType iType = TiffType::TIFF_INVALID;
74- #ifdef HAVE_LIBTIFF
7571 TIFF *iFile = nullptr ;
76- #else
77- void * iFile = nullptr ;
78- typedef unsigned int uint32;
79- #endif /* HAVE_LIBTIFF */
8072 std::string iFileName = " " ;
8173 uint32 iImgWidth = 0 ;
8274 uint32 iImgHeight = 0 ;
@@ -90,12 +82,6 @@ namespace TiffUtils {
9082 TiffInfo (const TiffInfo&) = delete ; // make it noncopyable
9183 TiffInfo& operator =(const TiffInfo&) = delete ; // make it not assignable
9284
93- friend std::ostream& operator <<(std::ostream &os, const TiffInfo &obj) {
94- os << obj.toString ();
95- return os;
96- }
97-
98- #ifdef HAVE_LIBTIFF
9985 /* *
10086 * opens TIFF
10187 **/
@@ -157,21 +143,12 @@ namespace TiffUtils {
157143 }
158144 }
159145
160- #else
161- bool open (const std::string &aFileName) {
162- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
163- std::cerr << " Trying to open file " << aFileName << " , returning false." << std::endl;
164- return false ;
165- }
166-
167- void close () {
168- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
169- std::cerr << " Shim-closing TIFF file" << std::endl;
146+ friend std::ostream& operator <<(std::ostream &os, const TiffInfo &obj) {
147+ os << obj.toString ();
148+ return os;
170149 }
171- #endif /* HAVE_LIBTIFF */
172150 };
173151
174- #ifdef HAVE_LIBTIFF
175152
176153 /* *
177154 * Reads TIFF file to mesh
@@ -311,46 +288,8 @@ namespace TiffUtils {
311288 PixelData<uint16_t > mesh16{aData, true /* copy data*/ };
312289 saveMeshAsTiff (filename, mesh16);
313290 }
314- #else
315- template <typename T>
316- PixelData<T> getMesh (const std::string &aFileName) {
317- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
318- std::cerr << " getMesh() called for " << &aFileName << " , returning empty mesh." << std::endl;
319-
320- PixelData<T> mesh (1 , 1 , 1 );
321- return mesh;
322- }
323-
324- template <typename T>
325- PixelData<T> getMesh (const TiffInfo &aTiff) {
326- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
327- std::cerr << " getMesh() called for TiffInfo, returning empty mesh." << std::endl;
328-
329- PixelData<T> mesh (1 , 1 , 1 );
330- return mesh;
331- }
332-
333- template <typename T>
334- void getMesh (const TiffInfo &aTiff, PixelData<T> &aInputMesh) {
335- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
336- std::cerr << " getMesh() called for inputMesh, returning empty inputMesh." << std::endl;
337-
338- PixelData<T> mesh (1 , 1 , 1 );
339- aInputMesh.swap (mesh);
340- }
341-
342- template <typename T>
343- void saveMeshAsTiff (const std::string &aFileName, const PixelData<T> &aData) {
344- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
345- std::cerr << " saveMeshAsTiff() called for " << aFileName << " , not doing anything." << std::endl;
346- }
347-
348- template <typename T>
349- void saveMeshAsTiffUint16 (const std::string &filename, const PixelData<T> &aData) {
350- std::cerr << " libapr compiled without LibTIFF support, simulating TIFF reader functionality" << std::endl;
351- std::cerr << " saveMeshAsTiff() called for " << filename << " , not doing anything." << std::endl;
352- }
353- #endif
354291}
355292
293+ #endif // HAVE_LIBTIFF
294+
356295#endif
0 commit comments