1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
// CSharp wrapping definitions
#if SWIGCSHARP
%include "enumtypesafe.swg" // csharp/enums.swg can not parse the templated code in PixelIDValueEnum
%include "arrays_csharp.i"
%include "std_string.i"
%include "CSharpTypemapHelper.i"
// Enable CSharp classes derived from Command Execute method to be
// called from C++
%feature("director") itk::simple::Command;
%CSharpPointerTypemapHelper( itk::DataObject*, System.IntPtr )
%CSharpPointerTypemapHelper( itk::Object::Pointer, System.IntPtr )
%CSharpPointerTypemapHelper( itk::Optimizer::Pointer, System.IntPtr )
%CSharpPointerTypemapHelper( itk::SingleValuedCostFunction::Pointer, System.IntPtr )
%CSharpPointerTypemapHelper( itk::TransformBase::Pointer, System.IntPtr )
%CSharpTypemapHelper( int8_t*, System.IntPtr )
%CSharpTypemapHelper( uint8_t*, System.IntPtr )
%CSharpTypemapHelper( int16_t*, System.IntPtr )
%CSharpTypemapHelper( uint16_t*, System.IntPtr )
%CSharpTypemapHelper( int32_t*, System.IntPtr )
%CSharpTypemapHelper( uint32_t*, System.IntPtr )
%CSharpTypemapHelper( float*, System.IntPtr )
%CSharpTypemapHelper( double*, System.IntPtr )
// Add override to ToString method
%csmethodmodifiers ToString "public override";
// Handle PermuteAxes DefaultOrder
// TODO:
//%apply unsigned int INOUT[] {unsigned int DefaultOrder[3]}
// Extend Image class
%typemap(cscode) itk::simple::Image %{
#region Unary operators
///<summary>Unary negation operator calls SimpleITK.UnaryMinus.</summary>
public static Image operator -(Image img1) {
return SimpleITK.UnaryMinus(img1);
}
///<summary>Unary addition operator returns self.</summary>
public static Image operator +(Image img1) {
return img1;
}
///<summary>Logical negation operator calls SimpleITK.Not.</summary>
public static Image operator !(Image img1) {
return SimpleITK.Not(img1);
}
///<summary>Bitwise complement operator calls SimpleITK.BitwiseNot.</summary>
public static Image operator ~(Image img1) {
return SimpleITK.BitwiseNot(img1);
}
///<summary>True operator provided to keep compiler happy. Always returns true.</summary>
public static bool operator true(Image img1) {
return true;
}
///<summary>False operator provided to keep compiler happy. Always returns false.</summary>
public static bool operator false(Image img1) {
return false;
}
#endregion
#region Binary mathematical operators
///<summary>Binary addition operator calls SimpleITK.Add.</summary>
public static Image operator +(Image img1, Image img2) {
return SimpleITK.Add(img1, img2);
}
///<summary>Binary addition operator calls SimpleITK.Add.</summary>
public static Image operator +(Image img1, double constant) {
return SimpleITK.Add(img1, constant);
}
///<summary>Binary addition operator calls SimpleITK.Add.</summary>
public static Image operator +(double constant, Image img1) {
return SimpleITK.Add(constant, img1);
}
///<summary>Binary subtraction operator calls SimpleITK.Subtract.</summary>
public static Image operator -(Image img1, Image img2) {
return SimpleITK.Subtract(img1, img2);
}
///<summary>Binary subtraction operator calls SimpleITK.Subtract.</summary>
public static Image operator -(Image img1, double constant) {
return SimpleITK.Subtract(img1, constant);
}
///<summary>Binary subtraction operator calls SimpleITK.Subtract.</summary>
public static Image operator -(double constant, Image img1) {
return SimpleITK.Subtract(constant, img1);
}
///<summary>Binary multiply operator calls SimpleITK.Multiply.</summary>
public static Image operator *(Image img1, Image img2) {
return SimpleITK.Multiply(img1, img2);
}
///<summary>Binary multiply operator calls SimpleITK.Multiply.</summary>
public static Image operator *(Image img1, double constant) {
return SimpleITK.Multiply(img1, constant);
}
///<summary>Binary multiply operator calls SimpleITK.Multiply.</summary>
public static Image operator *(double constant, Image img1) {
return SimpleITK.Multiply(constant, img1);
}
///<summary>Binary division operator calls SimpleITK.Divide.</summary>
public static Image operator /(Image img1, Image img2) {
return SimpleITK.Divide(img1, img2);
}
///<summary>Binary division operator calls SimpleITK.Divide.</summary>
public static Image operator /(Image img1, double constant) {
return SimpleITK.Divide(img1, constant);
}
///<summary>Binary division operator calls SimpleITK.Divide.</summary>
public static Image operator /(double constant, Image img1) {
return SimpleITK.Divide(constant, img1);
}
#endregion
#region Binary bitwise operators
///<summary>Binary bitwise AND operator calls SimpleITK.And.</summary>
public static Image operator &(Image img1, Image img2) {
return SimpleITK.And(img1, img2);
}
///<summary>Binary bitwise AND operator calls SimpleITK.And.</summary>
public static Image operator &(Image img1, int constant) {
return SimpleITK.And(img1, constant);
}
///<summary>Binary bitwise AND operator calls SimpleITK.And.</summary>
public static Image operator &(int constant, Image img1) {
return SimpleITK.And(constant, img1);
}
///<summary>Binary bitwise OR operator calls SimpleITK.Or.</summary>
public static Image operator |(Image img1, Image img2) {
return SimpleITK.Or(img1, img2);
}
///<summary>Binary bitwise OR operator calls SimpleITK.Or.</summary>
public static Image operator |(Image img1, int constant) {
return SimpleITK.Or(img1, constant);
}
///<summary>Binary bitwise OR operator calls SimpleITK.Or.</summary>
public static Image operator |(int constant,Image img1) {
return SimpleITK.Or(constant, img1);
}
///<summary>Binary bitwise XOR operator calls SimpleITK.Xor.</summary>
public static Image operator ^(Image img1, Image img2) {
return SimpleITK.Xor(img1, img2);
}
///<summary>Binary bitwise XOR operator calls SimpleITK.Xor.</summary>
public static Image operator ^(Image img1, int constant) {
return SimpleITK.Xor(img1, constant);
}
///<summary>Binary bitwise XOR operator calls SimpleITK.Xor.</summary>
public static Image operator ^(int constant, Image img1) {
return SimpleITK.Xor(constant, img1);
}
#endregion
#region Comparison operators
///<summary>Less than operator calls SimpleITK.Less.</summary>
public static Image operator <(Image img1, Image img2) {
return SimpleITK.Less(img1, img2);
}
///<summary>Less than operator calls SimpleITK.Less.</summary>
public static Image operator <(Image img1, double constant) {
return SimpleITK.Less(img1, constant);
}
///<summary>Less than operator calls SimpleITK.Less.</summary>
public static Image operator <(double constant, Image img1) {
return SimpleITK.Less(constant, img1);
}
///<summary>Greater than operator calls SimpleITK.Greater.</summary>
public static Image operator >(Image img1, Image img2) {
return SimpleITK.Greater(img1, img2);
}
///<summary>Greater than operator calls SimpleITK.Greater.</summary>
public static Image operator >(Image img1, double constant) {
return SimpleITK.Greater(img1, constant);
}
///<summary>Greater than operator calls SimpleITK.Greater.</summary>
public static Image operator >(double constant, Image img1) {
return SimpleITK.Greater(constant, img1);
}
///<summary>Less than or equal to operator calls SimpleITK.LessEqual.</summary>
public static Image operator <=(Image img1, Image img2) {
return SimpleITK.LessEqual(img1, img2);
}
///<summary>Less than or equal to operator calls SimpleITK.LessEqual.</summary>
public static Image operator <=(Image img1, double constant) {
return SimpleITK.LessEqual(img1, constant);
}
///<summary>Less than or equal to operator calls SimpleITK.LessEqual.</summary>
public static Image operator <=(double constant,Image img1) {
return SimpleITK.LessEqual(constant, img1);
}
///<summary>Greater than or equal to operator calls SimpleITK.GreaterEqual.</summary>
public static Image operator >=(Image img1, Image img2) {
return SimpleITK.GreaterEqual(img1, img2);
}
///<summary>Greater than or equal to operator calls SimpleITK.GreaterEqual.</summary>
public static Image operator >=(Image img1, double constant) {
return SimpleITK.GreaterEqual(img1, constant);
}
///<summary>Greater than or equal to operator calls SimpleITK.GreaterEqual.</summary>
public static Image operator >=(double constant, Image img1) {
return SimpleITK.GreaterEqual(constant, img1);
}
#endregion
%}
#endif // End of C# specific sections
|