VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMINCImageReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*========================================================================= 00016 00017 Copyright (c) 2006 Atamai, Inc. 00018 00019 Use, modification and redistribution of the software, in source or 00020 binary forms, are permitted provided that the following terms and 00021 conditions are met: 00022 00023 1) Redistribution of the source code, in verbatim or modified 00024 form, must retain the above copyright notice, this license, 00025 the following disclaimer, and any notices that refer to this 00026 license and/or the following disclaimer. 00027 00028 2) Redistribution in binary form must include the above copyright 00029 notice, a copy of this license and the following disclaimer 00030 in the documentation or with other materials provided with the 00031 distribution. 00032 00033 3) Modified copies of the source code must be clearly marked as such, 00034 and must not be misrepresented as verbatim copies of the source code. 00035 00036 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" 00037 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO, 00038 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00039 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY 00040 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE 00041 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES 00042 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE 00043 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF 00044 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE 00045 POSSIBILITY OF SUCH DAMAGES. 00046 00047 =========================================================================*/ 00073 #ifndef __vtkMINCImageReader_h 00074 #define __vtkMINCImageReader_h 00075 00076 #include "vtkIOMINCModule.h" // For export macro 00077 #include "vtkImageReader2.h" 00078 00079 class vtkStringArray; 00080 class vtkIdTypeArray; 00081 class vtkDoubleArray; 00082 class vtkMatrix4x4; 00083 00084 // A special class that holds the attributes 00085 class vtkMINCImageAttributes; 00086 00087 class VTKIOMINC_EXPORT vtkMINCImageReader : public vtkImageReader2 00088 { 00089 public: 00090 vtkTypeMacro(vtkMINCImageReader,vtkImageReader2); 00091 00092 static vtkMINCImageReader *New(); 00093 virtual void PrintSelf(ostream& os, vtkIndent indent); 00094 00096 virtual void SetFileName(const char *name); 00097 00099 00100 virtual const char* GetFileExtensions() { 00101 return ".mnc"; } 00103 00105 00106 virtual const char* GetDescriptiveName() { 00107 return "MINC"; } 00109 00111 virtual int CanReadFile(const char* name); 00112 00116 virtual vtkMatrix4x4 *GetDirectionCosines(); 00117 00119 00122 virtual double GetRescaleSlope(); 00123 virtual double GetRescaleIntercept(); 00125 00127 00130 vtkSetMacro(RescaleRealValues, int); 00131 vtkBooleanMacro(RescaleRealValues, int); 00132 vtkGetMacro(RescaleRealValues, int); 00134 00136 00140 virtual double *GetDataRange(); 00141 virtual void GetDataRange(double range[2]) { 00142 double *r = this->GetDataRange(); 00143 range[0] = r[0]; range[1] = r[1]; }; 00145 00147 virtual int GetNumberOfTimeSteps(); 00148 00150 00151 vtkSetMacro(TimeStep, int); 00152 vtkGetMacro(TimeStep, int); 00154 00157 virtual vtkMINCImageAttributes *GetImageAttributes(); 00158 00159 protected: 00160 vtkMINCImageReader(); 00161 ~vtkMINCImageReader(); 00162 00163 int MINCImageType; 00164 int MINCImageTypeSigned; 00165 00166 double ValidRange[2]; 00167 double ImageRange[2]; 00168 double DataRange[2]; 00169 00170 int NumberOfTimeSteps; 00171 int TimeStep; 00172 vtkMatrix4x4 *DirectionCosines; 00173 double RescaleSlope; 00174 double RescaleIntercept; 00175 int RescaleRealValues; 00176 vtkMINCImageAttributes *ImageAttributes; 00177 00178 int FileNameHasChanged; 00179 00180 virtual int OpenNetCDFFile(const char *filename, int& ncid); 00181 virtual int CloseNetCDFFile(int ncid); 00182 virtual int IndexFromDimensionName(const char *dimName); 00183 virtual int ReadMINCFileAttributes(); 00184 virtual void FindRangeAndRescaleValues(); 00185 static int ConvertMINCTypeToVTKType(int minctype, int mincsigned); 00186 00187 virtual void ExecuteInformation(); 00188 virtual void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo); 00189 00190 private: 00191 vtkMINCImageReader(const vtkMINCImageReader&); // Not implemented 00192 void operator=(const vtkMINCImageReader&); // Not implemented 00193 00194 }; 00195 00196 #endif