00001 ///////////////////////////////////////////////////////////////////// 00002 // 9/6/02 Aaron Lefohn Scientific Computing and Imaging Institute 00003 // School of Computing University of Utah 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //////////////////////////////////////////////////////////////////////// 00019 00020 #include <texture/texDataNd.h> 00021 #include <util/gliftNrrd.h> 00022 00023 #ifdef GLIFT_NRRD 00024 00025 using namespace gutz; 00026 00027 using namespace glift; 00028 00029 /// Assume origin=0, inFormat=exFormat, borderW=0 00030 NrrdTexData::NrrdTexData( GLenum texDimenName, GLenum dataFormat, Nrrd* nIn ) 00031 : m_nIn( nIn ), 00032 TexData( texDimenName, vec3i(0), getDimen(nIn), 0, dataFormat, dataFormat, 00033 typeN2GL( m_nIn->type ), m_nIn->data ) 00034 {} 00035 00036 /// Full Nrrd constructor 00037 NrrdTexData::NrrdTexData( GLenum texDimenName, const vec3i& origin, int borderW, 00038 GLenum glFormat, GLenum dataFormat, Nrrd* nIn ) 00039 : TexData( texDimenName, origin, getDimen(nIn), borderW, glFormat, dataFormat, 00040 typeN2GL( nIn->type ), nIn->data ), 00041 m_nIn( nIn ) 00042 00043 { 00044 } 00045 00046 /// Get the size of each dimension from the Nrrd 00047 vec4i NrrdTexData::getDimen(Nrrd *nIn) 00048 { 00049 assert(nIn->dim < 4); 00050 00051 vec4i dimen; 00052 00053 /// Set the size of each dimension 00054 nrrdAxesGet_nva( nIn, nrrdAxesInfoSize, dimen.v() ); 00055 00056 return dimen; 00057 } 00058 00059 00060 #endif 00061