/*============================================================================= 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: 2008-06-21 09:20:09 +0200 (Sat, 21 Jun 2008) $ Revision: $Revision: 18 $ Portions of this code are covered under the ITK and VTK copyright. See http://www.itk.org/HTML/Copyright.htm for details. See http://www.kitware.com/VTKCopyright.htm for details. Copyright (c) 2008 Queensland University of Technology (QUT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =============================================================================*/ #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@ { /// ///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::itkNeighborhood, I@MANAGED_BASE_NAME@ { private: itk::itkNeighborhood^ m_Instance; public: ///Constructor. ///A string specifying which instance type to create. Eg. "UC2", "F3", etc. @NAMESPACE@@MANAGED_BASE_NAME@( System::String^ mangledType ) : itk::itkNeighborhood( ) { 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::itkNeighborhood( ) { 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 IntPtr NativePointer { virtual IntPtr get() override { return IntPtr(this->m_Instance->NativePointer); } virtual void set ( IntPtr 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(); } @MANAGED_PROPERTIES_WRAPPER@ @MANAGED_METHODS_WRAPPER@ private: ///Creates the correct type instance of the underlying native itk::Neighborhood. 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