00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkImageDataStreamer.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 00010 Redistribution and use in source and binary forms, with or without 00011 modification, are permitted provided that the following conditions are met: 00012 00013 * Redistributions of source code must retain the above copyright notice, 00014 this list of conditions and the following disclaimer. 00015 00016 * Redistributions in binary form must reproduce the above copyright notice, 00017 this list of conditions and the following disclaimer in the documentation 00018 and/or other materials provided with the distribution. 00019 00020 * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names 00021 of any contributors may be used to endorse or promote products derived 00022 from this software without specific prior written permission. 00023 00024 * Modified source versions must be plainly marked as such, and must not be 00025 misrepresented as being the original software. 00026 00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR 00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 00038 =========================================================================*/ 00053 #ifndef __vtkImageDataStreamer_h 00054 #define __vtkImageDataStreamer_h 00055 00056 #include "vtkImageToImageFilter.h" 00057 00058 // Don't change the numbers here - they are used in the code 00059 // to indicate array indices. 00060 #define VTK_IMAGE_DATA_STREAMER_X_SLAB_MODE 0 00061 #define VTK_IMAGE_DATA_STREAMER_Y_SLAB_MODE 1 00062 #define VTK_IMAGE_DATA_STREAMER_Z_SLAB_MODE 2 00063 #define VTK_IMAGE_DATA_STREAMER_BLOCK_MODE 3 00064 00065 //BTX 00066 // Define a helper class to keep track of a stack of extents 00067 class VTK_EXPORT vtkImageDataStreamerExtentStack 00068 { 00069 public: 00070 vtkImageDataStreamerExtentStack() 00071 { this->StackTop = NULL; 00072 this->StackStorageSize = 0; 00073 this->StackSize = 0; 00074 this->Stack = NULL; }; 00075 00076 ~vtkImageDataStreamerExtentStack() 00077 { if ( this->Stack ) { delete [] this->Stack; }; }; 00078 00079 void Push( int extent[6] ); 00080 void Pop( int extent[6] ); 00081 void PopAll(); 00082 00083 int GetStackSize() { return this->StackSize; }; 00084 00085 protected: 00086 int *Stack; 00087 int *StackTop; 00088 int StackSize; 00089 int StackStorageSize; 00090 }; 00091 //ETX 00092 00093 00094 class VTK_EXPORT vtkImageDataStreamer : public vtkImageToImageFilter 00095 { 00096 public: 00097 static vtkImageDataStreamer *New(); 00098 vtkTypeMacro(vtkImageDataStreamer,vtkImageToImageFilter); 00099 void PrintSelf(ostream& os, vtkIndent indent); 00100 00102 vtkSetMacro(MemoryLimit, unsigned long); 00103 vtkGetMacro(MemoryLimit, unsigned long); 00104 00109 void SetSplitModeToBlock() 00110 {this->SplitMode = VTK_IMAGE_DATA_STREAMER_BLOCK_MODE;} 00111 void SetSplitModeToXSlab() 00112 {this->SplitMode = VTK_IMAGE_DATA_STREAMER_X_SLAB_MODE;} 00113 void SetSplitModeToYSlab() 00114 {this->SplitMode = VTK_IMAGE_DATA_STREAMER_Y_SLAB_MODE;} 00115 void SetSplitModeToZSlab() 00116 {this->SplitMode = VTK_IMAGE_DATA_STREAMER_Z_SLAB_MODE;} 00117 00120 void UpdateInformation(); 00121 00123 void UpdateData( vtkDataObject *out ); 00124 00127 void TriggerAsynchronousUpdate(); 00128 00133 vtkSetClampMacro( IncrementalUpdate, int, 0, 1 ); 00134 vtkGetMacro( IncrementalUpdate, int ); 00135 vtkBooleanMacro( IncrementalUpdate, int ); 00136 00137 protected: 00138 vtkImageDataStreamer(); 00139 ~vtkImageDataStreamer() {}; 00140 vtkImageDataStreamer(const vtkImageDataStreamer&) {}; 00141 void operator=(const vtkImageDataStreamer&) {}; 00142 00143 unsigned long MemoryLimit; 00144 int SplitMode; 00145 int IncrementalUpdate; 00146 int ProcessExtent[6]; 00147 int DataWasPassed; 00148 00149 vtkImageDataStreamerExtentStack ExtentStack; 00150 }; 00151 00152 00153 00154 00155 #endif 00156 00157 00158