/*============================================================================= NOTE: THIS FILE WAS AUTOMATICALLY GENERATED BY THE ManagedITK PROJECT. Project: ManagedITK Program: Insight Segmentation & Registration Toolkit Module: @NAMESPACE@Managed@MANAGED_BASE_NAME@.cxx Language: C++/CLI Author: Dan Mueller Date: $Date: 2007-09-01 06:17:25 +1000 (Sat, 01 Sep 2007) $ Revision: $Revision: 2 $ 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 __@NAMESPACE@Managed@MANAGED_BASE_NAME@_cxx #define __@NAMESPACE@Managed@MANAGED_BASE_NAME@_cxx // Use some managed namespaces #using #using #using using namespace System; using namespace System::IO; using namespace System::Reflection; using namespace System::ComponentModel; using namespace System::Diagnostics; namespace @NAMESPACE@ { @MANAGED_EXTRA_WRAPPER@ /// ///This class is a managed interface for itk::@MANAGED_BASE_NAME@. /// /// ///Both the wrapper and type classes derive from this interface. /// public interface class I@MANAGED_BASE_NAME@ { @MANAGED_PROPERTIES_INTERFACE@ @MANAGED_METHODS_INTERFACE@ }; /// ///This class is a managed wrapper for @NAMESPACE@::@MANAGED_BASE_NAME@. /// /// ///The actual type instance can be specified by calling the New() ///method with the desired output image type. /// public ref class @NAMESPACE@@MANAGED_BASE_NAME@ : itk::itkNeighborhoodOperator, I@MANAGED_BASE_NAME@ { private: itk::itkNeighborhoodOperator^ m_Instance; public: ///Constructor. ///A string specifying which instance type to create. Eg. "IUC2", "IF3", etc. @NAMESPACE@@MANAGED_BASE_NAME@( System::String^ mangledType ) : itk::itkNeighborhoodOperator( ) { this->m_MangledTypeString = mangledType; this->CreateInstance( nullptr ); } ///Constructor. ///The pixel type for which the neighborhood is defined. ///The number of dimensions for which the neighborhood is defined. @NAMESPACE@@MANAGED_BASE_NAME@( itk::itkPixelType^ pixelType, unsigned int dimension ) : itk::itkNeighborhoodOperator( ) { this->m_MangledTypeString = pixelType->MangledTypeString + dimension.ToString(); this->CreateInstance( nullptr ); } @MANAGED_CONSTRUCTORS_WRAPPER@ ///Dispose of the managed object. ~@NAMESPACE@@MANAGED_BASE_NAME@ ( ) { if (!this->IsDisposed) { this->m_IsDisposed = true; delete m_Instance; } } ///Finalize the managed object. !@NAMESPACE@@MANAGED_BASE_NAME@ ( ) { if (!this->IsDisposed) delete this; } /// ///Get/set the pointer to the native ITK object associated with ///this wrapper instance. /// ///The pointer to the native ITK object. property void* NativePointer { virtual void* get() override { return this->m_Instance->NativePointer; } virtual void set ( void* value ) override { this->m_Instance->NativePointer = value; } } ///Get the size (the total length of the sides) of the neighborhood. property itk::itkSize^ Size { virtual itk::itkSize^ get() override { return this->m_Instance->Size; } } ///Get/set the radius of the neighborhood. property itk::itkSize^ Radius { virtual itk::itkSize^ get() override { return this->m_Instance->Radius; } virtual void set(itk::itkSize^ value) override { this->m_Instance->Radius = value; } } ///Return a string representing the wrapped object. virtual String^ ToString ( ) override { return m_Instance->ToString( ); } ///Returns the radius of the neighborhood along a specified dimension. virtual unsigned long GetRadius(const unsigned long n) override { return this->m_Instance->GetRadius(n); } ///Returns the size (total length) of the neighborhood along a specified dimension. virtual unsigned long GetSize(const unsigned long n) override { return this->m_Instance->GetSize(n); } ///Returns the element at the center of the neighborhood. virtual itk::itkPixel^ GetCenterValue() override { return this->m_Instance->GetCenterValue(); } ///Returns the array index of the element at the given offset. virtual unsigned int GetNeighborhoodIndex(itk::itkOffset^ offset) override { return this->m_Instance->GetNeighborhoodIndex(offset); } ///Returns the array index of the center element. virtual unsigned int GetCenterNeighborhoodIndex() override { return this->m_Instance->GetCenterNeighborhoodIndex(); } ///Returns pixel value in the buffer at the given index. virtual itk::itkPixel^ GetElement(unsigned int i) override { return this->m_Instance->GetElement(i); } ///Allow index access to the buffer. virtual itk::itkPixel^ operator[] (unsigned int i) override { return this->m_Instance[i]; } ///Implement the IEnumerable interface. virtual System::Collections::IEnumerator^ GetEnumerator() override { return this->m_Instance->GetEnumerator(); } ///Get/set the dimensional direction (dimension number) of a directional operator. property unsigned long Direction { virtual unsigned long get() override { return this->m_Instance->Direction; } virtual void set(unsigned long value) override { this->m_Instance->Direction = value; } } /// ///Creates the operator with length only in the specified direction. ///The radius of the operator will be 0 except along the axis on which ///the operator will work. /// virtual void CreateDirectional() override { this->m_Instance->CreateDirectional(); } @MANAGED_PROPERTIES_WRAPPER@ @MANAGED_METHODS_WRAPPER@ private: ///Creates the correct type instance of the underlying native itk::NeighborhoodOperator. void CreateInstance( array^ args ) { this->m_IsDisposed = false; String^ nameInstanceType = "@NAMESPACE@.@NAMESPACE@@MANAGED_BASE_NAME@_" + this->MangledTypeString; try { Type^ typeInstance = Assembly::GetExecutingAssembly()->GetType(nameInstanceType); if (typeInstance == nullptr) throw gcnew NullReferenceException("The type '" + nameInstanceType + "' could not be found in " + Assembly::GetExecutingAssembly()->GetName() ); Object^ objInstance = Activator::CreateInstance(typeInstance, args); if (objInstance == nullptr) throw gcnew NullReferenceException("Could not invoke constructor for '" + nameInstanceType + "'."); this->m_Instance = safe_cast(objInstance); } catch (Exception^ ex) { throw gcnew itk::itkInvalidWrappedTypeException("Could not create an instance of '" + nameInstanceType + "'. The given type may not be supported or may be invalid.", ex); } } }; // end ref class } // end namespace @MANAGED_BASE_NAME@ #endif