/*============================================================================= NOTE: THIS FILE IS A HANDMADE WRAPPER FOR THE ManagedITK PROJECT. Project: ManagedITK Program: Insight Segmentation & Registration Toolkit Module: itkManagedProcessObject.cxx Language: C++/CLI Author: Dan Mueller $Date: 2007-04-12 10:03:29 +1000 (Thu, 12 Apr 2007) $ $Revision: 133 $ Copyright (c) Queensland University of Technology (QUT) 2007. All rights reserved. Portions of this code are covered under the ITK and VTK copyright. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =============================================================================*/ #pragma once #pragma warning( disable : 4635 ) // Disable warnings about XML doc comments #ifndef __itkManagedProcessObject_cxx #define __itkManagedProcessObject_cxx // Include some useful ManagedITK files #include "itkManagedObject.cxx" // Use some managed namespaces #using #using using namespace System; using namespace System::IO; using namespace System::Reflection; using namespace System::Diagnostics; using namespace System::Collections::Generic; namespace itk { /** Forward reference to itkProcessObject */ ref class itkProcessObject; ///A delegate for events sent from an itkProcessObject, with a progress value between 0.0 and 1.0. public delegate void itkProgressHandler(itkProcessObject^ sender, float progress); /// ///This abstract class is a managed replacement for itk::ProcessObject. /// /// ///ProcessObject is an abstract object that specifies behavior and ///interface of network process objects (sources, filters, mappers). ///Source objects are creators of visualization data; filters input, ///process, and output image data; and mappers transform data into ///another form (like transforming coordinates or writing data to a file). /// ///A major role of ProcessObject is to define the inputs and outputs of ///a filter. More than one input and/or output may exist for a given filter. ///Some classes (e.g., source objects or mapper objects) will not use inputs ///(the source) or outputs (mappers). In this case, the inputs or outputs is ///just ignored. /// public ref class itkProcessObject abstract : itkObject { private: String^ m_Name; itkProgressHandler^ m_EventStorage_Progress; protected: ///Protected constructor. ///A string representing the name of the ProcessObject. itkProcessObject( String^ name ) : itkObject( ) { this->m_Name = name; } public: ///Get/set a string describing the process object. property String^ Name { virtual String^ get() { return this->m_Name; } } /// ///Get the size of the input array. This is merely the size of the input array, ///not the number of inputs that have valid DataObject's assigned. /// ///Use NumberOfValidRequiredInputs to determine how many inputs are non-null. property unsigned int NumberOfInputs { virtual unsigned int get()=0; } /// ///Get the number of valid inputs. This is the number of non-null entries in the ///input array in the first NumberOfRequiredInputs slots. This method is used ///to determine whether the necessary required inputs have been set. /// property unsigned int NumberOfValidRequiredInputs { virtual unsigned int get()=0; } ///Return the length of the output array. property unsigned int NumberOfOutputs { virtual unsigned int get()=0; } ///Get/set the number of threads to create when executing. property unsigned int NumberOfThreads { virtual unsigned int get()=0; virtual void set(unsigned int threads)=0; } ///An event which is raised when the progress of the process is updated. event itkProgressHandler^ Progress { public: void add (itkProgressHandler^ handler) { m_EventStorage_Progress += handler; } void remove (itkProgressHandler^ handler) { m_EventStorage_Progress -= handler; } internal: void raise( itkProcessObject^ obj, float progress ) { if (this->m_EventStorage_Progress != nullptr) this->m_EventStorage_Progress(obj, progress); } } /// ///Bring this filter up-to-date. /// /// ///Update() checks modified times against last execution times, and ///re-executes objects if necessary. A side effect of this method ///ss that the whole pipeline may execute in order to bring this filter ///up-to-date. This method updates the currently prescribed requested region. ///If no requested region has been set on the output, then the requested ///region will be set to the largest possible region. Once the requested ///region is set, Update() will make sure the specified requested region ///is up-to-date. To have a filter always to produce its largest possible ///region, users should call UpdateLargestPossibleRegion() instead. /// virtual void Update ( ) = 0; /// ///Bring the largest possible region of this filter up-to-date. /// /// ///Like Update(), but sets the output requested region to the ///largest possible region for the output. This is the method users ///should call if they want the entire dataset to be processed. If ///a user wants to update the same output region as a previous call ///to Update() or a previous call to UpdateLargestPossibleRegion(), ///then they should call the method Update(). /// virtual void UpdateLargestPossibleRegion ( ) = 0; /// ///Set the AbortGenerateData flag to true, and try to prematurely terminate the process. /// /// ///Process objects may handle premature termination of execution in different ways. ///Eg. many filters totally ignore this flag. /// virtual void AbortGenerateData ( ) = 0; ///Invoke the Progress event. virtual void InvokeProgressEvent ( float progress ) { this->Progress(this, progress); } }; // end ref class } // end namespace #endif