Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Imaging/vtkImageExport.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageExport.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00064 #ifndef __vtkImageExport_h
00065 #define __vtkImageExport_h
00066 
00067 #include "vtkProcessObject.h"
00068 #include "vtkImageData.h"
00069 
00070 class VTK_IMAGING_EXPORT vtkImageExport : public vtkProcessObject
00071 {
00072 public:
00073   static vtkImageExport *New();
00074   vtkTypeMacro(vtkImageExport,vtkProcessObject);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076   
00078   int GetDataMemorySize();
00079 
00081 
00083   void GetDataDimensions(int *ptr);
00084   int *GetDataDimensions() { 
00085     this->GetDataDimensions(this->DataDimensions);
00086     return this->DataDimensions; }
00088 
00090 
00093   int GetDataNumberOfScalarComponents() {
00094     if (this->GetInput() == NULL) { return 1; }
00095     this->GetInput()->UpdateInformation();
00096     return this->GetInput()->GetNumberOfScalarComponents(); };
00098 
00100 
00102   int GetDataScalarType() {
00103     if (this->GetInput() == NULL) { return VTK_UNSIGNED_CHAR; }
00104     this->GetInput()->UpdateInformation();
00105     return this->GetInput()->GetScalarType(); };
00106   const char *GetDataScalarTypeAsString() { 
00107     return vtkImageScalarTypeNameMacro(this->GetDataScalarType()); }
00109 
00111 
00112   int *GetDataExtent() {
00113     static int defaultextent[6] = {0, 0, 0, 0, 0, 0};
00114     if (this->GetInput() == NULL) { return defaultextent; }
00115     this->GetInput()->UpdateInformation();
00116     return this->GetInput()->GetWholeExtent(); };
00117   void GetDataExtent(int *ptr) {   
00118     if (this->GetInput() == NULL) { 
00119       ptr[0] = ptr[1] = ptr[2] = ptr[3] = ptr[4] = ptr[5] = 0; return; }
00120     this->GetInput()->UpdateInformation();
00121     this->GetInput()->GetWholeExtent(ptr); };
00122   float *GetDataSpacing() { 
00123     static float defaultspacing[3] = {1, 1, 1}; 
00124     if (this->GetInput() == NULL) { return defaultspacing; }
00125     this->GetInput()->UpdateInformation();
00126     return this->GetInput()->GetSpacing(); };
00127   void GetDataSpacing(float *ptr) { 
00128     if (this->GetInput() == NULL) { ptr[0] = ptr[1] = ptr[2] = 0.0; return; }
00129     this->GetInput()->UpdateInformation();
00130     this->GetInput()->GetSpacing(ptr); };
00131   float *GetDataOrigin() { 
00132     static float defaultorigin[3] = {0, 0, 0};
00133     if (this->GetInput() == NULL) { return defaultorigin; }
00134     this->GetInput()->UpdateInformation();
00135     return this->GetInput()->GetOrigin(); };
00136   void GetDataOrigin(float *ptr) { 
00137     if (this->GetInput() == NULL) { ptr[0] = ptr[1] = ptr[2] = 0.0; return; }
00138     this->GetInput()->UpdateInformation();
00139     this->GetInput()->GetOrigin(ptr); };
00141 
00143 
00144   void SetInput(vtkImageData *input);
00145   vtkImageData *GetInput();
00147 
00149 
00154   vtkBooleanMacro(ImageLowerLeft, int);
00155   vtkGetMacro(ImageLowerLeft, int);
00156   vtkSetMacro(ImageLowerLeft, int);
00158 
00160 
00163   void SetExportVoidPointer(void *);
00164   void *GetExportVoidPointer() { return this->ExportVoidPointer; };
00166 
00168 
00171   void Export() { this->Export(this->ExportVoidPointer); };
00172   virtual void Export(void *);
00174 
00179   void *GetPointerToData();
00180 
00182   void* GetCallbackUserData();
00183   
00184   //BTX
00186   /*! These are function pointer types for the pipeline connection
00187       callbacks.  See furhter documentation in vtkImageImport.h. */
00188   typedef void (*UpdateInformationCallbackType)(void*);
00189   typedef int (*PipelineModifiedCallbackType)(void*);
00190   typedef int* (*WholeExtentCallbackType)(void*);
00191   typedef float* (*SpacingCallbackType)(void*);
00192   typedef float* (*OriginCallbackType)(void*);
00193   typedef const char* (*ScalarTypeCallbackType)(void*); 
00194   typedef int (*NumberOfComponentsCallbackType)(void*);
00195   typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00196   typedef void (*UpdateDataCallbackType)(void*);
00197   typedef int* (*DataExtentCallbackType)(void*);
00198   typedef void* (*BufferPointerCallbackType)(void*);
00200   
00202 
00203   UpdateInformationCallbackType     GetUpdateInformationCallback() const;
00204   PipelineModifiedCallbackType      GetPipelineModifiedCallback() const;
00205   WholeExtentCallbackType           GetWholeExtentCallback() const;
00206   SpacingCallbackType               GetSpacingCallback() const;
00207   OriginCallbackType                GetOriginCallback() const;
00208   ScalarTypeCallbackType            GetScalarTypeCallback() const;
00209   NumberOfComponentsCallbackType    GetNumberOfComponentsCallback() const;
00210   PropagateUpdateExtentCallbackType GetPropagateUpdateExtentCallback() const;
00211   UpdateDataCallbackType            GetUpdateDataCallback() const;
00212   DataExtentCallbackType            GetDataExtentCallback() const;
00213   BufferPointerCallbackType         GetBufferPointerCallback() const;
00214   //ETX
00216 
00217 protected:
00218   vtkImageExport();
00219   ~vtkImageExport();
00220   
00221   virtual void UpdateInformationCallback();
00222   virtual int PipelineModifiedCallback();
00223   virtual void UpdateDataCallback();  
00224   virtual int* WholeExtentCallback();
00225   virtual float* SpacingCallback();
00226   virtual float* OriginCallback();
00227   virtual const char* ScalarTypeCallback();
00228   virtual int NumberOfComponentsCallback();
00229   virtual void PropagateUpdateExtentCallback(int*);
00230   virtual int* DataExtentCallback();
00231   virtual void* BufferPointerCallback();
00232 
00233   int ImageLowerLeft;
00234   int DataDimensions[3];
00235   void *ExportVoidPointer;
00236 
00237   unsigned long LastPipelineMTime;
00238 
00239 private:  
00240   vtkImageExport(const vtkImageExport&);  // Not implemented.
00241   void operator=(const vtkImageExport&);  // Not implemented.
00242 
00243   static void UpdateInformationCallbackFunction(void*);
00244   static int PipelineModifiedCallbackFunction(void*);
00245   static int* WholeExtentCallbackFunction(void*);
00246   static float* SpacingCallbackFunction(void*);
00247   static float* OriginCallbackFunction(void*);
00248   static const char* ScalarTypeCallbackFunction(void*); 
00249   static int NumberOfComponentsCallbackFunction(void*);
00250   static void PropagateUpdateExtentCallbackFunction(void*, int*);
00251   static void UpdateDataCallbackFunction(void*);
00252   static int* DataExtentCallbackFunction(void*);
00253   static void* BufferPointerCallbackFunction(void*);
00254 };
00255 
00256 #endif
00257 
00258 

Generated on Thu Mar 28 14:19:26 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001