VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMINCImageWriter.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 =========================================================================*/ 00070 #ifndef __vtkMINCImageWriter_h 00071 #define __vtkMINCImageWriter_h 00072 00073 #include "vtkIOMINCModule.h" // For export macro 00074 #include "vtkImageWriter.h" 00075 00076 class vtkStringArray; 00077 class vtkIdTypeArray; 00078 class vtkDoubleArray; 00079 class vtkMatrix4x4; 00080 00081 // A special class that holds the attributes 00082 class vtkMINCImageAttributes; 00083 00084 class VTKIOMINC_EXPORT vtkMINCImageWriter : public vtkImageWriter 00085 { 00086 public: 00087 vtkTypeMacro(vtkMINCImageWriter,vtkImageWriter); 00088 00089 static vtkMINCImageWriter *New(); 00090 virtual void PrintSelf(ostream& os, vtkIndent indent); 00091 00093 00094 virtual const char* GetFileExtensions() { 00095 return ".mnc"; } 00097 00099 00100 virtual const char* GetDescriptiveName() { 00101 return "MINC"; } 00103 00105 virtual void SetFileName(const char *name); 00106 00110 virtual void Write(); 00111 00113 00121 virtual void SetDirectionCosines(vtkMatrix4x4 *matrix); 00122 vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4); 00124 00126 00129 vtkSetMacro(RescaleSlope, double); 00130 vtkGetMacro(RescaleSlope, double); 00131 vtkSetMacro(RescaleIntercept, double); 00132 vtkGetMacro(RescaleIntercept, double); 00134 00136 00138 virtual void SetImageAttributes(vtkMINCImageAttributes *attributes); 00139 virtual vtkMINCImageAttributes *GetImageAttributes() { 00140 return this->ImageAttributes; }; 00142 00144 00146 vtkSetMacro(StrictValidation, int); 00147 vtkBooleanMacro(StrictValidation, int); 00148 vtkGetMacro(StrictValidation, int); 00150 00152 00154 vtkSetStringMacro(HistoryAddition); 00155 vtkGetStringMacro(HistoryAddition); 00157 00158 protected: 00159 vtkMINCImageWriter(); 00160 ~vtkMINCImageWriter(); 00161 00162 int MINCImageType; 00163 int MINCImageTypeSigned; 00164 int MINCImageMinMaxDims; 00165 00166 vtkMatrix4x4 *DirectionCosines; 00167 double RescaleSlope; 00168 double RescaleIntercept; 00169 int StrictValidation; 00170 int DataUpdateExtent[6]; 00171 00172 int FileDataType; 00173 double FileValidRange[2]; 00174 double InternalRescaleSlope; 00175 double InternalRescaleIntercept; 00176 00177 int ComputeValidRangeFromScalarRange; 00178 00179 vtkStringArray *FileDimensionNames; 00180 00181 vtkMINCImageAttributes *ImageAttributes; 00182 00183 int Permutation[3]; 00184 int Flip[3]; 00185 00186 int MismatchedInputs; 00187 int MINCFileId; 00188 00189 char *HistoryAddition; 00190 00191 virtual int OpenNetCDFFile(const char *filename, int& ncid); 00192 virtual int CloseNetCDFFile(int ncid); 00193 00194 virtual int IndexFromDimensionName(const char *dimName); 00195 virtual void ComputePermutationFromOrientation(int permutation[3], 00196 int flip[3]); 00197 virtual int CreateMINCDimensions(vtkImageData *input, int timeStep, 00198 int *dimids); 00199 virtual int CreateMINCVariables(vtkImageData *input, int timeStep, 00200 int *dimids); 00201 virtual int WriteMINCFileAttributes(vtkImageData *input, int timeStep); 00202 virtual int WriteMINCData(vtkImageData *input, 00203 int frameNumber, 00204 int wholeExt[6], 00205 int upExt[6]); 00206 virtual void FindRescale(double &rescaleSlope, double &rescaleIntercept); 00207 virtual void FindMINCValidRange(double range[2]); 00208 00209 virtual int FillInputPortInformation(int port, vtkInformation *info); 00210 00211 virtual int RequestInformation(vtkInformation *request, 00212 vtkInformationVector **inputVector, 00213 vtkInformationVector *outputVector); 00214 00215 virtual int RequestUpdateExtent(vtkInformation *request, 00216 vtkInformationVector **inputVector, 00217 vtkInformationVector *outputVector); 00218 00219 virtual int RequestData(vtkInformation* request, 00220 vtkInformationVector** inputVector, 00221 vtkInformationVector* outputVector); 00222 00223 private: 00224 vtkMINCImageWriter(const vtkMINCImageWriter&); // Not implemented 00225 void operator=(const vtkMINCImageWriter&); // Not implemented 00226 00227 }; 00228 00229 #endif