ISIS Core Library 0.7.2 (api 3.0.0)
|
00001 // 00002 // C++ Interface: common 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: Enrico Reimer<reimer@cbs.mpg.de>, (C) 2009 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 00013 #ifndef DATA_COMMON_HPP 00014 #define DATA_COMMON_HPP 00015 00016 #include "../CoreUtils/log_modules.hpp" 00017 #include "../CoreUtils/log.hpp" 00018 #include "../CoreUtils/propmap.hpp" 00019 #include "../config.hpp" 00020 00021 #include <boost/numeric/ublas/matrix.hpp> 00022 #include <boost/numeric/ublas/lu.hpp> 00023 00024 namespace isis 00025 { 00026 00027 namespace image_io 00028 { 00029 typedef ImageIoLog Runtime; 00030 typedef ImageIoDebug Debug; 00031 00032 template<typename HANDLE> void enableLog( LogLevel level ) 00033 { 00034 ENABLE_LOG( Runtime, HANDLE, level ); 00035 ENABLE_LOG( Debug, HANDLE, level ); 00036 } 00037 } //namespace image_io 00038 00039 namespace data 00040 { 00041 00042 namespace _internal 00043 { 00044 using namespace boost::numeric::ublas; 00045 00046 00047 template <typename TYPE> 00048 bool inverseMatrix( const matrix<TYPE> &inMatrix, matrix<TYPE> &inverse ) 00049 { 00050 matrix<TYPE> A( inMatrix ); 00051 permutation_matrix<TYPE> pm( A.size1() ); 00052 00053 if( lu_factorize( A, pm ) != 0 ) { 00054 return false; 00055 } 00056 00057 inverse.assign( identity_matrix<TYPE>( inMatrix.size1() ) ); 00058 lu_substitute( A, pm, inverse ); 00059 return true; 00060 } 00061 00062 bool transformCoords( isis::util::PropertyMap &, const isis::util::vector4<size_t> size, boost::numeric::ublas::matrix<float>, bool transformCenterIsImageCenter = false ); 00063 00064 } 00065 00066 typedef DataLog Runtime; 00067 typedef DataDebug Debug; 00068 enum dimensions {rowDim = 0, columnDim, sliceDim, timeDim}; 00069 enum scannerAxis { x = 0, y, z, t }; 00070 00079 template<typename HANDLE> void enableLog( LogLevel level ) 00080 { 00081 ENABLE_LOG( Runtime, HANDLE, level ); 00082 ENABLE_LOG( Debug, HANDLE, level ); 00083 } 00084 class Image; 00085 boost::filesystem::path getCommonSource( std::list<boost::filesystem::path> sources ); 00086 boost::filesystem::path getCommonSource( const std::list<data::Image> &imgs ); 00087 boost::filesystem::path getCommonSource( const data::Image &img ); 00088 } 00089 } 00090 #endif //DATA_COMMON_HPP