├── Utilities ├── KWStyle │ ├── CMakeLists.txt │ ├── SITKOverwrite.txt │ ├── SITK.kws.xml.in │ └── SITKFiles.txt.in ├── lua-5.1.4 │ ├── src │ │ ├── lapi.h │ │ ├── linit.c │ │ ├── lstring.h │ │ ├── lundump.h │ │ ├── ldebug.h │ │ ├── ltm.h │ │ ├── lfunc.h │ │ ├── lualib.h │ │ ├── lvm.h │ │ ├── ltable.h │ │ └── lmem.h │ ├── README │ └── COPYRIGHT ├── CMakeLists.txt └── Doxygen │ ├── Doxygen.cmake │ └── GenerateExamplesDox.cmake ├── Wrapping ├── SimpleITKPythonMain.cxx ├── Lua.i ├── Tcl.i ├── R_Package │ ├── zzz.R │ └── DESCRIPTION ├── CSharp.i ├── CSharpModules │ ├── UseDotNetFrameworkSdk.cmake │ ├── UseMono.cmake │ └── FindMono.cmake ├── Java.i ├── FindR.cmake ├── CSharpTypemapHelper.i └── AssemblyInfo.cs.in ├── TemplateComponents ├── ClassEnd.h.in ├── ToStringReturn.cxx.in ├── ConstructorSignature.cxx.in ├── ToStringSignature.cxx.in ├── PrivateMemberDeclarations.h.in ├── ConstructorInitializeMembers.cxx.in ├── PublicDeclarations.h.in ├── ExecuteInternalUpdateAndReturn.cxx.in ├── ExecuteInternalSignature.cxx.in ├── ClassNameAndPrint.h.in ├── DoNotEditWarning.cxx.in ├── DoNotEditWarning.h.in ├── ExecuteMethodNoParameters.h.in ├── AddExtraIncludes.h.in ├── ConstructorMemberFunctionSetup.cxx.in ├── AddExtraIncludes.cxx.in ├── CustomMethods.h.in ├── MemberFunctionDispatch.h.in ├── ExecuteMethodWithParameters.h.in ├── ToStringBody.cxx.in ├── FunctionalAPI.h.in ├── StandardIncludes.cxx.in ├── FunctionalAPI.cxx.in ├── ClassDeclaration.h.in ├── ExecuteInternalTypedefs.cxx.in ├── ConstructorVectorPixels.cxx.in ├── ExecuteWithParameters.cxx.in ├── ExecuteInternalITKFilter.cxx.in ├── MemberGetSetDeclarations.h.in ├── ExecuteInternalSetITKFilterInputs.cxx.in ├── ExecuteInternalMethod.h.in ├── ExecuteInternalGetImagePointers.cxx.in └── ExecuteNoParameters.cxx.in ├── Testing ├── CMakeLists.txt └── Unit │ ├── CommonTests.cxx │ ├── ImageTest.py │ ├── LuaTests.cxx │ ├── TclTests.cxx │ ├── SimpleITKTestHarnessPaths.h.in │ ├── RubyTests.cxx │ ├── sitkExceptionsTests.cxx │ ├── GoogleTest │ └── COPYING │ ├── TypeListsTests.cxx │ ├── CXXTests.cxx │ ├── PythonImageFilterTestTemplate.py.in │ └── RegistrationTests.cxx ├── Documentation ├── CMakeLists.txt └── Tutorials │ ├── README │ ├── CMakeLists.txt │ ├── Short │ ├── CMakeLists.txt │ └── SimpleITKShortTutorial.tex │ └── Medium │ ├── CMakeLists.txt │ └── SimpleITKMediumTutorial.tex ├── .gitignore ├── Examples ├── SimpleGaussian.class ├── Segmentation │ └── CMakeLists.txt ├── SimpleGaussian.tcl ├── SimpleGaussian.rb ├── SimpleGaussian.py ├── MathematicalMorphology.py ├── SimpleGaussian.lua ├── SimpleGaussianFunctional.cxx ├── CMakeLists.txt ├── ImageConnection.java ├── SimpleGaussian.cs ├── SimpleGaussian.R ├── SimpleGaussian.java └── SimpleGaussian.cxx ├── Code ├── Common │ ├── Ancillary │ │ ├── hl_md5.h │ │ ├── hl_sha1.h │ │ ├── hl_md5.cxx │ │ └── hl_sha1.cxx │ ├── sitkConditional.h │ ├── CMakeLists.txt │ ├── SimpleITK.h │ ├── sitkEnableIf.h │ ├── sitkExceptionObject.h │ ├── sitkDetail.h │ └── sitkNonCopyable.h ├── CMakeLists.txt ├── BasicFilters │ ├── src │ │ ├── sitkCastImageFilter-2l.cxx │ │ ├── sitkCastImageFilter-3l.cxx │ │ ├── sitkImageFilter.cxx │ │ ├── sitkStaticMemberVariables.cxx │ │ ├── sitkCastImageFilter-3v.cxx │ │ ├── sitkCastImageFilter-2v.cxx │ │ ├── sitkCastImageFilter-2.cxx │ │ └── sitkCastImageFilter-3.cxx │ ├── json │ │ ├── Asin.json │ │ ├── Not.json │ │ ├── MaskNegated.json │ │ ├── Or.json │ │ ├── And.json │ │ ├── Atan2.json │ │ ├── Xor.json │ │ ├── Exp.json │ │ ├── Log.json │ │ ├── Sin.json │ │ ├── Tan.json │ │ ├── Acos.json │ │ ├── Atan.json │ │ ├── Log10.json │ │ ├── Sqrt.json │ │ ├── ExpNegative.json │ │ ├── Maximum.json │ │ ├── Minimum.json │ │ ├── Square.json │ │ ├── Divide.json │ │ ├── Multiply.json │ │ ├── InvertIntensity.json │ │ ├── BinaryThinning.json │ │ ├── Abs.json │ │ ├── Cos.json │ │ ├── HMaxima.json │ │ ├── LabelContour.json │ │ ├── BinaryMagnitude.json │ │ ├── LaplacianRecursiveGaussian.json │ │ ├── RescaleIntensity.json │ │ ├── SmoothingRecursiveGaussian.json │ │ ├── GradientMagnitudeRecursiveGaussian.json │ │ ├── VectorIndexSelectionCast.json │ │ ├── Mask.json │ │ ├── HConvex.json │ │ ├── HMinima.json │ │ ├── HConcave.json │ │ ├── OtsuThreshold.json │ │ ├── GrayscaleFillhole.json │ │ ├── GrayscaleGrindPeak.json │ │ ├── Add.json │ │ ├── Sigmoid.json │ │ ├── GrayscaleErode.json │ │ ├── MorphologicalGradient.json │ │ ├── Subtract.json │ │ ├── SquaredDifference.json │ │ ├── GrayscaleMorphologicalClosing.json │ │ ├── GrayscaleDilate.json │ │ ├── GrayscaleGeodesicErode.json │ │ ├── BlackTopHat.json │ │ ├── WhiteTopHat.json │ │ ├── BinaryMorphologicalClosing.json │ │ ├── BinaryFillhole.json │ │ ├── BinaryClosingByReconstruction.json │ │ ├── BinaryOpeningByReconstruction.json │ │ ├── BinaryMinMaxCurvatureFlow.json │ │ ├── MinMaxCurvatureFlow.json │ │ ├── ClosingByReconstruction.json │ │ ├── OpeningByReconstruction.json │ │ ├── BinaryMorphologicalOpening.json │ │ ├── RecursiveGaussian.json │ │ ├── BinaryThreshold.json │ │ ├── BinaryContour.json │ │ ├── BinaryGrindPeak.json │ │ ├── CurvatureFlow.json │ │ ├── IntensityWindowing.json │ │ ├── BinaryErode.json │ │ ├── Flip.json │ │ ├── ShapeDetectionLevelSet.json │ │ ├── GrayscaleGeodesicDilate.json │ │ ├── AddConstantTo.json │ │ ├── SubtractConstantFrom.json │ │ ├── DivideByConstant.json │ │ ├── MultiplyByConstant.json │ │ └── GeodesicActiveContourLevelSet.json │ ├── templates │ │ ├── sitkImageFilterTemplate.h.in │ │ ├── sitkDualImageFilterTemplate.h.in │ │ └── sitkImageFilterTemplate.cxx.in │ ├── include │ │ ├── sitkDualImageFilter.h │ │ ├── sitkImageFilter.h │ │ └── sitkStatisticsImageFilter.h │ └── CMakeLists.txt ├── Registration │ ├── sitkInterpolate.h │ ├── sitkOptimizer.h │ ├── sitkMetric.h │ ├── sitkAffineTransform.h │ ├── sitkTransform.h │ ├── sitkRegularStepGradientDescentOptimizer.h │ ├── sitkAffineTransform.cxx │ ├── sitkLinearInterpolate.h │ ├── sitkLinearInterpolate.cxx │ ├── sitkMattesMutualInformationMetric.h │ └── sitkMattesMutualInformationMetric.cxx └── IO │ ├── CMakeLists.txt │ ├── sitkImageReaderBase.h │ ├── sitkImageSeriesReader.h │ ├── sitkImageFileReader.h │ └── sitkImageFileWriter.h ├── .gitmodules ├── CMake ├── static_assert.cxx └── same_uint64_ulong.cxx ├── NOTICE ├── CTestConfig.cmake ├── sitkConfigure.h.in ├── CTestCustom.cmake.in ├── Readme.md ├── SimpleITKConfig.cmake.in ├── sitkGenerateSimpleITKConfig.cmake └── UseSimpleITK.cmake.in /Utilities/KWStyle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Wrapping/SimpleITKPythonMain.cxx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Utilities/KWStyle/SITKOverwrite.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TemplateComponents/ClassEnd.h.in: -------------------------------------------------------------------------------- 1 | }; 2 | -------------------------------------------------------------------------------- /Testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Unit) 2 | -------------------------------------------------------------------------------- /Documentation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Tutorials) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | *.o 4 | \#*\# 5 | *\# 6 | *~ 7 | -------------------------------------------------------------------------------- /TemplateComponents/ToStringReturn.cxx.in: -------------------------------------------------------------------------------- 1 | return out.str(); 2 | -------------------------------------------------------------------------------- /Wrapping/Lua.i: -------------------------------------------------------------------------------- 1 | // Lua specific swig components 2 | #if SWIGLUA 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /TemplateComponents/ConstructorSignature.cxx.in: -------------------------------------------------------------------------------- 1 | ${name}ImageFilter::${name}ImageFilter () 2 | -------------------------------------------------------------------------------- /TemplateComponents/ToStringSignature.cxx.in: -------------------------------------------------------------------------------- 1 | std::string ${name}ImageFilter::ToString() const 2 | -------------------------------------------------------------------------------- /Wrapping/Tcl.i: -------------------------------------------------------------------------------- 1 | 2 | #if SWIGTCL 3 | // Code to rebuild tclsh 4 | %include "tclsh.i" 5 | #endif 6 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimpleITK/Staging/master/Examples/SimpleGaussian.class -------------------------------------------------------------------------------- /Code/Common/Ancillary/hl_md5.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimpleITK/Staging/master/Code/Common/Ancillary/hl_md5.h -------------------------------------------------------------------------------- /Code/Common/Ancillary/hl_sha1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimpleITK/Staging/master/Code/Common/Ancillary/hl_sha1.h -------------------------------------------------------------------------------- /Wrapping/R_Package/zzz.R: -------------------------------------------------------------------------------- 1 | .First.lib <- function(lib,pkg) { 2 | library.dynam("libSimpleITK.so",pkg,lib) 3 | } 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Testing/Data"] 2 | path = Testing/Data 3 | url = git://github.com/SimpleITK/SimpleITKData.git 4 | -------------------------------------------------------------------------------- /Code/Common/Ancillary/hl_md5.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimpleITK/Staging/master/Code/Common/Ancillary/hl_md5.cxx -------------------------------------------------------------------------------- /Code/Common/Ancillary/hl_sha1.cxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimpleITK/Staging/master/Code/Common/Ancillary/hl_sha1.cxx -------------------------------------------------------------------------------- /Code/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Common) 2 | add_subdirectory(BasicFilters) 3 | 4 | # Always build last 5 | add_subdirectory(IO) 6 | -------------------------------------------------------------------------------- /TemplateComponents/PrivateMemberDeclarations.h.in: -------------------------------------------------------------------------------- 1 | $(foreach members 2 | /* ${doc} */ 3 | ${type} m_${name}; 4 | 5 | ) 6 | -------------------------------------------------------------------------------- /CMake/static_assert.cxx: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | static_assert( true, "this should compile with C++x0 static_assert keyword support"); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /TemplateComponents/ConstructorInitializeMembers.cxx.in: -------------------------------------------------------------------------------- 1 | $(foreach members 2 | $(if default then 3 | OUT = [[ 4 | this->m_${name} = ${default};]] end) 5 | ) 6 | -------------------------------------------------------------------------------- /TemplateComponents/PublicDeclarations.h.in: -------------------------------------------------------------------------------- 1 | $(if public_declarations then 2 | OUT=[[ 3 | /** Custom public declarations */ 4 | ${public_declarations} 5 | ]]end) 6 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalUpdateAndReturn.cxx.in: -------------------------------------------------------------------------------- 1 | // Run the ITK filter and return the output as a SimpleITK image 2 | filter->Update(); 3 | 4 | return Image( filter->GetOutput() ); 5 | -------------------------------------------------------------------------------- /Wrapping/CSharp.i: -------------------------------------------------------------------------------- 1 | 2 | // CSharp wrapping definitions 3 | 4 | #if SWIGCSHARP 5 | %CSharpPointerTypemapHelper( itk::simple::SimpleImageBase::Pointer, IntPtr ) 6 | #endif // End of C# specific sections 7 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalSignature.cxx.in: -------------------------------------------------------------------------------- 1 | template 2 | Image ${name}ImageFilter::ExecuteInternal ( const Image& inImage1 $(if number_of_inputs==2 then OUT=[[, const Image& inImage2]] end) ) 3 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | 2 | Insight Segmentation and Registration Toolkit 3 | Copyright 1999-2010 Insight Software Consortium 4 | 5 | This software is distributed under the 6 | Apache 2.0 License. 7 | 8 | See LICENSE file for details. 9 | -------------------------------------------------------------------------------- /TemplateComponents/ClassNameAndPrint.h.in: -------------------------------------------------------------------------------- 1 | /** Name of this class */ 2 | std::string GetName() const { return std::string ("${name}"); } 3 | 4 | /** Print ourselves out */ 5 | std::string ToString() const; 6 | -------------------------------------------------------------------------------- /TemplateComponents/DoNotEditWarning.cxx.in: -------------------------------------------------------------------------------- 1 | /* 2 | * WARNING: DO NOT EDIT THIS FILE! 3 | * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLEITK BUILD PROCESS. 4 | * Please look at sitkImageFilterTemplate.cxx.in to make changes. 5 | */ 6 | -------------------------------------------------------------------------------- /TemplateComponents/DoNotEditWarning.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * WARNING: DO NOT EDIT THIS FILE! 3 | * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLEITK BUILD PROCESS. 4 | * Please look at sitk${template_code_filename}Template.h.in to make changes. 5 | */ 6 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteMethodNoParameters.h.in: -------------------------------------------------------------------------------- 1 | /** Execute the filter on the input image$(if number_of_inputs == 2 then OUT=[[s]]end) */ 2 | Image Execute ( const Image &$(if number_of_inputs == 2 then OUT=[[, const Image &]] end) ); 3 | -------------------------------------------------------------------------------- /CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | set(CTEST_PROJECT_NAME "ITK") 2 | set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") 3 | 4 | set(CTEST_DROP_METHOD "http") 5 | set(CTEST_DROP_SITE "www.cdash.org") 6 | set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Insight") 7 | set(CTEST_DROP_SITE_CDASH TRUE) 8 | -------------------------------------------------------------------------------- /Documentation/Tutorials/README: -------------------------------------------------------------------------------- 1 | 2 | These documents are copyrighted by the 3 | 4 | Insight Software Consortium 5 | 6 | and are publicly distributed under the: 7 | 8 | Creative Commons by Attribution License 3.0 9 | http://creativecommons.org/licenses/by/3.0/ 10 | 11 | -------------------------------------------------------------------------------- /Documentation/Tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(LATEX) 2 | 3 | if(NOT PDFLATEX_COMPILER) 4 | message("pdflatex compiler was not found. Please pass to advanced mode and provide its full path" FATAL_ERROR) 5 | endif() 6 | 7 | add_subdirectory(Short) 8 | add_subdirectory(Medium) 9 | 10 | -------------------------------------------------------------------------------- /TemplateComponents/AddExtraIncludes.h.in: -------------------------------------------------------------------------------- 1 | $(if include_files and #include_files > 0 then 2 | OUT = [[// Additional include files 3 | $(for i=1,#include_files do OUT = OUT .. '#include "' .. include_files[i] .. '"' if i < #include_files then OUT = OUT .. '\n' end end) 4 | // Done with additional include files]] 5 | end) 6 | -------------------------------------------------------------------------------- /TemplateComponents/ConstructorMemberFunctionSetup.cxx.in: -------------------------------------------------------------------------------- 1 | this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); 2 | 3 | this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); 4 | this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); 5 | -------------------------------------------------------------------------------- /TemplateComponents/AddExtraIncludes.cxx.in: -------------------------------------------------------------------------------- 1 | $(if include_files and #include_files > 0 then 2 | OUT = [[// Additional include files 3 | $(for i=1,#include_files do OUT = OUT .. '#include "' .. include_files[i] .. '"' if i < #include_files then OUT = OUT .. '\n' end end) 4 | // Done with additional include files]] 5 | end) 6 | -------------------------------------------------------------------------------- /TemplateComponents/CustomMethods.h.in: -------------------------------------------------------------------------------- 1 | $(if custom_methods and #custom_methods > 0 then 2 | OUT = [[ 3 | 4 | 5 | $(foreach custom_methods 6 | /** ${doc} */ 7 | ${return_type} ${name}( $(foreach parameters ${type} ${var_name}$(if last == 0 then OUT=', ' end)) ) 8 | { 9 | ${body} 10 | }; 11 | )]]end) 12 | -------------------------------------------------------------------------------- /TemplateComponents/MemberFunctionDispatch.h.in: -------------------------------------------------------------------------------- 1 | friend struct detail::MemberFunctionAddressor; 2 | $(if vector_pixel_types_by_component then 3 | OUT=[[ friend struct detail::ExecuteInternalVectorImageAddressor;]] 4 | end) 5 | std::auto_ptr > m_MemberFactory; 6 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /CMake/same_uint64_ulong.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // This program compiles when unsignedlong and uint64_t are the same type 4 | 5 | template struct IsSame; 6 | template< typename T > 7 | struct IsSame { }; 8 | 9 | int main( void ) 10 | { 11 | IsSame FailsWhenNotSameTypes; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteMethodWithParameters.h.in: -------------------------------------------------------------------------------- 1 | $(if members and #members > 0 then 2 | OUT=[[ 3 | 4 | 5 | /** Execute the filter on the input image$(if number_of_inputs == 2 then OUT='s'end) with the given parameters */ 6 | Image Execute ( const Image &$(if number_of_inputs == 2 then OUT=', const Image &' end)$(foreach members , 7 | ${type} in${name}) );]]end) 8 | -------------------------------------------------------------------------------- /TemplateComponents/ToStringBody.cxx.in: -------------------------------------------------------------------------------- 1 | std::ostringstream out; 2 | out << "itk::simple::${name}ImageFilter\n"; 3 | $(foreach members 4 | $(if dim_vec and dim_vec == 1 then 5 | OUT = ' out << " ${name}: ";\ 6 | printStdVector(this->m_${name}, out);\ 7 | out << std::endl;' 8 | elseif (not no_print) or (not no_print == 1) then 9 | OUT = ' out << " ${name}: " << this->m_${name} << std::endl;' 10 | end) 11 | ) 12 | -------------------------------------------------------------------------------- /Utilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file ( GLOB LUA_SOURCE lua-5.1.4/src/*.c ) 2 | list ( REMOVE_ITEM LUA_SOURCE lua-5.1.4/src/luac.c ) 3 | add_executable ( lua ${LUA_SOURCE} ) 4 | 5 | file ( GLOB LUA_LIB_SOURCE lua-5.1.4/src/*.c ) 6 | list ( REMOVE_ITEM LUA_LIB_SOURCE lua-5.1.4/src/lua.c lua-5.1.4/src/luac.c ) 7 | add_library ( lua5 ${LUA_LIB_SOURCE} ) 8 | 9 | if ( UNIX ) 10 | target_link_libraries ( lua curses m ) 11 | endif() 12 | -------------------------------------------------------------------------------- /TemplateComponents/FunctionalAPI.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * itk::simple::${name}ImageFilter Functional Interface 3 | * 4 | * This function directly calls the execute method of ${name}ImageFilter 5 | * in order to support a fully functional API 6 | */ 7 | Image ${name} ( const Image& $(if number_of_inputs == 2 then OUT=', const Image&' end)$(when members $(foreach members , 8 | ${type} in${name} = ${default})) ); 9 | -------------------------------------------------------------------------------- /TemplateComponents/StandardIncludes.cxx.in: -------------------------------------------------------------------------------- 1 | #include "itkImage.h" 2 | #include "itkVectorImage.h" 3 | #include "itkLabelMap.h" 4 | #include "itkLabelObject.h" 5 | #include "itkNumericTraits.h" 6 | #include "itkNumericTraitsVariableLengthVectorPixel.h" 7 | #include "itkVectorIndexSelectionCastImageFilter.h" 8 | #include "itkImageToVectorImageFilter.h" 9 | 10 | 11 | #include "sitk${name}ImageFilter.h" 12 | #include "itk${name}ImageFilter.h" 13 | -------------------------------------------------------------------------------- /TemplateComponents/FunctionalAPI.cxx.in: -------------------------------------------------------------------------------- 1 | // 2 | // Function to run the Execute method of this filter 3 | // 4 | Image ${name} ( const Image& imageA$(if number_of_inputs == 2 then OUT=', const Image& imageB' end)$(when members $(foreach members , 5 | ${type} in${name})) ) 6 | { 7 | ${name}ImageFilter filter; 8 | return filter.Execute ( imageA$(if number_of_inputs == 2 then OUT=', imageB' end)$(when members $(foreach members , in${name})) ); 9 | } 10 | -------------------------------------------------------------------------------- /Wrapping/CSharpModules/UseDotNetFrameworkSdk.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # A CMake Module for using C# .NET. 3 | # 4 | # The following variables are set: 5 | # (none) 6 | # 7 | # This file is based on the work of GDCM: 8 | # http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/UseDotNETFrameworkSDK.cmake 9 | # Copyright (c) 2006-2010 Mathieu Malaterre 10 | # 11 | 12 | message( STATUS "Using .NET compiler version ${CSHARP_DOTNET_VERSION}" ) 13 | -------------------------------------------------------------------------------- /Wrapping/R_Package/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: SimpleITK 2 | Type: Package 3 | Title: Image processing classes from the Insight Toolkit (ITK) 4 | Version: 1.0 5 | Date: 2010-12-19 6 | Author: ITK Developers 7 | Maintainer: 8 | Description: This package expose to R the functionalities of the Insight Toolkit (ITK), that include image processing, image segmentation and image registration. 9 | License: Apache 2.0 10 | LazyLoad: yes 11 | Depends: methods 12 | -------------------------------------------------------------------------------- /Examples/Segmentation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories ( ${SimpleITK_INCLUDE_DIR} ) 3 | 4 | # Add executable example targets 5 | add_executable ( ConnectedThresholdImageFilter ConnectedThresholdImageFilter.cxx ) 6 | target_link_libraries ( ConnectedThresholdImageFilter ${SimpleITK_LIBRARIES} ) 7 | 8 | add_executable ( NeighborhoodConnectedImageFilter NeighborhoodConnectedImageFilter.cxx ) 9 | target_link_libraries ( NeighborhoodConnectedImageFilter ${SimpleITK_LIBRARIES} ) 10 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-2l.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory2l() 12 | { 13 | // basic to Label 14 | m_DualMemberFactory->RegisterMemberFunctions > (); 15 | } 16 | 17 | } // end namespace simple 18 | } // end namespace itk 19 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-3l.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory3l() 12 | { 13 | // basic to Label 14 | m_DualMemberFactory->RegisterMemberFunctions > (); 15 | } 16 | 17 | } // end namespace simple 18 | } // end namespace itk 19 | -------------------------------------------------------------------------------- /TemplateComponents/ClassDeclaration.h.in: -------------------------------------------------------------------------------- 1 | class ${name}ImageFilter : public $(if number_of_inputs == 2 then OUT=[[DualImageFilter]] else OUT=[[ImageFilter]] end) { 2 | public: 3 | typedef ${name}ImageFilter Self; 4 | 5 | /** Default Constructor that takes no arguments and initializes 6 | * default parameters */ 7 | ${name}ImageFilter(); 8 | 9 | /** Define the pixels types supported by this filter */ 10 | typedef ${pixel_types} PixelIDTypeList; 11 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalTypedefs.cxx.in: -------------------------------------------------------------------------------- 1 | // Define the input and output image types 2 | typedef TImageType InputImageType; 3 | $(if number_of_inputs == 2 then 4 | OUT=[[ 5 | typedef TImageType InputImageType2;]] 6 | end) 7 | $(if output_pixel_type then 8 | OUT=[[// Define output image type 9 | typedef itk::Image< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType;]] 10 | else 11 | OUT=[[typedef InputImageType OutputImageType;]] 12 | end) 13 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkImageFilter.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkImageFilter.h" 2 | 3 | namespace itk { 4 | namespace simple { 5 | 6 | //---------------------------------------------------------------------------- 7 | 8 | // 9 | // Default constructor that initializes parameters 10 | // 11 | ImageFilter::ImageFilter () 12 | { 13 | } 14 | 15 | // 16 | // Default destructor 17 | // 18 | ImageFilter::~ImageFilter () 19 | { 20 | } 21 | 22 | 23 | } // end namespace simple 24 | } // end namespace itk 25 | -------------------------------------------------------------------------------- /Wrapping/CSharpModules/UseMono.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # A CMake Module for using Mono. 3 | # 4 | # The following variables are set: 5 | # TODO 6 | # 7 | # Additional references can be found here: 8 | # http://www.mono-project.com/Main_Page 9 | # http://www.mono-project.com/CSharp_Compiler 10 | # 11 | # This file is based on the work of GDCM: 12 | # http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindMono.cmake 13 | # Copyright (c) 2006-2010 Mathieu Malaterre 14 | # 15 | 16 | # TODO -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkStaticMemberVariables.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkPermuteAxesImageFilter.h" 2 | 3 | // This file is intended to contain the definition of static 4 | // membervariables needed by JSON Expand templated image filters. 5 | // It may also contain other member declarations, or other useful 6 | // items that could be specified here, as opposed to the JSON. 7 | 8 | namespace itk { 9 | namespace simple { 10 | 11 | const unsigned int PermuteAxesImageFilter::DefaultOrder[3] = {0,1,2}; 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TemplateComponents/ConstructorVectorPixels.cxx.in: -------------------------------------------------------------------------------- 1 | $(if vector_pixel_types_by_component then 2 | OUT=[[ typedef ${vector_pixel_types_by_component} VectorByComponentsPixelIDTypeList; 3 | typedef detail::ExecuteInternalVectorImageAddressor VectorAddressorType; 4 | this->m_MemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, 3, VectorAddressorType> (); 5 | this->m_MemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, 2, VectorAddressorType> ();]] 6 | end) 7 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteWithParameters.cxx.in: -------------------------------------------------------------------------------- 1 | $(if members and #members > 0 then 2 | OUT = [[ 3 | 4 | Image ${name}ImageFilter::Execute ( const Image & image1$(if number_of_inputs==2 then OUT=', const Image& image2' end)$(foreach members , 5 | ${type} in${name}) ) 6 | { 7 | $(foreach members 8 | $(if (not no_set_method) or (no_set_method == 0) then 9 | OUT = ' this->Set${name} ( in${name} );' 10 | end) 11 | ) 12 | return this->Execute ( image1 $(if number_of_inputs==2 then OUT=', image2' end) ); 13 | } 14 | ]] 15 | end) 16 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Asin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Asin", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 14 | "settings" : [], 15 | "tolerance" : 0.01 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Testing/Unit/CommonTests.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | TEST( ConditionalTest, ConditionalTest1 ) { 7 | 8 | // a quick check to make sure the conditional works 9 | typedef itk::simple::Conditional::Type IntType; 10 | typedef itk::simple::Conditional::Type FloatType; 11 | 12 | 13 | EXPECT_EQ ( typeid( IntType ).name(), typeid( int ).name() ); 14 | EXPECT_EQ ( typeid( FloatType ).name(), typeid( float ).name() ); 15 | 16 | return; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Not.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Not", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/STAPLE1.png", 14 | "settings" : [], 15 | "md5hash" : "2004dccdb2d68b953fd858a5b6a37d35" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/MaskNegated.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "MaskNegated", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "2d", 12 | "description" : "2d", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "164809eb3ac508dd12c91c82ad8ee20c" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Or.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Or", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "5cd4b5af0cdc5935e8ee76a9b5e39669" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalITKFilter.cxx.in: -------------------------------------------------------------------------------- 1 | $(if filter_type then 2 | OUT=[[typedef ${filter_type} FilterType;]] 3 | else 4 | OUT=[[typedef itk::${name}ImageFilter FilterType;]] 12 | end) 13 | // Set up the ITK filter 14 | typename FilterType::Pointer filter = FilterType::New(); 15 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/And.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "And", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "a216e4eac5235a2c9e4fd473bd9b3947" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Atan2.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Atan2", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 14 | "inputB" : "Input/Ramp-One-Zero-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Xor.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Xor", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "f6b04487e9d8d12d737802e1a8e78c0b" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Exp.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Exp", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Log.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Log", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Sin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sin", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Tan.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Tan", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Acos.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Acos", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Atan.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Atan", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Log10.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Log10", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Sqrt.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sqrt", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Utilities/KWStyle/SITK.kws.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 200 4 | [A-Z] 5 | m_[A-Z] 6 | 0 7 | 1 8 | 1 9 | 3 10 | /**, *, */,true 11 | itk 12 | [NameOfClass],itk 13 | __[NameOfClass]_[Extension] 14 | 2 15 | 16 | 1,1 17 | 18 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/ExpNegative.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "ExpNegative", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "tolerance" : 0.01 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Maximum.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Maximum", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 14 | "inputB" : "Input/Ramp-One-Zero-Float.nrrd", 15 | "settings" : [], 16 | "md5hash" : "00c5a06c3a1b3be415732bd5073450ef" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Minimum.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Minimum", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 14 | "inputB" : "Input/Ramp-One-Zero-Float.nrrd", 15 | "settings" : [], 16 | "md5hash" : "35088a16227bda50ff5c93baa2199a17" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.tcl: -------------------------------------------------------------------------------- 1 | 2 | if { $argc < 3 } { 3 | puts "Usage: SimpleGaussian " 4 | exit 1 5 | } 6 | 7 | ImageFileReader reader 8 | reader SetFileName [ lindex $argv 0 ] 9 | set image [ reader Execute ] 10 | 11 | set pixelID [ $image GetPixelIDValue ] 12 | 13 | SmoothingRecursiveGaussianImageFilter gaussian 14 | gaussian SetSigma [ lindex $argv 1 ] 15 | set image [ gaussian Execute $image ] 16 | 17 | CastImageFilter caster 18 | caster SetOutputPixelType $pixelID 19 | set image [ caster Execute $image ] 20 | 21 | ImageFileWriter writer 22 | writer SetFileName [ lindex $argv 2] 23 | writer Execute $image 24 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Square.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Square", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "defaults", 13 | "description" : "Simply run with default settings", 14 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 15 | "settings" : [], 16 | "md5hash" : "314065b457b66e102b9cafd7c49be6b3" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/Registration/sitkInterpolate.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkInterpolate_h 2 | #define __sitkInterpolate_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "sitkImage.h" 7 | #include "itkObject.h" 8 | #include "sitkMemberFunctionFactory.h" 9 | 10 | namespace itk 11 | { 12 | namespace simple 13 | { 14 | class Registration; 15 | class Interpolate 16 | { 17 | public: 18 | Interpolate(){}; 19 | virtual ~Interpolate(){}; 20 | virtual ::itk::Object::Pointer GetInterpolator ( const Image &image ) = 0; 21 | protected: 22 | friend class Registration; 23 | virtual Interpolate* Clone() = 0; 24 | }; 25 | } 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Divide.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Divide", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "typelist::Append::Type", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Up-Short.nrrd", 14 | "inputB" : "Input/Ramp-Down-Short.nrrd", 15 | "settings" : [], 16 | "md5hash" : "af2d18b65fdfa4f9cb1e84c777b4a72b" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-3v.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory3v() 12 | { 13 | 14 | // cast between vector images 15 | m_DualMemberFactory->RegisterMemberFunctions > (); 16 | 17 | // basic to vector 18 | m_DualMemberFactory->RegisterMemberFunctions > (); 19 | } 20 | 21 | } // end namespace simple 22 | } // end namespace itk 23 | -------------------------------------------------------------------------------- /Code/Registration/sitkOptimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkOptimizer_h 2 | #define __sitkOptimizer_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "sitkImage.h" 7 | #include "itkOptimizer.h" 8 | #include "sitkMemberFunctionFactory.h" 9 | 10 | namespace itk 11 | { 12 | namespace simple 13 | { 14 | class Registration; 15 | class Optimizer 16 | { 17 | public: 18 | Optimizer() {}; 19 | virtual ~Optimizer() {}; 20 | virtual ::itk::Optimizer::Pointer GetOptimizer() { return NULL; } 21 | protected: 22 | friend class Registration; 23 | virtual Optimizer* Clone() { return new Optimizer ( *this ); } 24 | }; 25 | } 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-2v.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory2v() 12 | { 13 | 14 | // cast between vector images 15 | m_DualMemberFactory->RegisterMemberFunctions > (); 16 | 17 | // basic to vector 18 | m_DualMemberFactory->RegisterMemberFunctions > (); 19 | 20 | } 21 | 22 | } // end namespace simple 23 | } // end namespace itk 24 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Multiply.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Multiply", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "typelist::Append::Type", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "defaults", 12 | "description" : "Simply run with default settings", 13 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 14 | "inputB" : "Input/Ramp-One-Zero-Float.nrrd", 15 | "settings" : [], 16 | "md5hash" : "1f733047e37adf9589c695500820110b" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/InvertIntensity.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "InvertIntensity", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "Maximum", 10 | "type" : "double", 11 | "default" : 255.0, 12 | "doc" : "Maximum output" 13 | } 14 | ], 15 | "tests" : [ 16 | { 17 | "tag" : "3d", 18 | "description" : "3D", 19 | "inputA" : "Input/RA-Short.nrrd", 20 | "settings" : [], 21 | "md5hash" : "76765a57f26a7979f33efc8ed9801a55" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /Code/Registration/sitkMetric.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkMetric_h 2 | #define __sitkMetric_h 3 | 4 | #include "sitkMacro.h" 5 | 6 | #include "sitkDetail.h" 7 | #include "sitkImage.h" 8 | #include "sitkPixelIDTokens.h" 9 | #include "itkImageToImageMetric.h" 10 | #include "sitkMemberFunctionFactory.h" 11 | 12 | namespace itk 13 | { 14 | namespace simple 15 | { 16 | class Registration; 17 | class Metric 18 | { 19 | public: 20 | Metric() {}; 21 | virtual ~Metric() {}; 22 | virtual ::itk::SingleValuedCostFunction::Pointer GetMetric ( const Image & image ) = 0; 23 | protected: 24 | friend class Registration; 25 | virtual Metric* Clone() = 0; 26 | }; 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryThinning.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryThinning", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "\\todo this filter may not work in 3D\n \\note the output of this filter is still the same as the input type eventhought the output is 0 or 1.", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "members" : [], 9 | "custom_methods" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "BinaryThinning", 13 | "description" : "Test binnary thinning", 14 | "inputA" : "Input/BlackDots.png", 15 | "md5hash" : "153ad0b2f3658dee3b14ad93d0cfe550" 16 | "settings" : [] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.rb: -------------------------------------------------------------------------------- 1 | require 'simpleitk' 2 | 3 | if ARGV.length != 3 then 4 | puts "Usage: SimpleGaussian "; 5 | exit( 1 ) 6 | end 7 | 8 | reader = Simpleitk::ImageFileReader.new 9 | reader.set_file_name( ARGV[0] ) 10 | image = reader.execute 11 | 12 | inputPixelType = image.get_pixel_idvalue 13 | 14 | gaussian = Simpleitk::SmoothingRecursiveGaussianImageFilter.new 15 | gaussian.set_sigma ARGV[1].to_f 16 | image = gaussian.execute image; 17 | 18 | caster = Simpleitk::CastImageFilter.new 19 | caster.set_output_pixel_type inputPixelType 20 | image = caster.execute image 21 | 22 | writer = Simpleitk::ImageFileWriter.new 23 | writer.set_file_name ARGV[2] 24 | writer.execute image 25 | 26 | -------------------------------------------------------------------------------- /TemplateComponents/MemberGetSetDeclarations.h.in: -------------------------------------------------------------------------------- 1 | $(foreach members 2 | $(if (not no_set_method) or (no_set_method == 0) then 3 | OUT = '\ 4 | /** Set ${name} */\ 5 | Self& Set${name} ( ${type} t ) { this->m_${name} = t; return *this; }' 6 | if type == "bool" then 7 | OUT = OUT .. '\ 8 | \ 9 | /** Set the value of ${name} to true or false respectfully. */\ 10 | Self& ${name}On() { return this->Set${name}(true); }\ 11 | Self& ${name}Off() { return this->Set${name}(false); }' 12 | end 13 | end) 14 | $(if (not no_get_method) or (no_get_method == 0) then 15 | OUT = '\ 16 | /** Get ${name} */\ 17 | ${type} Get${name}() { return this->m_${name}; }' 18 | end) 19 | ) 20 | -------------------------------------------------------------------------------- /sitkConfigure.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __sitkConfigure_h 2 | #define __sitkConfigure_h 3 | 4 | // defined if the system has C++0x "static_assert" keyword 5 | #cmakedefine SITK_SUPPORTS_STATIC_ASSERT 6 | 7 | #cmakedefine SITK_EXPRESS_INSTANTIATEDPIXELS 8 | 9 | 10 | // defined if the system has header 11 | #cmakedefine SITK_HAS_STLTR1_TR1_FUNCTIONAL 12 | 13 | // defined if the system has header 14 | #cmakedefine SITK_HAS_STLTR1_FUNCTIONAL 15 | 16 | 17 | // defined if the system has header 18 | #cmakedefine SITK_HAS_STLTR1_TR1_TYPE_TRAITS 19 | 20 | // defined if the system has header 21 | #cmakedefine SITK_HAS_STLTR1_TYPE_TRAITS 22 | 23 | #endif // __sitkConfigure_h 24 | -------------------------------------------------------------------------------- /Code/Registration/sitkAffineTransform.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkAffineTransform_h 2 | #define __sitkAffineTransform_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "sitkTransform.h" 7 | #include "itkAffineTransform.h" 8 | 9 | namespace itk 10 | { 11 | namespace simple 12 | { 13 | class AffineTransform : public Transform 14 | { 15 | public: 16 | AffineTransform(); 17 | virtual ::itk::TransformBase::Pointer GetTransform ( int dimension ); 18 | virtual std::vector GetOptimizerScales ( int dimension ); 19 | protected: 20 | virtual Transform* Clone() { std::cout << "Cloned an AffineTransform" << std::endl; return new AffineTransform ( *this ); } 21 | }; 22 | } 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalSetITKFilterInputs.cxx.in: -------------------------------------------------------------------------------- 1 | $(if number_of_inputs == 2 then 2 | OUT=[[ 3 | filter->SetInput( 0, image1 ); 4 | filter->SetInput( 1, image2 ); 5 | ]] 6 | else 7 | OUT=[[ 8 | filter->SetInput( image1 ); 9 | ]] 10 | end)$(foreach members 11 | $(if custom_itk_cast then 12 | OUT = ' ${custom_itk_cast}' 13 | elseif dim_vec and dim_vec == 1 then 14 | OUT = [[ ${itk_type} itkVec${name}; 15 | for (unsigned int i = 0; i < inImage1.GetDimension(); ++i) 16 | { 17 | itkVec${name}[i] = this->Get${name}()[i]; 18 | } 19 | filter->Set${name}( itkVec${name} );]] 20 | elseif(not no_set_method) or (no_set_method == 0) then 21 | OUT = ' filter->Set${name} ( this->m_${name} );' 22 | end) 23 | ) 24 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Abs.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Abs", 3 | "template_code_filename" : "ImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "Compute the voxel-wise absolute value of an image", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "float", 12 | "description" : "Abs of a float image", 13 | "inputA" : "Input/RA-Slice-Float.nrrd", 14 | "tolerance" : 0.01 15 | }, 16 | { 17 | "tag" : "short", 18 | "description" : "Abs of a short image", 19 | "inputA" : "Input/RA-Slice-Short.nrrd", 20 | "tolerance" : 0.01 21 | } 22 | ] 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.py: -------------------------------------------------------------------------------- 1 | 2 | import SimpleITK as sitk 3 | import sys 4 | 5 | if len ( sys.argv ) < 4: 6 | print "Usage: SimpleGaussian "; 7 | sys.exit ( 1 ) 8 | 9 | 10 | reader = sitk.ImageFileReader() 11 | reader.SetFileName ( sys.argv[1] ) 12 | image = reader.Execute() 13 | 14 | pixelID = image.GetPixelIDValue() 15 | 16 | gaussian = sitk.SmoothingRecursiveGaussianImageFilter() 17 | gaussian.SetSigma ( float ( sys.argv[2] ) ) 18 | image = gaussian.Execute ( image ) 19 | 20 | caster = sitk.CastImageFilter() 21 | caster.SetOutputPixelType( pixelID ) 22 | image = caster.Execute( image ) 23 | 24 | writer = sitk.ImageFileWriter() 25 | writer.SetFileName ( sys.argv[3] ) 26 | writer.Execute ( image ); 27 | -------------------------------------------------------------------------------- /Code/IO/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file ( GLOB SimpleITKIOSource *.cxx *.h ) 2 | 3 | include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ) 4 | add_library ( SimpleITKIO ${SimpleITKIOSource} ) 5 | target_link_libraries ( SimpleITKIO SimpleITKCommon ${ITK_LIBRARIES} ) 6 | 7 | 8 | 9 | # Add custom command that will delete java files which need to be rebuilt when changes 10 | # are made to IO 11 | if( WRAP_JAVA ) 12 | add_custom_command( 13 | TARGET SimpleITKIO 14 | POST_BUILD 15 | COMMENT "Cleaning java build..." 16 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/org/itk/simple/*.java 17 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/build/org/itk/simple/*.class 18 | ) 19 | endif() 20 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Cos.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Cos", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "vector_pixel_types_by_component" : "VectorPixelIDTypeList", 9 | "members" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "float", 13 | "description" : "Cosine of an image", 14 | "inputA" : "Input/RA-Slice-Float.nrrd", 15 | "tolerance" : 0.01 16 | }, 17 | { 18 | "tag" : "short", 19 | "description" : "Cosine of an image", 20 | "inputA" : "Input/RA-Slice-Short.nrrd", 21 | "tolerance" : 0.01 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /Wrapping/CSharpModules/FindMono.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # A CMake Module for finding Mono. 3 | # 4 | # The following variables are set: 5 | # CSHARP_MONO_FOUND 6 | # CSHARP_MONO_COMPILER_${version} eg. "CSHARP_MONO_COMPILER_v1.1" 7 | # CSHARP_MONO_INTERPRETOR_${version} eg. "CSHARP_MONO_INTERPRETOR_v1.1" 8 | # CSHARP_MONO_VERSION eg. "v4.0.30319" 9 | # CSHARP_MONO_VERSIONS eg. "v3.5, v4.0.30319" 10 | # 11 | # Additional references can be found here: 12 | # http://www.mono-project.com/Main_Page 13 | # http://www.mono-project.com/CSharp_Compiler 14 | # 15 | # This file is based on the work of GDCM: 16 | # http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindMono.cmake 17 | # Copyright (c) 2006-2010 Mathieu Malaterre 18 | # 19 | 20 | # TODO -------------------------------------------------------------------------------- /Examples/MathematicalMorphology.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import SimpleITK 4 | import sys 5 | 6 | if len ( sys.argv ) < 4: 7 | print "Usage: MathematicalMorphology "; 8 | print "operation: 0=binary erode, 1=binary dilate, 2=grayscale erode, 3=grayscale dilate"; 9 | sys.exit ( 1 ) 10 | 11 | reader = SimpleITK.ImageFileReader() 12 | reader.SetFileName ( sys.argv[1] ) 13 | image = reader.Execute(); 14 | 15 | print image.ToString() 16 | 17 | morphoMath = SimpleITK.MathematicalMorphologyImageFilter() 18 | morphoMath.SetOperation ( int ( sys.argv[2] ) ) 19 | image = morphoMath.Execute ( image ); 20 | 21 | print image.ToString() 22 | 23 | writer = SimpleITK.ImageFileWriter() 24 | writer.SetFileName ( sys.argv[3] ) 25 | writer.Execute ( image ); 26 | 27 | -------------------------------------------------------------------------------- /Code/Registration/sitkTransform.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkTransform_h 2 | #define __sitkTransform_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "itkTransform.h" 7 | 8 | namespace itk 9 | { 10 | namespace simple 11 | { 12 | class Registration; 13 | class Transform 14 | { 15 | public: 16 | Transform() {}; 17 | virtual ~Transform() {}; 18 | virtual ::itk::TransformBase::Pointer GetTransform ( int dimension ) { return NULL; }; 19 | virtual std::vector GetOptimizerScales ( int dimension ) { return std::vector(); }; 20 | protected: 21 | friend class Registration; 22 | virtual Transform* Clone() { std::cout << "Cloned generic Transform" << std::endl; return new Transform ( *this ); } 23 | }; 24 | } 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/HMaxima.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "HMaxima", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { 10 | "name" : "Height", 11 | "type" : "double", 12 | "default" : "2.0", 13 | "doc" : "" 14 | } 15 | ], 16 | "custom_methods" : [], 17 | "tests" : [ 18 | { 19 | "tag" : "HMaxima", 20 | "description" : "Test HMaxima", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "md5hash" : "b30d403fb1c5948abfb17fa9c346cecd", 23 | "settings" : [ 24 | { 25 | "parameter" : "Height", 26 | "value" : 2000 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/LabelContour.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "LabelContour", 3 | "template_code_filename" : "ImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "FullyConnected", 10 | "type" : "bool", 11 | "default" : "false", 12 | "doc" : "" 13 | }, 14 | { 15 | "name" : "BackgroundValue", 16 | "type" : "double", 17 | "default" : "0", 18 | "doc" : "" 19 | } 20 | ], 21 | "tests" : [ 22 | { 23 | "tags" : "default", 24 | "description" : "Simply run with default settings", 25 | "inputA" : "Input/2th_cthead1.png", 26 | "md5hash" : "d742c05a8d8aa9b41f58b8d2aad6b5d0", 27 | "settings" : [ ] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /Documentation/Tutorials/Short/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(SimpleITKShortTutorial) 2 | 3 | # 4 | # This adds a custom target that generates the output document 5 | # This target depends on the list of copied files created 6 | # with the custom command above and the Plots target. 7 | # 8 | add_custom_target(ShortTutorial ALL 9 | COMMAND ${PDFLATEX_COMPILER} 10 | ${SimpleITKShortTutorial_SOURCE_DIR}/SimpleITKShortTutorial.tex 11 | -output-directory ${SimpleITKShortTutorial_BINARY_DIR} 12 | COMMAND ${PDFLATEX_COMPILER} 13 | ${SimpleITKShortTutorial_SOURCE_DIR}/SimpleITKShortTutorial.tex 14 | -output-directory ${SimpleITKShortTutorial_BINARY_DIR} 15 | DEPENDS ${COPY_RESULTS} ${REPORT_ELEMENTS} 16 | WORKING_DIRECTORY ${SimpleITKShortTutorial_BINARY_DIR} 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | if #arg < 3 then 4 | print ( "Usage: SimpleGaussian " ) 5 | os.exit ( 1 ) 6 | end 7 | 8 | reader = SimpleITK.ImageFileReader() 9 | -- Remember that Lua arrays are 1-based, and that arg does not contain the application name! 10 | reader:SetFileName ( arg[1] ) 11 | image = reader:Execute(); 12 | 13 | inputPixelType = image:GetPixelIDValue() 14 | 15 | gaussian = SimpleITK.SmoothingRecursiveGaussianImageFilter() 16 | gaussian:SetSigma ( arg[2] ) 17 | image = gaussian:Execute ( image ); 18 | 19 | caster = SimpleITK.CastImageFilter(); 20 | caster:SetOutputPixelType( inputPixelType ); 21 | image = caster:Execute( image ) 22 | 23 | writer = SimpleITK.ImageFileWriter() 24 | writer:SetFileName ( arg[3] ) 25 | writer:Execute ( image ); 26 | 27 | -------------------------------------------------------------------------------- /Utilities/KWStyle/SITKFiles.txt.in: -------------------------------------------------------------------------------- 1 | @PROJECT_SOURCE_DIR@/Code/Common/*.h 2 | @PROJECT_SOURCE_DIR@/Code/Common/*.cxx 3 | @PROJECT_SOURCE_DIR@/Code/Common/*.txx 4 | @PROJECT_SOURCE_DIR@/Code/IO/*.h 5 | @PROJECT_SOURCE_DIR@/Code/IO/*.cxx 6 | @PROJECT_SOURCE_DIR@/Code/IO/*.txx 7 | @PROJECT_SOURCE_DIR@/Code/BasicFilters/*.h 8 | @PROJECT_SOURCE_DIR@/Code/BasicFilters/*.cxx 9 | @PROJECT_SOURCE_DIR@/Code/BasicFilters/*.txx 10 | @PROJECT_BINARY_DIR@/Code/Common/*.h 11 | @PROJECT_BINARY_DIR@/Code/Common/*.cxx 12 | @PROJECT_BINARY_DIR@/Code/Common/*.txx 13 | @PROJECT_BINARY_DIR@/Code/IO/*.h 14 | @PROJECT_BINARY_DIR@/Code/IO/*.cxx 15 | @PROJECT_BINARY_DIR@/Code/IO/*.txx 16 | @PROJECT_BINARY_DIR@/Code/BasicFilters/*.h 17 | @PROJECT_BINARY_DIR@/Code/BasicFilters/*.cxx 18 | @PROJECT_BINARY_DIR@/Code/BasicFilters/*.txx 19 | -------------------------------------------------------------------------------- /Examples/SimpleGaussianFunctional.cxx: -------------------------------------------------------------------------------- 1 | 2 | // This one header will include all SimpleITK filters and external 3 | // objects. 4 | #include 5 | 6 | // create convenient namespace alias 7 | namespace sitk = itk::simple; 8 | 9 | 10 | int main ( int argc, char* argv[] ) { 11 | 12 | if ( argc < 4 ) { 13 | std::cerr << "Usage: " << argv[0] << " \n"; 14 | return 1; 15 | } 16 | 17 | 18 | sitk::Image image = sitk::ReadImage ( std::string ( argv[1] ) ); 19 | 20 | sitk::PixelIDValueType inputPixelID = image.GetPixelIDValue(); 21 | 22 | image = sitk::SmoothingRecursiveGaussian ( image, atof ( argv[2] ) ); 23 | 24 | image = sitk::Cast( image, inputPixelID ); 25 | 26 | sitk::WriteImage ( image, std::string ( argv[3] ) ); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Documentation/Tutorials/Medium/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(SimpleITKMediumTutorial) 2 | 3 | # 4 | # This adds a custom target that generates the output document 5 | # This target depends on the list of copied files created 6 | # with the custom command above and the Plots target. 7 | # 8 | add_custom_target(MediumTutorial ALL 9 | COMMAND ${PDFLATEX_COMPILER} 10 | ${SimpleITKMediumTutorial_SOURCE_DIR}/SimpleITKMediumTutorial.tex 11 | -output-directory ${SimpleITKMediumTutorial_BINARY_DIR} 12 | COMMAND ${PDFLATEX_COMPILER} 13 | ${SimpleITKMediumTutorial_SOURCE_DIR}/SimpleITKMediumTutorial.tex 14 | -output-directory ${SimpleITKMediumTutorial_BINARY_DIR} 15 | DEPENDS ${COPY_RESULTS} ${REPORT_ELEMENTS} 16 | WORKING_DIRECTORY ${SimpleITKMediumTutorial_BINARY_DIR} 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /Wrapping/Java.i: -------------------------------------------------------------------------------- 1 | // Java 2 | #if SWIGJAVA 3 | %include "carrays.i" 4 | %array_class(int8_t, int8Array); 5 | %array_class(uint8_t, uint8Array); 6 | %array_class(int16_t, int16Array); 7 | %array_class(uint16_t, uint16Array); 8 | %array_class(int32_t, int32Array); 9 | %array_class(uint32_t, uint32Array); 10 | %array_class(float, floatArray); 11 | %array_class(double, doubleArray); 12 | %pragma(java) jniclasscode=%{ 13 | static { 14 | System.loadLibrary ( "SimpleITKJava" ); 15 | } 16 | %} 17 | 18 | // Make Java method names follow the naming conventions 19 | // See the swig.swg file, and ruby.swg for details on how this works 20 | // Documented in: http://www.swig.org/Doc2.0/SWIG.html#SWIG_advanced_renaming 21 | %rename("%(firstlowercase)s", %$isfunction ) ""; 22 | 23 | #endif // End of Java specific sections 24 | -------------------------------------------------------------------------------- /CTestCustom.cmake.in: -------------------------------------------------------------------------------- 1 | SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 100) 2 | SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 100) 3 | 4 | SET(CTEST_CUSTOM_COVERAGE_EXCLUDE 5 | ${CTEST_CUSTOM_COVERAGE_EXCLUDE} 6 | 7 | # Exclude try_compile sources from coverage results: 8 | "/CMakeFiles/CMakeTmp/" 9 | 10 | # Exclude files from the Testing directories 11 | ".*/Testing/.*" 12 | 13 | # Exclude files from the Utilities directories 14 | ".*/Utilities/.*" 15 | 16 | # exclude certain wrapping files 17 | "/Wrapping/SimpleITKLuaMain.cxx" 18 | "/Wrapping/.*_wrap.cxx" 19 | ) 20 | 21 | SET(CTEST_CUSTOM_WARNING_EXCEPTION 22 | ${CTEST_CUSTOM_WARNING_EXCEPTION} 23 | 24 | # Ignore warning from the SWIG wrapped file ( not much we can do about those ) 25 | ".*_wrap.cxx" 26 | 27 | # Ignore warning from gtest 28 | "gtest.h" 29 | ) 30 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryMagnitude.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryMagnitude", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "2d", 12 | "description" : "2D", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "ac40268d90c25dd631b54024ae84bffe" 17 | }, 18 | { 19 | "tag" : "3d", 20 | "description" : "3D", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "inputB" : "Input/RA-Short.nrrd", 23 | "settings" : [], 24 | "md5hash" : "1cd2796868a78f53a53849137989c153" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/LaplacianRecursiveGaussian.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "LaplacianRecursiveGaussian", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "output_pixel_type" : "float", 8 | "members" : [ 9 | { 10 | "name" : "Sigma", 11 | "type" : "double", 12 | "default" : "1.0", 13 | "doc" : "" 14 | }, 15 | { 16 | "name" : "NormalizeAcrossScale", 17 | "type" : "bool", 18 | "default" : "0", 19 | "doc" : "" 20 | } 21 | ] 22 | "tests" : [ 23 | { 24 | "tag" : "default", 25 | "description" : "Simply run with default settings", 26 | "inputA" : "Input/RA-Float.nrrd", 27 | "settings" : [], 28 | "tolerance" : 0.0001 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/RescaleIntensity.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "RescaleIntensity", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "RealPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "OutputMaximum", 10 | "type" : "double", 11 | "default" : 255.0, 12 | "doc" : "Output maximum" 13 | } 14 | { "name" : "OutputMinimum", 15 | "type" : "double", 16 | "default" : 0.0, 17 | "doc" : "Output minimum" 18 | } 19 | ], 20 | "tests" : [ 21 | { 22 | "tag" : "3d", 23 | "description" : "3D", 24 | "inputA" : "Input/RA-Float.nrrd", 25 | "settings" : [], 26 | "md5hash" : "466c989baecd563601987467d68654cd" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/SmoothingRecursiveGaussian.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "SmoothingRecursiveGaussian", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "output_pixel_type" : "float", 8 | "members" : [ 9 | { 10 | "name" : "Sigma", 11 | "type" : "double", 12 | "default" : "1.0", 13 | "doc" : "" 14 | }, 15 | { 16 | "name" : "NormalizeAcrossScale", 17 | "type" : "bool", 18 | "default" : "0", 19 | "doc" : "" 20 | } 21 | ] 22 | "tests" : [ 23 | { 24 | "tag" : "default", 25 | "description" : "Simply run with default settings", 26 | "inputA" : "Input/RA-Float.nrrd", 27 | "settings" : [], 28 | "tolerance" : 0.0001 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalMethod.h.in: -------------------------------------------------------------------------------- 1 | private: 2 | 3 | $(if number_of_inputs == 2 then 4 | OUT=[[ 5 | /** Setup for member function dispatching */ 6 | 7 | typedef Image (Self::*MemberFunctionType)( const Image &, const Image & ); 8 | template Image ExecuteInternal ( const Image& image1, const Image& image2 ); 9 | ]] 10 | else 11 | OUT=[[ 12 | /** Setup for member function dispatching */ 13 | typedef Image (Self::*MemberFunctionType)( const Image & ); 14 | template Image ExecuteInternal ( const Image& image ); 15 | ]]end)$(if vector_pixel_types_by_component then 16 | OUT=[[ 17 | /** Dispatched methods which calls ExecuteInteral on each component */ 18 | template Image ExecuteInternalVectorImage ( const Image& image );]] 19 | end) 20 | -------------------------------------------------------------------------------- /Examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories ( ${SimpleITK_INCLUDE_DIR} ) 3 | 4 | # Add individual cxx executables 5 | add_executable ( SimpleGaussian SimpleGaussian.cxx ) 6 | target_link_libraries ( SimpleGaussian ${SimpleITK_LIBRARIES} ) 7 | 8 | add_executable ( SimpleGaussianFunctional SimpleGaussianFunctional.cxx ) 9 | target_link_libraries ( SimpleGaussianFunctional ${SimpleITK_LIBRARIES} ) 10 | 11 | add_executable ( ITKIntegration ITKIntegration.cxx ) 12 | target_link_libraries ( ITKIntegration ${SimpleITK_LIBRARIES} ) 13 | 14 | # Add individual c# executables 15 | if( WRAP_CSHARP ) 16 | csharp_add_executable( 17 | SimpleGaussianCSharp 18 | SimpleITKCSharpManaged.dll 19 | ${CMAKE_CURRENT_SOURCE_DIR}/SimpleGaussian.cs 20 | ) 21 | endif( WRAP_CSHARP ) 22 | 23 | # 24 | # Go into testing subdirs 25 | # 26 | subdirs(Segmentation) 27 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GradientMagnitudeRecursiveGaussian.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GradientMagnitudeRecursiveGaussian", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "output_pixel_type" : "float", 8 | "members" : [ 9 | { 10 | "name" : "Sigma", 11 | "type" : "double", 12 | "default" : "1.0", 13 | "doc" : "" 14 | }, 15 | { 16 | "name" : "NormalizeAcrossScale", 17 | "type" : "bool", 18 | "default" : "0", 19 | "doc" : "" 20 | } 21 | ] 22 | "tests" : [ 23 | { 24 | "tag" : "default", 25 | "description" : "Simply run with default settings", 26 | "inputA" : "Input/RA-Float.nrrd", 27 | "settings" : [], 28 | "tolerance" : 0.0001 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteInternalGetImagePointers.cxx.in: -------------------------------------------------------------------------------- 1 | // Get the pointer to the ITK image contained in image1 2 | typename InputImageType::ConstPointer image1 = 3 | dynamic_cast ( inImage1.GetImageBase() ); 4 | 5 | // Check that ITK image pointer was properly retrieved 6 | if ( image1.IsNull() ) 7 | { 8 | sitkExceptionMacro( "Unexpected template dispatch error!" ); 9 | }$(if number_of_inputs == 2 then 10 | OUT=[[ 11 | 12 | 13 | // Get the a pointer to the ITK image contained in image2 14 | typename InputImageType2::ConstPointer image2 = 15 | dynamic_cast ( inImage2.GetImageBase() ); 16 | 17 | // Check that ITK image pointer was properly retrieved 18 | if ( image2.IsNull() ) 19 | { 20 | sitkExceptionMacro( "Unexpected template dispatch error!" ); 21 | }]] 22 | end) 23 | -------------------------------------------------------------------------------- /Examples/ImageConnection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Simple test of SimpleITK's java wrapping 3 | */ 4 | 5 | import org.itk.simple.*; 6 | 7 | class ImageConnection { 8 | 9 | public static void main(String argv[]) { 10 | 11 | if ( argv.length < 2 ) { 12 | System.out.println("Usage: java ImageConnection "); 13 | return; 14 | } 15 | 16 | ImageFileReader reader = new ImageFileReader(); 17 | reader.setFileName(argv[0]); 18 | Image img = reader.execute(); 19 | 20 | PixelContainer pixelsContainer = img.getPixelContainer(); 21 | 22 | int8Array pixelsArray = int8Array.frompointer( pixelsContainer.getBufferAsInt8() ); 23 | 24 | java.math.BigInteger numberOfPixels = pixelsContainer.getNumberOfPixels(); 25 | 26 | int8Array anotherPixelsArray = new int8Array( numberOfPixels.longValue(), true ); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/VectorIndexSelectionCast.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "VectorIndexSelectionCast", 3 | "template_code_filename" : "ImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "VectorPixelIDTypeList", 7 | "output_pixel_type" : "typename InputImageType::InternalPixelType", 8 | "members" : [ 9 | { 10 | "name" : "Index", 11 | "type" : "unsigned int", 12 | "default" : 0, 13 | "doc" : "" 14 | } 15 | ], 16 | "tests" : [ 17 | { 18 | "tag" : "blue", 19 | "description" : "Extract blue from VH slice", 20 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 21 | "settings" : [ 22 | { 23 | "parameter" : "Index", 24 | "value" : 2 25 | } 26 | ], 27 | "md5hash" : "da3f74fce21be8b788da331377f7f361" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /Code/Common/sitkConditional.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkConditional_h 2 | #define __sitkConditional_h 3 | 4 | namespace itk 5 | { 6 | namespace simple 7 | { 8 | 9 | /* \brief This is an implementation of the enable if idiom. 10 | * 11 | * This template enables specialization of a templated function based 12 | * on some traits or concepts. It is implemented with SFINAE. 13 | * 14 | * If VCode is true, then the member Type will be TIfTrue, otherwise 15 | * the member typedef Type will be equivalent to TIfFalse. 16 | * 17 | */ 18 | template struct Conditional { typedef TIfTrue Type; }; 19 | /** \cond SPECIALIZATION_IMPLEMENTATION */ 20 | template 21 | struct Conditional { typedef TIfFalse Type; }; 22 | 23 | /**\endcond*/ 24 | 25 | 26 | } 27 | } 28 | 29 | #endif // __sitkConditional_h 30 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-2.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory2() 12 | { 13 | // cast between complex pixels and complex pixel 14 | m_DualMemberFactory->RegisterMemberFunctions > (); 15 | 16 | // cast between basic pixels and complex number pixels 17 | m_DualMemberFactory->RegisterMemberFunctions > (); 18 | 19 | // cast between basic images 20 | m_DualMemberFactory->RegisterMemberFunctions > (); 21 | 22 | } 23 | 24 | } // end namespace simple 25 | } // end namespace itk 26 | -------------------------------------------------------------------------------- /Code/BasicFilters/src/sitkCastImageFilter-3.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkCastImageFilter.h" 2 | #include "sitkCastImageFilter.txx" 3 | 4 | 5 | namespace itk 6 | { 7 | namespace simple 8 | { 9 | 10 | 11 | void CastImageFilter::RegisterMemberFactory3() 12 | { 13 | // cast between complex pixels and complex pixel 14 | m_DualMemberFactory->RegisterMemberFunctions > (); 15 | 16 | // cast between basic pixels and complex number pixels 17 | m_DualMemberFactory->RegisterMemberFunctions > (); 18 | 19 | // cast between basic images 20 | m_DualMemberFactory->RegisterMemberFunctions > (); 21 | 22 | } 23 | 24 | } // end namespace simple 25 | } // end namespace itk 26 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Mask.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Mask", 3 | "template_code_filename" : "DualImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation\ 7 | \\todo MaskImageFilter will support VectorImages shortly", 8 | "pixel_types" : "typelist::Append::Type", 9 | "pixel_types2" : "IntegerPixelIDTypeList", 10 | "members" : [ 11 | { "name" : "OutsideValue", 12 | "type" : "double", 13 | "default" : 0, 14 | "doc" : "Value assigned to pixels outside of the mask" 15 | } 16 | ], 17 | "tests" : [ 18 | { 19 | "tag" : "2d", 20 | "description" : "2d", 21 | "inputA" : "Input/STAPLE1.png", 22 | "inputB" : "Input/STAPLE2.png", 23 | "settings" : [], 24 | "md5hash" : "c57d7fda3e42374881c3c3181d15bf90" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/HConvex.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "HConvex", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { 10 | "name" : "Height", 11 | "type" : "double", 12 | "default" : "2.0", 13 | "doc" : "" 14 | }, 15 | { "name" : "FullyConnected", 16 | "type" : "bool", 17 | "default" : "false", 18 | "doc" : "" 19 | } 20 | ], 21 | "custom_methods" : [], 22 | "tests" : [ 23 | { 24 | "tag" : "HConvex", 25 | "description" : "Test HConvex", 26 | "inputA" : "Input/RA-Short.nrrd", 27 | "md5hash" : "f3a7b95a51710d51b3b73e0eb77eb1eb" 28 | "settings" : [ 29 | { 30 | "parameter" : "Height", 31 | "value" : 10000 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/HMinima.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "HMinima", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { 10 | "name" : "Height", 11 | "type" : "double", 12 | "default" : "2.0", 13 | "doc" : "" 14 | }, 15 | { "name" : "FullyConnected", 16 | "type" : "bool", 17 | "default" : "false", 18 | "doc" : "" 19 | } 20 | ], 21 | "custom_methods" : [], 22 | "tests" : [ 23 | { 24 | "tag" : "HMinima", 25 | "description" : "Test HMinima", 26 | "inputA" : "Input/RA-Short.nrrd", 27 | "md5hash" : "7778067eeb752b6ac396dd9e362e8346", 28 | "settings" : [ 29 | { 30 | "parameter" : "Height", 31 | "value" : 2000 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/HConcave.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "HConcave", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { 10 | "name" : "Height", 11 | "type" : "double", 12 | "default" : "2.0", 13 | "doc" : "" 14 | }, 15 | { "name" : "FullyConnected", 16 | "type" : "bool", 17 | "default" : "false", 18 | "doc" : "" 19 | } 20 | ], 21 | "custom_methods" : [], 22 | "tests" : [ 23 | { 24 | "tag" : "HConcave", 25 | "description" : "Test HConcave", 26 | "inputA" : "Input/RA-Short.nrrd", 27 | "md5hash" : "f5eabe457bc96f0b284c324c7d6387a6", 28 | "settings" : [ 29 | { 30 | "parameter" : "Height", 31 | "value" : 10000 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /Code/Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file ( GLOB SimpleITKCommonSource *.cxx *.h ../Registration/*.h ../Registration/*.cxx) 2 | file ( GLOB SimpleITKAncillarySource Ancillary/*.h Ancillary/*.cxx ) 3 | 4 | include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Ancillary ) 5 | add_library ( SimpleITKCommon ${SimpleITKCommonSource} ${SimpleITKAncillarySource} ) 6 | target_link_libraries ( SimpleITKCommon ${ITK_LIBRARIES} ) 7 | 8 | 9 | 10 | # Add custom command that will delete java files which need to be rebuilt when changes 11 | # are made to Common 12 | if( WRAP_JAVA ) 13 | add_custom_command( 14 | TARGET SimpleITKCommon 15 | POST_BUILD 16 | COMMENT "Cleaning java build..." 17 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/org/itk/simple/*.java 18 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/build/org/itk/simple/*.class 19 | ) 20 | endif() 21 | -------------------------------------------------------------------------------- /Testing/Unit/ImageTest.py: -------------------------------------------------------------------------------- 1 | import SimpleITK as sitk 2 | import sys 3 | 4 | # this test is suppose to test the python interface to the sitk::Image 5 | 6 | 7 | image = sitk.Image( 10, 10, sitk.sitkInt32 ) 8 | 9 | image + image 10 | image + 1 11 | 1 + image 12 | image - image 13 | image - 1 14 | 1 - image 15 | image * image 16 | image * 1 17 | 1 * image 18 | image / image 19 | image / 1 20 | 1 / image 21 | image & image 22 | image | image 23 | image ^ image 24 | ~image 25 | 26 | image += image 27 | image -= image 28 | image *= image 29 | image /= image 30 | 31 | image = image * 0 32 | 33 | image.SetPixel( 0, 0, 1 ) 34 | image[ [0,1] ] = 2 35 | image[ 9,9 ] = 3 36 | 37 | image.GetPixel( 1,1 ) 38 | #image.GetPixel( [1,1] ) 39 | image[1,1] 40 | image[ [ 1,1 ] ] 41 | 42 | if sum(image) != 6: 43 | print "image sum not 6" 44 | sys.exit( 1 ) 45 | 46 | if len( image ) != 100: 47 | print "len not 100!" 48 | sys.exit(1) 49 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | SimpleITK 2 | ========= 3 | 4 | The goal of SimpleITK is to provide an abstraction layer to [ITK](http://www.itk.org) that enables developers and users to access the powerful features of the Insight Toolkit in a more simplified manner. SimpleITK also is easily wrap-able in several languages including: 5 | 6 | * [Python](http://www.python.org) 7 | * [Java](http://www.java.com) 8 | * [C#](http://msdn.microsoft.com/en-us/vcsharp/default.aspx) 9 | * [Lua](http://www.lua.org) 10 | 11 | Wrapping is accomplished through [SWIG](http://www.swig.org), in principle, any language wrapped by SWIG should be applicable to SimpleITK. 12 | 13 | SimpleITK is licensed under the [Apache License](http://www.opensource.org/licenses/apache2.0.php) in the [same way as ITK](http://www.itk.org/Wiki/ITK_Release_4/Licensing). 14 | 15 | ToDo: 16 | 17 | + Registration 18 | + CastImageFilter 19 | + Multiple input filters 20 | + Simple arithmetic filters 21 | -------------------------------------------------------------------------------- /Code/BasicFilters/templates/sitkImageFilterTemplate.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __sitk${name}ImageFilter_h 2 | #define __sitk${name}ImageFilter_h 3 | 4 | $(include DoNotEditWarning.h.in) 5 | 6 | #include 7 | 8 | #include "sitkDualImageFilter.h" 9 | $(include AddExtraIncludes.h.in) 10 | 11 | namespace itk { 12 | namespace simple { 13 | 14 | /** \class ${name}ImageFilter 15 | * 16 | * ${doc} 17 | */ 18 | $(include ClassDeclaration.h.in) 19 | $(include PublicDeclarations.h.in) 20 | $(include MemberGetSetDeclarations.h.in) 21 | $(include ClassNameAndPrint.h.in) 22 | 23 | $(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) 24 | 25 | $(include ExecuteInternalMethod.h.in) 26 | 27 | $(include MemberFunctionDispatch.h.in) 28 | 29 | $(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) 30 | 31 | 32 | $(include FunctionalAPI.h.in) 33 | } 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /Code/Common/SimpleITK.h: -------------------------------------------------------------------------------- 1 | #ifndef __SimpleITK_h 2 | #define __SimpleITK_h 3 | 4 | #include 5 | 6 | #include "sitkDetail.h" 7 | #include "sitkMacro.h" 8 | #include "sitkImage.h" 9 | 10 | #include "sitkImageFilter.h" 11 | 12 | #include "sitkHashImageFilter.h" 13 | #include "sitkPixelIDTypeLists.h" 14 | #include "sitkImageFileReader.h" 15 | #include "sitkImageSeriesReader.h" 16 | #include "sitkImageFileWriter.h" 17 | #include "sitkStatisticsImageFilter.h" 18 | #include "sitkExtractImageFilter.h" 19 | #include "sitkCastImageFilter.h" 20 | 21 | // Registration support 22 | #include "sitkTransform.h" 23 | #include "sitkAffineTransform.h" 24 | #include "sitkLinearInterpolate.h" 25 | #include "sitkMattesMutualInformationMetric.h" 26 | #include "sitkRegistration.h" 27 | #include "sitkRegularStepGradientDescentOptimizer.h" 28 | 29 | 30 | // These headers are auto-generated 31 | #include "SimpleITKBasicFiltersGeneratedHeaders.h" 32 | #endif 33 | -------------------------------------------------------------------------------- /SimpleITKConfig.cmake.in: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SimpleITKConfig.cmake - SimpleITK CMake configuration file for external projects. 4 | # 5 | # This file is configured by SimpleITK and used by the UseSimpleITK.cmake module 6 | # to load SimpleITK's settings for an external project. 7 | 8 | # The SimpleITK include file directories. 9 | set(SimpleITK_INCLUDE_DIRS "@SimpleITK_INCLUDE_DIRS_CONFIG@") 10 | 11 | # The SimpleITK library directories. 12 | set(SimpleITK_LIBRARY_DIRS "@SimpleITK_LIBRARY_DIRS_CONFIG@") 13 | 14 | # The location of the UseITK.cmake file. 15 | set(SimpleITK_USE_FILE "@SimpleITK_USE_FILE@") 16 | 17 | # A list of all libraries for SimpleITK. Those listed here should 18 | # automatically pull in their dependencies. 19 | set(SimpleITK_LIBRARIES SimpleITKBasicFilters 20 | SimpleITKCommon 21 | SimpleITKIO) 22 | 23 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /TemplateComponents/ExecuteNoParameters.cxx.in: -------------------------------------------------------------------------------- 1 | Image ${name}ImageFilter::Execute ( const Image & image1$(if number_of_inputs==2 then OUT=[[, const Image& image2]] end) ) 2 | { 3 | 4 | PixelIDValueType type = image1.GetPixelIDValue(); 5 | unsigned int dimension = image1.GetDimension();$(if number_of_inputs and number_of_inputs == 2 then 6 | OUT=[[ 7 | 8 | 9 | // todo need better error handling and potential type conversion 10 | if ( type != image2.GetPixelIDValue() || 11 | dimension != image2.GetDimension() || 12 | image1.GetWidth() != image2.GetWidth() || 13 | image1.GetHeight() != image2.GetHeight() || 14 | image1.GetDepth() != image2.GetDepth() ) 15 | { 16 | sitkExceptionMacro ( "Both images for ${name}ImageFilter don't match type or dimension!" ); 17 | }]] end) 18 | 19 | return this->m_MemberFactory->GetMemberFunction( type, dimension )( image1 $(if number_of_inputs==2 then OUT=[[, image2]] end) ); 20 | } 21 | -------------------------------------------------------------------------------- /sitkGenerateSimpleITKConfig.cmake: -------------------------------------------------------------------------------- 1 | # Generate the SimpleITKConfig.cmake file in the build tree. Also configure 2 | # one for installation. The file tells external projects how to use 3 | # SimpleITK. 4 | 5 | 6 | 7 | 8 | #----------------------------------------------------------------------------- 9 | # Settings specific to the build tree. 10 | 11 | # Library directory. 12 | set(SimpleITK_LIBRARY_DIRS_CONFIG ${LIBRARY_OUTPUT_PATH}) 13 | 14 | # Determine the include directories needed. 15 | set(SimpleITK_INCLUDE_DIRS_CONFIG 16 | ${SimpleITK_INCLUDE_DIR} 17 | ) 18 | 19 | # The "use" file. 20 | set(SimpleITK_USE_FILE ${SimpleITK_BINARY_DIR}/UseSimpleITK.cmake) 21 | 22 | #----------------------------------------------------------------------------- 23 | # Configure SimpleITKConfig.cmake for the build tree. 24 | configure_file(${SimpleITK_SOURCE_DIR}/SimpleITKConfig.cmake.in 25 | ${SimpleITK_BINARY_DIR}/SimpleITKConfig.cmake @ONLY IMMEDIATE) 26 | 27 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.cs: -------------------------------------------------------------------------------- 1 | using System; namespace itk.simple.examples { class SimpleGaussianExample { static void Main(string[] args) { try { if (args.Length < 3) { Console.WriteLine("Usage: SimpleGaussian "); return; } ImageFileReader reader = new ImageFileReader(); reader.setFileName(args[0]); SmartPointerImage image = reader.execute(); Console.WriteLine(image.toString()); Gaussian gaussian = new Gaussian(); 2 | gaussian.setSigma(Double.Parse(args[1])); image = gaussian.execute(image); Console.WriteLine(image.toString()); ImageFileWriter writer = new ImageFileWriter(); writer.setFileName(args[2]); writer.execute(image); } catch (Exception ex) { Console.WriteLine(ex); } } } } -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.R: -------------------------------------------------------------------------------- 1 | # Run with: 2 | # 3 | # Rscript --vanilla SimpleGaussian.R input sigma output 4 | # 5 | 6 | library(SimpleITK) 7 | 8 | args <- commandArgs( TRUE ) 9 | 10 | myreader <- ImageFileReader() 11 | myreader <- ImageFileReader_SetFileName( myreader, args[[1]] ) 12 | myimage <- ImageFileReader_Execute( myreader ) 13 | 14 | pixeltype <- Image_GetPixelIDValue( myimage ) 15 | 16 | myfilter <- SmoothingRecursiveGaussianImageFilter() 17 | myfilter <- SmoothingRecursiveGaussianImageFilter_SetSigma( myfilter, as.real(args[2]) ) 18 | smoothedimage <- SmoothingRecursiveGaussianImageFilter_Execute( myfilter, myimage ) 19 | 20 | mycaster <- CastImageFilter() 21 | mycaster <- CastImageFilter_SetOutputPixelType( mycaster, pixeltype ) 22 | castedimage <- CastImageFilter_Execute( mycaster, soothedimage ) 23 | 24 | mywriter <- ImageFileWriter() 25 | mywriter <- ImageFileWriter_SetFileName( mywriter, args[[3]] ) 26 | mywriter <- ImageFileWriter_Execute( mywriter, castedimage ) 27 | 28 | -------------------------------------------------------------------------------- /Testing/Unit/LuaTests.cxx: -------------------------------------------------------------------------------- 1 | #include "SimpleITKTestHarness.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #if defined(WRAP_LUA) 9 | TEST_F(Lua,SimpleGaussian) { 10 | // Run the simple gaussian command line program 11 | std::string Script = dataFinder.GetSourceDirectory() + "/Examples/SimpleGaussian.lua"; 12 | std::string output = dataFinder.GetOutputFile ( "Lua.SimpleGaussian.nrrd" ); 13 | std::vector CommandLine; 14 | 15 | CommandLine.push_back ( dataFinder.GetLuaExecutable() ); 16 | CommandLine.push_back ( Script ); 17 | CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); 18 | CommandLine.push_back ( "2.0" ); 19 | CommandLine.push_back ( output ); 20 | 21 | // Run it! 22 | RunExecutable ( CommandLine, true ); 23 | 24 | this->CheckImageHash( output, "02ce020f462cf05f3c354bc33a7834603d65b906" ); 25 | 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /Testing/Unit/TclTests.cxx: -------------------------------------------------------------------------------- 1 | #include "SimpleITKTestHarness.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #if defined(WRAP_TCL) 9 | TEST_F(Tcl,SimpleGaussian) { 10 | // Run the simple gaussian command line program 11 | std::string Script = dataFinder.GetSourceDirectory() + "/Examples/SimpleGaussian.tcl"; 12 | std::string output = dataFinder.GetOutputFile ( "Tcl.SimpleGaussian.nrrd" ); 13 | std::vector CommandLine; 14 | 15 | CommandLine.push_back ( dataFinder.GetTclExecutable() ); 16 | CommandLine.push_back ( Script ); 17 | CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); 18 | CommandLine.push_back ( "2.0" ); 19 | CommandLine.push_back ( output ); 20 | 21 | // Run it! 22 | RunExecutable ( CommandLine, true ); 23 | 24 | this->CheckImageHash( output, "02ce020f462cf05f3c354bc33a7834603d65b906" ); 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Testing/Unit/SimpleITKTestHarnessPaths.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __SimpleITKTestHarnessPaths_h 2 | #define __SimpleITKTestHarnessPaths_h 3 | 4 | #define EXECUTABLE_PATH "@TEST_HARNESS_EXECUTABLE_DIRECTORY@" 5 | #define EXECUTABLE_SUFFIX "@CMAKE_EXECUTABLE_SUFFIX@" 6 | #define SIMPLEITK_SOURCE_DIR "@SimpleITK_SOURCE_DIR@" 7 | #define SIMPLEITK_BINARY_DIR "@SimpleITK_BINARY_DIR@" 8 | #define TEST_HARNESS_TEMP_DIRECTORY "@TEST_HARNESS_TEMP_DIRECTORY@" 9 | #define TEST_HARNESS_DATA_DIRECTORY "@TEST_HARNESS_DATA_DIRECTORY@" 10 | #define PYTHON_EXECUTABLE_PATH "@PYTHON_EXECUTABLE@" 11 | #define RSCRIPT_EXECUTABLE_PATH "@RSCRIPT_EXECUTABLE@" 12 | #define JAVA_EXECUTABLE_PATH "@Java_JAVA_EXECUTABLE@" 13 | #define JAVAC_EXECUTABLE_PATH "@Java_JAVAC_EXECUTABLE@" 14 | #define RUBY_EXECUTABLE_PATH "@RUBY_EXECUTABLE@" 15 | 16 | #cmakedefine WRAP_LUA 17 | #cmakedefine WRAP_PYTHON 18 | #cmakedefine WRAP_JAVA 19 | #cmakedefine WRAP_CSHARP 20 | #cmakedefine WRAP_TCL 21 | #cmakedefine WRAP_R 22 | #cmakedefine WRAP_RUBY 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Code/BasicFilters/include/sitkDualImageFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkDualImageFilter_h 2 | #define __sitkDualImageFilter_h 3 | 4 | #include "sitkImageFilter.h" 5 | 6 | namespace itk { 7 | namespace simple { 8 | 9 | /** \class DualImageFilter 10 | * \brief The base interface for SimpleITK filters that take two input images 11 | * 12 | * All SimpleITK filters which take two input images should inherit from this 13 | * class 14 | */ 15 | class DualImageFilter : 16 | protected NonCopyable 17 | { 18 | public: 19 | 20 | /** 21 | * Default Constructor that takes no arguments and initializes 22 | * default parameters 23 | */ 24 | DualImageFilter() {}; 25 | 26 | 27 | // Print ourselves out 28 | virtual std::string ToString() const = 0; 29 | 30 | virtual Image Execute ( const Image&, const Image& ) = 0; 31 | 32 | virtual ~DualImageFilter() {} 33 | 34 | private: 35 | 36 | // 37 | }; 38 | 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/OtsuThreshold.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "OtsuThreshold", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "Docs", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "output_image_type" : "itk::Image", 8 | "members" : [ 9 | { 10 | "name" : "InsideValue", 11 | "type" : "double", 12 | "default" : "255.0", 13 | "doc" : "" 14 | }, 15 | { 16 | "name" : "OutsideValue", 17 | "type" : "double", 18 | "default" : "0.0", 19 | "doc" : "" 20 | }, 21 | { 22 | "name" : "NumberOfHistogramBins", 23 | "type" : "uint32_t", 24 | "default" : "128", 25 | "doc" : "" 26 | } 27 | ] 28 | "tests" : [ 29 | { 30 | "tag" : "default", 31 | "description" : "Default parameter settings", 32 | "inputA" : "Input/RA-Short.nrrd", 33 | "settings" : [], 34 | "md5hash" : "5d24d83ec3369de9006694809786427f" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Code/IO/sitkImageReaderBase.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkImageReaderBase_h 2 | #define __sitkImageReaderBase_h 3 | 4 | 5 | #include "sitkNonCopyable.h" 6 | #include "sitkPixelIDValues.h" 7 | 8 | namespace itk { 9 | namespace simple { 10 | 11 | /** \class ImageReaderBase 12 | * \brief An abract base class for image readers 13 | * 14 | */ 15 | class ImageReaderBase : 16 | protected NonCopyable 17 | { 18 | public: 19 | // The default constructor and the destructor will be implicitly 20 | // declared as public. 21 | 22 | protected: 23 | 24 | 25 | void GetPixelIDFromImageIO( const std::string &fileName, 26 | PixelIDValueType &outPixelType, 27 | unsigned int & outDimensions); 28 | 29 | private: 30 | 31 | PixelIDValueType ExecuteInternalReadScalar( int componentType ); 32 | 33 | PixelIDValueType ExecuteInternalReadVector( int componentType ); 34 | 35 | }; 36 | } 37 | } 38 | 39 | 40 | #endif // __sitkImageReaderBase_h 41 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleFillhole.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleFillhole", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "filter_type" : "itk::GrayscaleFillholeImageFilter", 9 | "members" : [ 10 | { "name" : "FullyConnected", 11 | "type" : "bool", 12 | "default" : "false", 13 | "doc" : "" 14 | } 15 | ], 16 | "custom_methods" : [], 17 | "tests" : [ 18 | { 19 | "tag" : "GrayscaleFillhole1", 20 | "description" : "Test grayscale fillhole", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "md5hash" : "e2c49e979bd4c64f0efff67b196b1950", 23 | "settings" : [ 24 | ] 25 | }, 26 | { 27 | "tag" : "GrayscaleFillhole2", 28 | "description" : "Test grayscale fillhole 2D", 29 | "inputA" : "Input/RA-Slice-Short.png", 30 | "md5hash" : "e3cd61348a7824d191e83632bf92baae", 31 | "settings" : [ 32 | ] 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Simple test of SimpleITK's java wrapping 3 | */ 4 | 5 | 6 | import org.itk.simple.*; 7 | 8 | class SimpleGaussian { 9 | 10 | public static void main(String argv[]) { 11 | 12 | if ( argv.length < 3 ) { 13 | System.out.println("Usage: java SimpleGaussian "); 14 | return; 15 | } 16 | 17 | org.itk.simple.ImageFileReader reader = new org.itk.simple.ImageFileReader(); 18 | reader.setFileName(argv[0]); 19 | Image img = reader.execute(); 20 | 21 | SmoothingRecursiveGaussianImageFilter filter = new SmoothingRecursiveGaussianImageFilter(); 22 | filter.setSigma( Double.valueOf( argv[1] ).doubleValue() ); 23 | Image blurredImg = filter.execute(img); 24 | 25 | CastImageFilter caster = new CastImageFilter(); 26 | caster.setOutputPixelType( img.getPixelIDValue() ); 27 | Image castImg = caster.execute( blurredImg ); 28 | 29 | ImageFileWriter writer = new ImageFileWriter(); 30 | writer.setFileName(argv[2]); 31 | writer.execute( castImg ); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleGrindPeak.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleGrindPeak", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "filter_type" : "itk::GrayscaleGrindPeakImageFilter", 9 | "members" : [ 10 | { "name" : "FullyConnected", 11 | "type" : "bool", 12 | "default" : "false", 13 | "doc" : "" 14 | } 15 | ], 16 | "custom_methods" : [], 17 | "tests" : [ 18 | { 19 | "tag" : "GrayscaleGrindPeak1", 20 | "description" : "Test grayscale grind peak", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "md5hash" : "084cdd1d64664ebfab26c2e0ed382e14", 23 | "settings" : [ 24 | ] 25 | }, 26 | { 27 | "tag" : "GrayscaleGrindPeak2", 28 | "description" : "Test grayscale grind peak 2D", 29 | "inputA" : "Input/RA-Slice-Short.png", 30 | "md5hash" : "b18d75cccb9361c65b40bb5c0d3c6e0d" 31 | "settings" : [ 32 | ] 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /Testing/Unit/RubyTests.cxx: -------------------------------------------------------------------------------- 1 | #include "SimpleITKTestHarness.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #if defined(WRAP_RUBY) 9 | TEST_F(Ruby,SimpleGaussian) { 10 | // Run the simple gaussian command line program 11 | std::string Script = dataFinder.GetSourceDirectory() + "/Examples/SimpleGaussian.rb"; 12 | std::string output = dataFinder.GetOutputFile ( "Ruby.SimpleGaussian.nrrd" ); 13 | std::vector CommandLine; 14 | 15 | CommandLine.push_back ( dataFinder.GetRubyExecutable() ); 16 | CommandLine.push_back ( Script ); 17 | CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); 18 | CommandLine.push_back ( "2.0" ); 19 | CommandLine.push_back ( output ); 20 | 21 | // Set our Ruby path 22 | SetEnvironment ( "RUBYLIB", dataFinder.GetExecutableDirectory() ); 23 | 24 | // Run it! 25 | RunExecutable ( CommandLine, true ); 26 | 27 | this->CheckImageHash( output, "02ce020f462cf05f3c354bc33a7834603d65b906" ); 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Add.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Add", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "2d", 12 | "description" : "2D", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "bc458a17e18c79ae767e8be47451d1b4" 17 | }, 18 | { 19 | "tag" : "3d", 20 | "description" : "3D", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "inputB" : "Input/RA-Short.nrrd", 23 | "settings" : [], 24 | "md5hash" : "dfc0af11e8c30a0bd6dedd560486f419" 25 | }, 26 | { 27 | "tag" : "2d-rgb", 28 | "description" : "2D-RGB", 29 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 30 | "inputB" : "Input/VM1111Shrink-RGBFloat.nrrd", 31 | "settings" : [], 32 | "md5hash" : "5f00ee8a03437b4e421eb761dc340bc8" 33 | } 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Testing/Unit/sitkExceptionsTests.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkMacro.h" 2 | 3 | #include "SimpleITKTestHarness.h" 4 | 5 | static const char * DESCRIPTION = "We expect this exception"; 6 | 7 | class sitkExceptionsTest 8 | : public ::testing::Test 9 | { 10 | public: 11 | 12 | void ThrowsitkException( void ) 13 | { 14 | sitkExceptionMacro( << DESCRIPTION ); 15 | } 16 | }; 17 | 18 | TEST_F(sitkExceptionsTest, Test1) { 19 | ASSERT_THROW( ThrowsitkException(), ::itk::simple::GenericException ); 20 | 21 | try 22 | { 23 | ThrowsitkException(); 24 | } 25 | catch ( ::itk::simple::GenericException &e ) 26 | { 27 | // could do some nifty testing here too 28 | EXPECT_EQ ( e.GetNameOfClass(), std::string("GenericException") ); 29 | EXPECT_NE ( std::string ( e.GetLocation() ), "" ); 30 | return; 31 | } 32 | 33 | // should gotten that exception 34 | FAIL(); 35 | } 36 | 37 | TEST_F(sitkExceptionsTest, Test2) { 38 | 39 | // this can only be tested when true, if it was false the file won't compile 40 | sitkStaticAssert( true, "this is just a test" ); 41 | 42 | SUCCEED(); 43 | } 44 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Sigmoid.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sigmoid", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { 10 | "name" : "Alpha", 11 | "type" : "double", 12 | "default" : 1.0, 13 | "doc" : "Alpha" 14 | }, 15 | { 16 | "name" : "Beta", 17 | "type" : "double", 18 | "default" : 0.0, 19 | "doc" : "Alpha" 20 | }, 21 | { "name" : "OutputMaximum", 22 | "type" : "double", 23 | "default" : 255.0, 24 | "doc" : "Output maximum" 25 | }, 26 | { "name" : "OutputMinimum", 27 | "type" : "double", 28 | "default" : 0.0, 29 | "doc" : "Output minimum" 30 | } 31 | ] 32 | "tests" : [ 33 | { 34 | "tag" : "defaults", 35 | "description" : "Simply run with default settings", 36 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 37 | "settings" : [], 38 | "md5hash" : "c9222b9c9150e0d7a07e9de184c10167" 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /Wrapping/FindR.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # - This module locates an installed R distribution. 4 | # 5 | # Defines the following: 6 | # 7 | # R_INCLUDE_DIR - Path to R include directory 8 | # R_LIBRARIES - Path to R library 9 | # R_COMMAND - Path to R command 10 | # RSCRIPT_EXECUTABLE - Path to Rscript command 11 | # 12 | 13 | SET(TEMP_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE}) 14 | SET(CMAKE_FIND_APPBUNDLE "NEVER") 15 | FIND_PROGRAM(R_COMMAND R DOC "R executable.") 16 | IF (R_COMMAND) 17 | EXECUTE_PROCESS(WORKING_DIRECTORY . COMMAND ${R_COMMAND} RHOME OUTPUT_VARIABLE R_BASE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) 18 | SET(R_HOME ${R_BASE_DIR} CACHE PATH "R home directory obtained from R RHOME") 19 | ENDIF (R_COMMAND) 20 | FIND_PROGRAM(RSCRIPT_EXECUTABLE Rscript DOC "Rscript executable.") 21 | 22 | SET(CMAKE_FIND_APPBUNDLE ${TEMP_CMAKE_FIND_APPBUNDLE}) 23 | 24 | FIND_PATH(R_INCLUDE_DIR R.h PATHS /usr/local/lib /usr/local/lib64 PATH_SUFFIXES R/include DOC "Path to file R.h") 25 | FIND_LIBRARY(R_LIBRARY_BASE R PATHS ${R_BASE_DIR} PATH_SUFFIXES /lib DOC "R library (example libR.a, libR.dylib, etc.).") 26 | 27 | SET(R_LIBRARIES ${R_LIBRARY_BASE}) 28 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleErode.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleErode", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "Performs Erode in a grayscale image.", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | /* TODO Boundary Member */ 8 | "members" : [ 9 | ], 10 | "custom_methods" : [], 11 | "tests" : [ 12 | { 13 | "tag" : "GrayscaleErode", 14 | "description" : "Test grayscale erode", 15 | "inputA" : "Input/STAPLE1.png", 16 | "md5hash" : "cb0f49738a99f3467b575bc95a0ace44", 17 | "settings" : [ 18 | { "parameter" : "KernelRadius", 19 | "no_get_method" : 1, 20 | "value" : 1 21 | }, 22 | { "parameter" : "KernelType", 23 | "value" : "itk::simple::${name}ImageFilter::Ball", 24 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 25 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 26 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 27 | "java_value" : "${name}ImageFilter.KernelType.Ball", 28 | "tcl_value" : "$$${name}ImageFilter_Ball" 29 | } 30 | ] 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/MorphologicalGradient.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "MorphologicalGradient", 3 | "template_code_filename" : "KernelImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "custom_methods" : [], 10 | "tests" : [ 11 | { 12 | "tag" : "MorphologicalGradient", 13 | "description" : "Test morhological gradient", 14 | "inputA" : "Input/STAPLE1.png", 15 | "md5hash" : "57167a1d86b60fbf9e040d9441676876", 16 | "settings" : [ 17 | { "parameter" : "KernelRadius", 18 | "no_get_method" : 1, 19 | "value" : 1 20 | }, 21 | { "parameter" : "KernelType", 22 | "value" : "itk::simple::${name}ImageFilter::Ball", 23 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 24 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 25 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 26 | "java_value" : "${name}ImageFilter.KernelType.Ball", 27 | "tcl_value" : "$$${name}ImageFilter_Ball" 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Subtract.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Subtract", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "2D", 12 | "description" : "Default parameter settings", 13 | "inputA" : "Input/RA-Slice-Float.nrrd", 14 | "inputB" : "Input/RA-Slice-Float.nrrd", 15 | "settings" : [], 16 | "md5hash" : "ce338fe6899778aacfc28414f2d9498b" 17 | }, 18 | { 19 | "tag" : "3D", 20 | "description" : "Subtract a volume from a volume", 21 | "inputA" : "Input/RA-Short.nrrd", 22 | "inputB" : "Input/RA-Short.nrrd", 23 | "settings" : [], 24 | "md5hash" : "59071590099d21dd439896592338bf95" 25 | }, 26 | { 27 | "tag" : "2d-rgb", 28 | "description" : "2D-RGB", 29 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 30 | "inputB" : "Input/VM1111Shrink-RGBFloat.nrrd", 31 | "settings" : [], 32 | "md5hash" : "30d54bcc6106abcac387cf9da95fe514" 33 | } 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/SquaredDifference.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "SquaredDifference", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "2DStapleImages", 12 | "description" : "Default parameter settings", 13 | "inputA" : "Input/STAPLE1.png", 14 | "inputB" : "Input/STAPLE2.png", 15 | "settings" : [], 16 | "md5hash" : "f5161e3505304fa15a232fcdbf08a776" 17 | }, 18 | { 19 | "tag" : "Ramp-Short", 20 | "description" : "Ramp", 21 | "inputA" : "Input/Ramp-Zero-One-Float.nrrd", 22 | "inputB" : "Input/Ramp-One-Zero-Float.nrrd", 23 | "settings" : [], 24 | "md5hash" : "33104fb1c98375529a63436e4d8b189d" 25 | }, 26 | { 27 | "tag" : "Ramp-Short", 28 | "description" : "Ramp", 29 | "inputA" : "Input/Ramp-Up-Short.nrrd", 30 | "inputB" : "Input/Ramp-Down-Short.nrrd", 31 | "settings" : [], 32 | "md5hash" : "8d857b95486c7a75db387c73252ec886" 33 | } 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Code/Registration/sitkRegularStepGradientDescentOptimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkRegularStepGradientDescentOptimizer_h 2 | #define __sitkRegularStepGradientDescentOptimizer_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "sitkImage.h" 7 | #include "itkRegularStepGradientDescentOptimizer.h" 8 | #include "sitkMemberFunctionFactory.h" 9 | 10 | namespace itk 11 | { 12 | namespace simple 13 | { 14 | 15 | class RegularStepGradientDescentOptimizer : public Optimizer 16 | { 17 | public: 18 | RegularStepGradientDescentOptimizer() {}; 19 | // Could potentially set some parameters here 20 | virtual ::itk::Optimizer::Pointer GetOptimizer() 21 | { 22 | ::itk::RegularStepGradientDescentOptimizer::Pointer optimizer = ::itk::RegularStepGradientDescentOptimizer::New(); 23 | optimizer->SetNumberOfIterations ( 2000 ); 24 | optimizer->SetMinimumStepLength ( .0005 ); 25 | optimizer->SetMaximumStepLength ( 4.0 ); 26 | optimizer->SetMinimize(true); 27 | return optimizer.GetPointer(); 28 | } 29 | protected: 30 | virtual Optimizer* Clone() { return new RegularStepGradientDescentOptimizer ( *this ); } 31 | }; 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleMorphologicalClosing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleMorphologicalClosing", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "Performs morphological closing in a grayscale image.", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "members" : [], 8 | "custom_methods" : [], 9 | "tests" : [ 10 | { 11 | "tag" : "GrayscaleMorphologicalClosing", 12 | "description" : "Test grayscale morphological closing", 13 | "inputA" : "Input/STAPLE1.png", 14 | "md5hash" : "103130cc4caf40d9fb252fbabc531e15", 15 | "settings" : [ 16 | { "parameter" : "KernelRadius", 17 | "no_get_method" : 1, 18 | "value" : 1 19 | }, 20 | { "parameter" : "KernelType", 21 | "value" : "itk::simple::${name}ImageFilter::Ball", 22 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 23 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 24 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 25 | "java_value" : "${name}ImageFilter.KernelType.Ball", 26 | "tcl_value" : "$$${name}ImageFilter_Ball" 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleDilate.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleDilate", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "Performs Dilation in a grayscale image.", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | /* TODO Boundary Member */ 8 | "members" : [ 9 | ], 10 | "custom_methods" : [], 11 | "tests" : [ 12 | { 13 | "tag" : "GrayscaleDilate", 14 | "description" : "Test grayscale dilation", 15 | "inputA" : "Input/STAPLE1.png", 16 | "settings" : [], 17 | "md5hash" : "cb692559f1eb21e4c932f6bbb3850ad3", 18 | "settings" : [ 19 | { "parameter" : "KernelRadius", 20 | "no_get_method" : 1, 21 | "value" : 1 22 | }, 23 | { "parameter" : "KernelType", 24 | "value" : "itk::simple::${name}ImageFilter::Ball", 25 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 26 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 27 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 28 | "java_value" : "${name}ImageFilter.KernelType.Ball", 29 | "tcl_value" : "$$${name}ImageFilter_Ball" 30 | } 31 | ] 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleGeodesicErode.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleGeodesicErode", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Input1 is input, Input2 is marker image", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "filter_type" : "itk::GrayscaleGeodesicErodeImageFilter", 9 | "members" : [ 10 | { 11 | "name" : "RunOneIteration", 12 | "type" : "bool", 13 | "default" : "false", 14 | "doc" : "" 15 | }, 16 | { 17 | "name" : "FullyConnected", 18 | "type" : "bool", 19 | "default" : "false", 20 | "doc" : "" 21 | } 22 | ], 23 | "custom_methods" : [], 24 | "tests" : [ 25 | { 26 | "tag" : "GrayscaleGeodesicDilate", 27 | "description" : "Test grayscale geodesic erode", 28 | "inputA" : "Input/STAPLE2.png", 29 | "inputB" : "Input/STAPLE1.png", 30 | "md5hash" : "095f00a68a84df4396914fa758f34dcc" 31 | "settings" : [ 32 | { "parameter" : "RunOneIteration", "value" : "false", "python_value" : "False" }, 33 | { "parameter" : "FullyConnected", "value" : "true", "python_value" : "True" } 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BlackTopHat.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BlackTopHat", 3 | "template_code_filename" : "KernelImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "SafeBorder", 10 | "type" : "bool", 11 | "default" : true, 12 | "doc" : "" 13 | } 14 | ], 15 | "custom_methods" : [], 16 | "tests" : [ 17 | { 18 | "tag" : "BlackTopHapErode", 19 | "description" : "Test black top hat", 20 | "inputA" : "Input/STAPLE1.png", 21 | "md5hash" : "445a5da6221f6d976d169b70c5538614", 22 | "settings" : [ 23 | { "parameter" : "KernelRadius", 24 | "no_get_method" : 1, 25 | "value" : 1 26 | }, 27 | { "parameter" : "KernelType", 28 | "value" : "itk::simple::${name}ImageFilter::Ball", 29 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 30 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 31 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 32 | "java_value" : "${name}ImageFilter.KernelType.Ball", 33 | "tcl_value" : "$$${name}ImageFilter_Ball" 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /Code/BasicFilters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Glob non-generated BasicFilters and add to cache 3 | file ( GLOB SimpleITKBasicFiltersSource include/*.txx src/*.cxx ) 4 | set ( SimpleITKBasicFiltersSource ${SimpleITKBasicFiltersSource} CACHE INTERNAL "" ) 5 | 6 | # Set up code generation 7 | include(${SimpleITK_SOURCE_DIR}/CMake/generate_filter_source.cmake) 8 | generate_filter_source() 9 | 10 | 11 | # Include the hand-written and auto-generated code 12 | include_directories ( 13 | ${CMAKE_CURRENT_SOURCE_DIR}/include 14 | ${CMAKE_CURRENT_BINARY_DIR}/include 15 | ) 16 | 17 | 18 | add_library ( SimpleITKBasicFilters ${SimpleITKBasicFiltersSource} ${SimpleITKBasicFiltersGeneratedSource}) 19 | target_link_libraries ( SimpleITKBasicFilters SimpleITKCommon ${ITK_LIBRARIES} ) 20 | 21 | 22 | # Add custom command that will delete java files which need to be rebuilt when changes 23 | # are made to BasicFilters 24 | if( WRAP_JAVA ) 25 | add_custom_command( 26 | TARGET SimpleITKBasicFilters 27 | POST_BUILD 28 | COMMENT "Cleaning java build..." 29 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/org/itk/simple/*.java 30 | COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleITK_BINARY_DIR}/Wrapping/build/org/itk/simple/*.class 31 | ) 32 | endif() 33 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/WhiteTopHat.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "WhiteTopHat", 3 | "template_code_filename" : "KernelImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "SafeBorder", 10 | "type" : "bool", 11 | "default" : true, 12 | "doc" : "" 13 | } 14 | ], 15 | "custom_methods" : [], 16 | "tests" : [ 17 | { 18 | "tag" : "WhiteTopHatErode", 19 | "description" : "Test white top hat", 20 | "inputA" : "Input/STAPLE1.png", 21 | "md5hash" : "e784daff43d09a18e20556729afc0c9d", 22 | "settings" : [ 23 | { "parameter" : "KernelRadius", 24 | "no_get_method" : 1, 25 | "value" : 1 26 | }, 27 | { "parameter" : "KernelType", 28 | "value" : "itk::simple::${name}ImageFilter::Ball", 29 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 30 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 31 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 32 | "java_value" : "${name}ImageFilter.KernelType.Ball", 33 | "tcl_value" : "$$${name}ImageFilter_Ball" 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryMorphologicalClosing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryMorphologicalClosing", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "ForegroundValue", 10 | "type" : "double", 11 | "default" : "255", 12 | "doc" : "" 13 | } 14 | ], 15 | "custom_methods" : [], 16 | "tests" : [ 17 | { 18 | "tag" : "BinaryMorphologicalClosing", 19 | "description" : "Test binary morphological closing", 20 | "inputA" : "Input/STAPLE1.png", 21 | "md5hash" : "095f00a68a84df4396914fa758f34dcc", 22 | "settings" : [ 23 | { "parameter" : "KernelRadius", 24 | "no_get_method" : 1, 25 | "value" : 1 26 | }, 27 | { "parameter" : "KernelType", 28 | "value" : "itk::simple::${name}ImageFilter::Ball", 29 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 30 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 31 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 32 | "java_value" : "${name}ImageFilter.KernelType.Ball", 33 | "tcl_value" : "$$${name}ImageFilter_Ball" 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /UseSimpleITK.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # This file sets up include directories, link directories, and 3 | # compiler settings for a project to use SimpleITK. It should not be 4 | # included directly, but rather through the SimpleITK_USE_FILE setting 5 | # obtained from SimpleITKConfig.cmake. 6 | # 7 | 8 | if(SimpleITK_BUILD_SETTINGS_FILE AND NOT SKIP_SimpleITK_BUILD_SETTINGS_FILE) 9 | include(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake) 10 | CMAKE_IMPORT_BUILD_SETTINGS(${SimpleITK_BUILD_SETTINGS_FILE}) 11 | endif(SimpleITK_BUILD_SETTINGS_FILE AND NOT SKIP_SimpleITK_BUILD_SETTINGS_FILE) 12 | 13 | # Add compiler flags needed to use SimpleITK. 14 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SimpleITK_REQUIRED_C_FLAGS}") 15 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimpleITK_REQUIRED_CXX_FLAGS}") 16 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SimpleITK_REQUIRED_LINK_FLAGS}") 17 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SimpleITK_REQUIRED_LINK_FLAGS}") 18 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SimpleITK_REQUIRED_LINK_FLAGS}") 19 | 20 | # Add include directories needed to use SimpleITK. 21 | include_directories(BEFORE ${SimpleITK_INCLUDE_DIRS}) 22 | 23 | # Add link directories needed to use SimpleITK. 24 | link_directories(${SimpleITK_LIBRARY_DIRS}) 25 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryFillhole.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryFillhole", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "filter_type" : "itk::BinaryFillholeImageFilter", 9 | "members" : [ 10 | { "name" : "FullyConnected", 11 | "type" : "bool", 12 | "default" : "false", 13 | "doc" : "" 14 | }, 15 | { 16 | "name" : "ForegroundValue", 17 | "type" : "double", 18 | "default" : "255", 19 | "doc" : "" 20 | } 21 | ], 22 | "custom_methods" : [], 23 | "tests" : [ 24 | { 25 | "tag" : "BinaryFillhole1", 26 | "description" : "Test binary fillhole with default not fully connected", 27 | "inputA" : "Input/BlackDots.png", 28 | "md5hash" : "fc79dc09164291c76b95aaa066633f67" 29 | }, 30 | { 31 | "tag" : "BinaryFillhole2", 32 | "description" : "Test binary fillhole fully connected", 33 | "inputA" : "Input/BlackDots.png", 34 | "md5hash" : "96d14091c7466129e61848889b7fe89c" 35 | "settings" : [ 36 | { "parameter" : "FullyConnected", 37 | "value" : "true", 38 | "python_value" : "True" 39 | } 40 | ] 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /Code/Registration/sitkAffineTransform.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkAffineTransform.h" 2 | 3 | namespace itk 4 | { 5 | namespace simple 6 | { 7 | AffineTransform::AffineTransform() { 8 | } 9 | 10 | std::vector AffineTransform::GetOptimizerScales ( int dimension ) 11 | { 12 | unsigned int NumberOfParameters = this->GetTransform ( dimension )->GetNumberOfParameters(); 13 | std::vector scales; 14 | for ( unsigned int idx = 0; idx < NumberOfParameters; idx++ ) 15 | { 16 | scales.push_back ( 1.0 ); 17 | if ( idx >= (unsigned int)(dimension*dimension) ) 18 | { 19 | scales[idx] = 1.0 / 10.0; 20 | } 21 | } 22 | return scales; 23 | } 24 | 25 | ::itk::TransformBase::Pointer AffineTransform::GetTransform ( int dimension ) 26 | { 27 | ::itk::TransformBase::Pointer xform; 28 | switch ( dimension ) 29 | { 30 | case 2: 31 | xform = (::itk::TransformBase*)::itk::AffineTransform::New(); 32 | return xform; 33 | break; 34 | case 3: 35 | xform = (::itk::TransformBase*)::itk::AffineTransform::New(); 36 | return xform; 37 | break; 38 | } 39 | sitkExceptionMacro ( << "Transforms must be 2 or 3 dimensional" ); 40 | return NULL; 41 | } 42 | 43 | } 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryClosingByReconstruction.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryClosingByReconstruction", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "no_output_type" : 1, 8 | "members" : [ 9 | { "name" : "FullyConnected", 10 | "type" : "bool", 11 | "default" : "false", 12 | "doc" : "" 13 | } 14 | ], 15 | "custom_methods" : [], 16 | "tests" : [ 17 | { 18 | "tag" : "BinaryClosingByReconstruction", 19 | "description" : "Test binary closing by reconstruction", 20 | "inputA" : "Input/STAPLE1.png", 21 | "md5hash" : "095f00a68a84df4396914fa758f34dcc", 22 | "settings" : [ 23 | { "parameter" : "KernelRadius", 24 | "no_get_method" : 1, 25 | "value" : 1 26 | }, 27 | { "parameter" : "KernelType", 28 | "value" : "itk::simple::${name}ImageFilter::Ball", 29 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 30 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 31 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 32 | "java_value" : "${name}ImageFilter.KernelType.Ball", 33 | "tcl_value" : "$$${name}ImageFilter_Ball" 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryOpeningByReconstruction.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryOpeningByReconstruction", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "no_output_type" : 1, 8 | "members" : [ 9 | { "name" : "FullyConnected", 10 | "type" : "bool", 11 | "default" : "false", 12 | "doc" : "" 13 | } 14 | ], 15 | "custom_methods" : [], 16 | "tests" : [ 17 | { 18 | "tag" : "BinaryOpeningByReconstruction", 19 | "description" : "Test binary closing by reconstruction", 20 | "inputA" : "Input/STAPLE1.png", 21 | "md5hash" : "095f00a68a84df4396914fa758f34dcc", 22 | "settings" : [ 23 | { "parameter" : "KernelRadius", 24 | "no_get_method" : 1, 25 | "value" : 1 26 | }, 27 | { "parameter" : "KernelType", 28 | "value" : "itk::simple::${name}ImageFilter::Ball", 29 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 30 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 31 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 32 | "java_value" : "${name}ImageFilter.KernelType.Ball", 33 | "tcl_value" : "$$${name}ImageFilter_Ball" 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Wrapping/CSharpTypemapHelper.i: -------------------------------------------------------------------------------- 1 | /* File : CSharpTypemapHelper.i */ 2 | %define %CSharpTypemapHelper(TYPE, CSTYPE) 3 | %typemap(in) TYPE "$1 = ($1_ltype)$input;" // wrap 4 | %typemap(imtype) TYPE "CSTYPE" // pinvoke 5 | %typemap(cstype, excode=SWIGEXCODE) TYPE "CSTYPE" // cs 6 | %typemap(csin, excode=SWIGEXCODE) TYPE "$csinput" 7 | %typemap(csout, excode=SWIGEXCODE) TYPE { 8 | CSTYPE ret = $imcall;$excode 9 | return ret; 10 | } 11 | %typemap(csvarin, excode=SWIGEXCODE) TYPE " 12 | set { 13 | $imcall;$excode 14 | }" 15 | %typemap(csvarout, excode=SWIGEXCODE) TYPE " 16 | get { 17 | return $imcall;$excode 18 | }" 19 | %enddef 20 | 21 | %define %CSharpPointerTypemapHelper(TYPE, CSTYPE) 22 | %typemap(in) TYPE "$1 = $1_ltype(($1_ltype::ObjectType*)$input);" // wrap 23 | %typemap(imtype) TYPE "CSTYPE" // pinvoke 24 | %typemap(cstype, excode=SWIGEXCODE) TYPE "CSTYPE" // cs 25 | %typemap(csin, excode=SWIGEXCODE) TYPE "$csinput" 26 | %typemap(csout, excode=SWIGEXCODE) TYPE { 27 | CSTYPE ret = $imcall;$excode 28 | return ret; 29 | } 30 | %typemap(csvarin, excode=SWIGEXCODE) TYPE " 31 | set { 32 | $imcall;$excode 33 | }" 34 | %typemap(csvarout, excode=SWIGEXCODE) TYPE " 35 | get { 36 | return $imcall;$excode 37 | }" 38 | %enddef -------------------------------------------------------------------------------- /Code/BasicFilters/include/sitkImageFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkImageFilter_h 2 | #define __sitkImageFilter_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkImage.h" 6 | #include "sitkMemberFunctionFactory.h" 7 | 8 | namespace itk { 9 | namespace simple { 10 | 11 | /** \class ImageFilter 12 | * \brief The base interface for SimpleITK filters that take one input image 13 | * 14 | * All SimpleITK filters which take one input image should inherit from this 15 | * class 16 | */ 17 | class ImageFilter: 18 | protected NonCopyable 19 | { 20 | public: 21 | typedef ImageFilter Self; 22 | 23 | // 24 | // Type List Setup 25 | // 26 | 27 | // 28 | // Filter Setup 29 | // 30 | 31 | /** 32 | * Default Constructor that takes no arguments and initializes 33 | * default parameters 34 | */ 35 | ImageFilter(); 36 | 37 | /** 38 | * Default Destructor 39 | */ 40 | virtual ~ImageFilter(); 41 | 42 | // Print ourselves out 43 | virtual std::string ToString() const = 0; 44 | 45 | virtual Image Execute ( const Image & ) = 0; 46 | 47 | /** return user readable name fo the filter */ 48 | virtual std::string GetName() const = 0; 49 | 50 | private: 51 | 52 | }; 53 | 54 | 55 | } 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryMinMaxCurvatureFlow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryMinMaxCurvatureFlow", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "RealPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "TimeStep", 10 | "type" : "double", 11 | "default" : 0.125, 12 | "doc" : "Time step for PDE solver" 13 | }, 14 | { 15 | "name" : "NumberOfIterations", 16 | "type" : "uint32_t", 17 | "default" : "5u", 18 | "doc" : "Number of iterations to run" 19 | } 20 | ] 21 | "tests" : [ 22 | { 23 | "tag" : "defaults", 24 | "description" : "Simply run with default settings", 25 | "inputA" : "Input/RA-Float.nrrd", 26 | "settings" : [], 27 | "tolerance" : 0.1 28 | } 29 | { 30 | "tag" : "longer", 31 | "description" : "Change number of iterations and timestep", 32 | "inputA" : "Input/RA-Float.nrrd", 33 | "settings" : [ 34 | { 35 | "parameter" : "TimeStep", 36 | "value" : 0.1 37 | }, 38 | { 39 | "parameter" : "NumberOfIterations", 40 | "value" : 10 41 | } 42 | ], 43 | "tolerance" : 0.1 44 | } 45 | ] 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /Code/BasicFilters/templates/sitkDualImageFilterTemplate.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __sitk${name}ImageFilter_h 2 | #define __sitk${name}ImageFilter_h 3 | 4 | $(include DoNotEditWarning.h.in) 5 | 6 | #include 7 | 8 | #include "sitkDualImageFilter.h" 9 | #include "sitkDualMemberFunctionFactory.h" 10 | $(include AddExtraIncludes.h.in) 11 | 12 | namespace itk { 13 | namespace simple { 14 | 15 | /** \class ${name}ImageFilter 16 | * 17 | * ${doc} 18 | */ 19 | $(include ClassDeclaration.h.in) 20 | $(include PublicDeclarations.h.in) 21 | $(include MemberGetSetDeclarations.h.in) 22 | $(include ClassNameAndPrint.h.in) 23 | 24 | $(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) 25 | 26 | private: 27 | /** Setup for member function dispatching */ 28 | typedef Image (Self::*MemberFunctionType)( const Image &, const Image & ); 29 | template Image DualExecuteInternal ( const Image& image1, const Image& image2 ); 30 | 31 | friend struct detail::DualExecuteInternalAddressor; 32 | std::auto_ptr > m_DualMemberFactory; 33 | 34 | 35 | $(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) 36 | 37 | 38 | $(include FunctionalAPI.h.in) 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/MinMaxCurvatureFlow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "MinMaxCurvatureFlow", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "RealPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "TimeStep", 10 | "type" : "double", 11 | "default" : 0.125, 12 | "doc" : "Time step for PDE solver" 13 | }, 14 | { 15 | "name" : "NumberOfIterations", 16 | "type" : "uint32_t", 17 | "default" : "5u", 18 | "doc" : "Number of iterations to run" 19 | } 20 | ] 21 | "tests" : [ 22 | { 23 | "tag" : "defaults", 24 | "description" : "Simply run with default settings", 25 | "inputA" : "Input/RA-Float.nrrd", 26 | "settings" : [], 27 | "tolerance" : 0.01, 28 | "md5hash" : null 29 | } 30 | { 31 | "tag" : "longer", 32 | "description" : "Change number of iterations and timestep", 33 | "inputA" : "Input/RA-Float.nrrd", 34 | "settings" : [ 35 | { 36 | "parameter" : "TimeStep", 37 | "value" : 0.1 38 | }, 39 | { 40 | "parameter" : "NumberOfIterations", 41 | "value" : 10 42 | } 43 | ], 44 | "tolerance" : 0.01, 45 | "md5hash" : null 46 | } 47 | ] 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Examples/SimpleGaussian.cxx: -------------------------------------------------------------------------------- 1 | 2 | // This one header will include all SimpleITK filters and external 3 | // objects. 4 | #include 5 | 6 | 7 | // create convenient namespace alias 8 | namespace sitk = itk::simple; 9 | 10 | int main ( int argc, char* argv[] ) { 11 | 12 | if ( argc < 4 ) { 13 | std::cerr << "Usage: " << argv[0] << " \n"; 14 | return 1; 15 | } 16 | 17 | // Read the image file 18 | sitk::ImageFileReader reader; 19 | reader.SetFileName ( std::string ( argv[1] ) ); 20 | sitk::Image image = reader.Execute(); 21 | 22 | // This filters perform a gaussian bluring with sigma in physical 23 | // space. The output image will be of real type. 24 | sitk::SmoothingRecursiveGaussianImageFilter gaussian; 25 | gaussian.SetSigma ( atof ( argv[2] ) ); 26 | sitk::Image blurredImage = gaussian.Execute ( image ); 27 | 28 | // Covert the real output image back to the original pixel type, to 29 | // make writing easier, as many file formats don't support real 30 | // pixels. 31 | sitk::CastImageFilter caster; 32 | caster.SetOutputPixelType( image.GetPixelIDValue() ); 33 | sitk::Image outputImage = caster.Execute( blurredImage ); 34 | 35 | // write the image 36 | sitk::ImageFileWriter writer; 37 | writer.SetFileName ( std::string ( argv[3] ) ); 38 | writer.Execute ( outputImage ); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Code/IO/sitkImageSeriesReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkImageSeriesReader_h 2 | #define __sitkImageSeriesReader_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkImage.h" 6 | #include "sitkImageReaderBase.h" 7 | #include "sitkMemberFunctionFactory.h" 8 | 9 | namespace itk { 10 | namespace simple { 11 | 12 | /** \class ImageSeriesReader 13 | * \brief Read series of image into a SimpleITK image 14 | * 15 | */ 16 | class ImageSeriesReader 17 | : public ImageReaderBase 18 | { 19 | public: 20 | typedef ImageSeriesReader Self; 21 | 22 | ImageSeriesReader(); 23 | 24 | Self& SetFileNames ( const std::vector &fns ); 25 | const std::vector &GetFileNames() const; 26 | 27 | Image Execute(); 28 | 29 | protected: 30 | 31 | template Image ExecuteInternal ( void ); 32 | 33 | private: 34 | 35 | // function pointer type 36 | typedef Image (Self::*MemberFunctionType)( void ); 37 | 38 | // friend to get access to executeInternal member 39 | friend struct detail::MemberFunctionAddressor; 40 | std::auto_ptr > m_MemberFactory; 41 | 42 | std::vector m_FileNames; 43 | }; 44 | Image ReadImage ( const std::vector &filenames ); 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/ClosingByReconstruction.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "ClosingByReconstruction", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "members" : [ 8 | { "name" : "FullyConnected", 9 | "type" : "bool", 10 | "default" : "false", 11 | "doc" : "" 12 | }, 13 | { 14 | "name" : "PreserveIntensities", 15 | "type" : "bool", 16 | "default" : "false", 17 | "doc" : "" 18 | } 19 | ], 20 | "custom_methods" : [], 21 | "tests" : [ 22 | { 23 | "tag" : "ClosingByReconstruction", 24 | "description" : "Test grayscale closing by reconstruction", 25 | "inputA" : "Input/STAPLE1.png", 26 | "md5hash" : "095f00a68a84df4396914fa758f34dcc", 27 | "settings" : [ 28 | { "parameter" : "KernelRadius", 29 | "no_get_method" : 1, 30 | "value" : 1 31 | }, 32 | { "parameter" : "KernelType", 33 | "value" : "itk::simple::${name}ImageFilter::Ball", 34 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 35 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 36 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 37 | "java_value" : "${name}ImageFilter.KernelType.Ball", 38 | "tcl_value" : "$$${name}ImageFilter_Ball" 39 | } 40 | ] 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/OpeningByReconstruction.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "OpeningByReconstruction", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "members" : [ 8 | { "name" : "FullyConnected", 9 | "type" : "bool", 10 | "default" : "false", 11 | "doc" : "" 12 | }, 13 | { 14 | "name" : "PreserveIntensities", 15 | "type" : "bool", 16 | "default" : "false", 17 | "doc" : "" 18 | } 19 | ], 20 | "custom_methods" : [], 21 | "tests" : [ 22 | { 23 | "tag" : "OpeningByReconstruction", 24 | "description" : "Test grayscale opening by reconstruction", 25 | "inputA" : "Input/STAPLE1.png", 26 | "md5hash" : "095f00a68a84df4396914fa758f34dcc", 27 | "settings" : [ 28 | { "parameter" : "KernelRadius", 29 | "no_get_method" : 1, 30 | "value" : 1 31 | }, 32 | { "parameter" : "KernelType", 33 | "value" : "itk::simple::${name}ImageFilter::Ball", 34 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 35 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 36 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 37 | "java_value" : "${name}ImageFilter.KernelType.Ball", 38 | "tcl_value" : "$$${name}ImageFilter_Ball" 39 | } 40 | ] 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryMorphologicalOpening.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryMorphologicalOpening", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "BackgroundValue", 10 | "type" : "double", 11 | "default" : "0", 12 | "doc" : "" 13 | }, 14 | { 15 | "name" : "ForegroundValue", 16 | "type" : "double", 17 | "default" : "255", 18 | "doc" : "" 19 | } 20 | ], 21 | "custom_methods" : [], 22 | "tests" : [ 23 | { 24 | "tag" : "BinaryMorphologicalOpening", 25 | "description" : "Test binary morphological opening", 26 | "inputA" : "Input/STAPLE1.png", 27 | "md5hash" : "bc97d7cbf9d3779070373f7a28b932a2" 28 | "settings" : [ 29 | { "parameter" : "KernelRadius", 30 | "no_get_method" : 1, 31 | "value" : 1 32 | }, 33 | { "parameter" : "KernelType", 34 | "value" : "itk::simple::${name}ImageFilter::Ball", 35 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 36 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 37 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 38 | "java_value" : "${name}ImageFilter.KernelType.Ball", 39 | "tcl_value" : "$$${name}ImageFilter_Ball" 40 | } 41 | ] 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/RecursiveGaussian.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "RecursiveGaussian", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "output_pixel_type" : "float", 8 | "public_declarations" : "typedef enum { ZeroOrder, FirstOrder, SecondOrder } OrderEnumType;" 9 | "members" : [ 10 | { 11 | "name" : "Sigma", 12 | "type" : "double", 13 | "default" : "1.0", 14 | "doc" : "" 15 | }, 16 | { 17 | "name" : "NormalizeAcrossScale", 18 | "type" : "bool", 19 | "default" : "0", 20 | "doc" : "" 21 | }, 22 | { 23 | "name" : "Order", 24 | "type" : "itk::simple::RecursiveGaussianImageFilter::OrderEnumType", 25 | "default" : "itk::simple::RecursiveGaussianImageFilter::ZeroOrder", 26 | "doc" : "" 27 | "custom_itk_cast" : "filter->SetOrder( static_cast( this->GetOrder()) );" 28 | }, 29 | { 30 | "name" : "Direction", 31 | "type" : "unsigned int", 32 | "default" : "0", 33 | "doc" : "" 34 | } 35 | ] 36 | "tests" : [ 37 | { 38 | "tag" : "default", 39 | "description" : "Simply run with default settings", 40 | "inputA" : "Input/RA-Float.nrrd", 41 | "settings" : [], 42 | "tolerance" : 0.0, 43 | "md5hash" : null 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /Code/IO/sitkImageFileReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkImageFileReader_h 2 | #define __sitkImageFileReader_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkImage.h" 6 | #include "sitkImageReaderBase.h" 7 | #include "sitkMemberFunctionFactory.h" 8 | 9 | namespace itk { 10 | namespace simple { 11 | 12 | /** \class ImageFileReader 13 | * \brief Read a 2D or 3D image and return a smart pointer to a SimpleITK 14 | * image 15 | * 16 | * This reader handles scalar and vector images and returns an image with 17 | * the same type as the file on disk. 18 | */ 19 | class ImageFileReader 20 | : public ImageReaderBase 21 | { 22 | public: 23 | typedef ImageFileReader Self; 24 | 25 | Self& SetFileName ( std::string fn ); 26 | std::string GetFileName(); 27 | Image Execute(); 28 | 29 | ImageFileReader(); 30 | 31 | protected: 32 | 33 | template Image ExecuteInternal ( void ); 34 | 35 | private: 36 | 37 | // function pointer type 38 | typedef Image (Self::*MemberFunctionType)( void ); 39 | 40 | // friend to get access to executeInternal member 41 | friend struct detail::MemberFunctionAddressor; 42 | std::auto_ptr > m_MemberFactory; 43 | 44 | std::string m_FileName; 45 | }; 46 | 47 | Image ReadImage ( std::string filename ); 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryThreshold.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryThreshold", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "doc" : "Docs", 6 | "pixel_types" : "BasicPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "LowerThreshold", 10 | "type" : "double", 11 | "default" : "0.0", 12 | "doc" : "" 13 | }, 14 | { 15 | "name" : "UpperThreshold", 16 | "type" : "double", 17 | "default" : "255.0", 18 | "doc" : "" 19 | }, 20 | { 21 | "name" : "InsideValue", 22 | "type" : "double", 23 | "default" : "1.0", 24 | "doc" : "" 25 | }, 26 | { 27 | "name" : "OutsideValue", 28 | "type" : "double", 29 | "default" : "0.0", 30 | "doc" : "" 31 | } 32 | ] 33 | "tests" : [ 34 | { 35 | "tag" : "default", 36 | "description" : "Default parameter settings", 37 | "inputA" : "Input/RA-Short.nrrd", 38 | "settings" : [], 39 | "md5hash" : "1c8530a8bf94201c6a36d194953e82c7" 40 | }, 41 | { 42 | "tag" : "NarrowThreshold", 43 | "description" : "Default parameter settings", 44 | "inputA" : "Input/RA-Short.nrrd", 45 | "settings" : [ 46 | { "parameter" : "LowerThreshold", "value" : 10 }, 47 | { "parameter" : "UpperThreshold", "value" : 100 } 48 | ], 49 | "md5hash" : "75dc50f4e860bf4e50f234e3adcb9057" 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /Utilities/Doxygen/Doxygen.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Build the documentation 3 | # 4 | 5 | option( BUILD_DOXYGEN "Build SimpleITK Doxygen" OFF ) 6 | 7 | if (BUILD_DOXYGEN) 8 | 9 | find_package( Doxygen ) 10 | 11 | # 12 | # Configure the script and the doxyfile, then add target 13 | # 14 | configure_file(${PROJECT_SOURCE_DIR}/Utilities/Doxygen/doxygen.config.in 15 | ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config) 16 | 17 | add_custom_command( OUTPUT "${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" 18 | COMMAND ${CMAKE_COMMAND} -D "PROJECT_SOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}" 19 | -D "OUTPUT_FILE:PATH=${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" 20 | -P "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" 21 | WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/Examples" 22 | DEPENDS "${PROJECT_SOURCE_DIR}/Examples" "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" 23 | ) 24 | 25 | add_custom_target(Documentation ALL 26 | COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config 27 | MAIN_DEPENDENCY ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config 28 | DEPENDS "${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" 29 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/Utilities/Doxygen 30 | ) 31 | 32 | message( STATUS 33 | "To generate Doxygen's documentation, you need to build the Documentation target" 34 | ) 35 | 36 | endif (BUILD_DOXYGEN) 37 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryContour.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryContour", 3 | "template_code_filename" : "ImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "FullyConnected", 10 | "type" : "bool", 11 | "default" : "false", 12 | "doc" : "" 13 | }, 14 | { 15 | "name" : "BackgroundValue", 16 | "type" : "double", 17 | "default" : "0", 18 | "doc" : "" 19 | }, 20 | { 21 | "name" : "ForegroundValue", 22 | "type" : "double", 23 | "default" : "255", 24 | "doc" : "" 25 | } 26 | ], 27 | "custom_methods" : [], 28 | "tests" : [ 29 | { 30 | "tag" : "default", 31 | "description" : "Simply run with default settings", 32 | "inputA" : "Input/WhiteDots.png", 33 | "md5hash" : "3921141f21fcb41e6d4af197e48ffbb5", 34 | "settings" : [ ] 35 | }, 36 | { 37 | "tag" : "custom", 38 | "description" : "Run binary mask on a single label", 39 | "inputA" : "Input/2th_cthead1.png", 40 | "md5hash" : "09212e4d204a0ed90a445dc832047b22", 41 | "settings" : [ 42 | { 43 | "parameter" : "ForegroundValue", 44 | "value" : "100" 45 | }, 46 | { 47 | "parameter" : "FullyConnected", 48 | "value" : "true", 49 | "python_value" : "True" 50 | } 51 | ] 52 | } 53 | ] 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryGrindPeak.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryGrindPeak", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "IntegerPixelIDTypeList", 8 | "filter_type" : "itk::BinaryGrindPeakImageFilter", 9 | "members" : [ 10 | { 11 | "name" : "FullyConnected", 12 | "type" : "bool", 13 | "default" : "false", 14 | "doc" : "" 15 | }, 16 | { 17 | "name" : "ForegroundValue", 18 | "type" : "double", 19 | "default" : "255", 20 | "doc" : "" 21 | }, 22 | { 23 | "name" : "BackgroundValue", 24 | "type" : "double", 25 | "default" : "0", 26 | "doc" : "" 27 | } 28 | ], 29 | "custom_methods" : [], 30 | "tests" : [ 31 | { 32 | "tag" : "BinaryGrindPeak1", 33 | "description" : "Test binary grind peak with default not fully connected", 34 | "inputA" : "Input/WhiteDots.png", 35 | "md5hash" : "5e9804e71397b0edc52bd5bc4f75f64a" 36 | "settings" : [ ] 37 | }, 38 | { 39 | "tag" : "BinaryGrindPeak2", 40 | "description" : "Test binary grind peak fully connected", 41 | "inputA" : "Input/WhiteDots.png", 42 | "md5hash" : "57c1ca7489d2ce0be262087e035f4c9e" 43 | "settings" : [ 44 | { "parameter" : "FullyConnected", 45 | "value" : "true", 46 | "python_value" : "True" 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/CurvatureFlow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "CurvatureFlow", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "output_pixel_type" : "typename itk::NumericTraits::RealType", 7 | "long" : 1, 8 | "doc" : "Some global documentation", 9 | "pixel_types" : "BasicPixelIDTypeList", 10 | "members" : [ 11 | { "name" : "TimeStep", 12 | "type" : "double", 13 | "default" : 0.1, 14 | "doc" : "Time step for curvature flow" 15 | }, 16 | { 17 | "name" : "NumberOfIterations", 18 | "type" : "uint32_t", 19 | "default" : "5u", 20 | "doc" : "Number of iterations to run" 21 | } 22 | ] 23 | "tests" : [ 24 | { 25 | "tag" : "defaults", 26 | "description" : "Simply run with default settings", 27 | "inputA" : "Input/RA-Float.nrrd", 28 | "settings" : [], 29 | "tolerance" : 0.0, 30 | "md5hash" : null 31 | } 32 | { 33 | "tag" : "longer", 34 | "description" : "Change number of iterations and timestep", 35 | "inputA" : "Input/RA-Float.nrrd", 36 | "settings" : [ 37 | { 38 | "parameter" : "TimeStep", 39 | "value" : 0.1 40 | }, 41 | { 42 | "parameter" : "NumberOfIterations", 43 | "value" : 10 44 | } 45 | ], 46 | "tolerance" : "0.0", 47 | "md5hash" : null 48 | } 49 | ] 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Code/Registration/sitkLinearInterpolate.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkLinearInterpolate_h 2 | #define __sitkLinearInterpolate_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkDetail.h" 6 | #include "sitkImage.h" 7 | #include "itkLinearInterpolateImageFunction.h" 8 | #include "sitkMemberFunctionFactory.h" 9 | #include "sitkInterpolate.h" 10 | 11 | namespace itk 12 | { 13 | namespace simple 14 | { 15 | class LinearInterpolate : public Interpolate 16 | { 17 | public: 18 | LinearInterpolate(); 19 | ::itk::Object::Pointer GetInterpolator ( const Image &image ); 20 | protected: 21 | template 22 | ::itk::Object::Pointer GetInterpolatorInternal ( const Image & image ); 23 | 24 | template < class TMemberFunctionPointer > 25 | struct GetInterpolatorMemberFunctionAddressor 26 | { 27 | typedef typename ::detail::FunctionTraits::ClassType ObjectType; 28 | 29 | template< typename TImage > 30 | TMemberFunctionPointer operator() ( void ) const 31 | { 32 | return &ObjectType::template GetInterpolatorInternal < TImage >; 33 | } 34 | }; 35 | 36 | typedef ::itk::Object::Pointer (LinearInterpolate::*MemberFunctionType)( const Image &image ); 37 | friend struct GetInterpolatorMemberFunctionAddressor; 38 | std::auto_ptr > m_MemberFactory; 39 | virtual Interpolate* Clone() { return new LinearInterpolate ( *this ); }; 40 | }; 41 | } 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /Code/Registration/sitkLinearInterpolate.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkLinearInterpolate.h" 2 | #include "itkImage.h" 3 | #include "itkLinearInterpolateImageFunction.h" 4 | namespace itk 5 | { 6 | namespace simple 7 | { 8 | LinearInterpolate::LinearInterpolate() 9 | { 10 | m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); 11 | m_MemberFactory->RegisterMemberFunctions > (); 12 | m_MemberFactory->RegisterMemberFunctions > (); 13 | } 14 | 15 | template 16 | ::itk::Object::Pointer LinearInterpolate::GetInterpolatorInternal (const Image& image ) 17 | { 18 | ::itk::Object::Pointer ptr; 19 | ptr = (::itk::Object*) (::itk::LinearInterpolateImageFunction::New()); 20 | return ptr; 21 | } 22 | 23 | ::itk::Object::Pointer LinearInterpolate::GetInterpolator ( const Image &image ) 24 | { 25 | const PixelIDValueType fixedType = image.GetPixelIDValue(); 26 | const unsigned int fixedDim = image.GetDimension(); 27 | if (this->m_MemberFactory->HasMemberFunction( fixedType, fixedDim ) ) 28 | { 29 | return this->m_MemberFactory->GetMemberFunction( fixedType, fixedDim )( image ); 30 | } 31 | sitkExceptionMacro( << "Filter does not support fixed image type: " << itk::simple::GetPixelIDValueAsString (fixedType) ); 32 | return NULL; 33 | } 34 | } 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/README: -------------------------------------------------------------------------------- 1 | README for Lua 5.1 2 | 3 | See INSTALL for installation instructions. 4 | See HISTORY for a summary of changes since the last released version. 5 | 6 | * What is Lua? 7 | ------------ 8 | Lua is a powerful, light-weight programming language designed for extending 9 | applications. Lua is also frequently used as a general-purpose, stand-alone 10 | language. Lua is free software. 11 | 12 | For complete information, visit Lua's web site at http://www.lua.org/ . 13 | For an executive summary, see http://www.lua.org/about.html . 14 | 15 | Lua has been used in many different projects around the world. 16 | For a short list, see http://www.lua.org/uses.html . 17 | 18 | * Availability 19 | ------------ 20 | Lua is freely available for both academic and commercial purposes. 21 | See COPYRIGHT and http://www.lua.org/license.html for details. 22 | Lua can be downloaded at http://www.lua.org/download.html . 23 | 24 | * Installation 25 | ------------ 26 | Lua is implemented in pure ANSI C, and compiles unmodified in all known 27 | platforms that have an ANSI C compiler. In most Unix-like platforms, simply 28 | do "make" with a suitable target. See INSTALL for detailed instructions. 29 | 30 | * Origin 31 | ------ 32 | Lua is developed at Lua.org, a laboratory of the Department of Computer 33 | Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro 34 | in Brazil). 35 | For more information about the authors, see http://www.lua.org/authors.html . 36 | 37 | (end of README) 38 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/IntensityWindowing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "IntensityWindowing", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Some global documentation", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "members" : [ 9 | { "name" : "WindowMinimum", 10 | "type" : "double", 11 | "default" : 0.0, 12 | "doc" : "Window minimum" 13 | }, 14 | { "name" : "WindowMaximum", 15 | "type" : "double", 16 | "default" : 255.0, 17 | "doc" : "Window maximum" 18 | }, 19 | { "name" : "OutputMinimum", 20 | "type" : "double", 21 | "default" : 0.0, 22 | "doc" : "Output minimum" 23 | }, 24 | { "name" : "OutputMaximum", 25 | "type" : "double", 26 | "default" : 255.0, 27 | "doc" : "Output maximum" 28 | } 29 | ], 30 | "tests" : [ 31 | { 32 | "tag" : "2d", 33 | "description" : "2D", 34 | "inputA" : "Input/STAPLE1.png", 35 | "settings" : [], 36 | "md5hash" : "095f00a68a84df4396914fa758f34dcc" 37 | }, 38 | { 39 | "tag" : "3dFloat", 40 | "description" : "3D", 41 | "inputA" : "Input/RA-Float.nrrd", 42 | "settings" : [], 43 | "md5hash" : "199c966fabac791c758766e14df9974c" 44 | }, 45 | { 46 | "tag" : "3dShort", 47 | "description" : "3D", 48 | "inputA" : "Input/RA-Short.nrrd", 49 | "settings" : [], 50 | "md5hash" : "2790c2bdfeb8610821e9ec8751f95516" 51 | } 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /Code/BasicFilters/templates/sitkImageFilterTemplate.cxx.in: -------------------------------------------------------------------------------- 1 | $(include DoNotEditWarning.cxx.in) 2 | 3 | $(include StandardIncludes.cxx.in) 4 | 5 | namespace itk { 6 | namespace simple { 7 | 8 | //----------------------------------------------------------------------------- 9 | 10 | // 11 | // Default constructor that initializes parameters 12 | // 13 | $(include ConstructorSignature.cxx.in) 14 | { 15 | $(include ConstructorInitializeMembers.cxx.in) 16 | $(include ConstructorMemberFunctionSetup.cxx.in) 17 | 18 | $(include ConstructorVectorPixels.cxx.in) 19 | } 20 | 21 | // 22 | // ToString 23 | // 24 | $(include ToStringSignature.cxx.in) 25 | { 26 | $(include ToStringBody.cxx.in) 27 | $(include ToStringReturn.cxx.in) 28 | } 29 | 30 | // 31 | // Execute 32 | //$(include ExecuteWithParameters.cxx.in) 33 | $(include ExecuteNoParameters.cxx.in) 34 | 35 | //----------------------------------------------------------------------------- 36 | 37 | // 38 | // ExecuteInternal 39 | // 40 | $(include ExecuteInternalSignature.cxx.in) 41 | { 42 | $(include ExecuteInternalTypedefs.cxx.in) 43 | 44 | $(include ExecuteInternalGetImagePointers.cxx.in) 45 | 46 | $(include ExecuteInternalITKFilter.cxx.in) 47 | 48 | $(include ExecuteInternalSetITKFilterInputs.cxx.in) 49 | $(include ExecuteInternalUpdateAndReturn.cxx.in) 50 | } 51 | 52 | //----------------------------------------------------------------------------- 53 | 54 | $(include ExecuteInternalVectorImages.cxx.in) 55 | $(include FunctionalAPI.cxx.in) 56 | 57 | } // end namespace simple 58 | } // end namespace itk 59 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/BinaryErode.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "BinaryErode", 3 | "template_code_filename" : "KernelImageFilter", 4 | "number_of_inputs" : 1, 5 | "doc" : "Performs Erosion in a binary image.", 6 | "pixel_types" : "IntegerPixelIDTypeList", 7 | "members" : [ 8 | { 9 | "name" : "BackgroundValue", 10 | "type" : "double", 11 | "default" : "0", 12 | "doc" : "" 13 | }, 14 | { 15 | "name" : "ForegroundValue", 16 | "type" : "double", 17 | "default" : "255", 18 | "doc" : "" 19 | }, 20 | { 21 | "name" : "BoundaryToForeground", 22 | "type" : "bool", 23 | "default" : "true", 24 | "doc" : "" 25 | } 26 | ], 27 | "custom_methods" : [], 28 | "tests" : [ 29 | { 30 | "tag" : "BinaryErode", 31 | "description" : "Test binary erosion", 32 | "inputA" : "Input/STAPLE1.png", 33 | "md5hash" : "9e37516c795d7f25847851666ef53ef9", 34 | "settings" : [ 35 | { "parameter" : "KernelRadius", 36 | "no_get_method" : 1, 37 | "value" : 1 38 | }, 39 | { "parameter" : "KernelType", 40 | "value" : "itk::simple::${name}ImageFilter::Ball", 41 | "lua_value" : "SimpleITK.${name}ImageFilter_Ball", 42 | "python_value" : "SimpleITK.${name}ImageFilter.Ball", 43 | "ruby_value" : "Simpleitk::${name}ImageFilter::Ball", 44 | "java_value" : "${name}ImageFilter.KernelType.Ball", 45 | "tcl_value" : "$$${name}ImageFilter_Ball" 46 | } 47 | ] 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /Code/Common/sitkEnableIf.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkEnableIf_h 2 | #define __sitkEnableIf_h 3 | 4 | namespace itk 5 | { 6 | namespace simple 7 | { 8 | 9 | /* \brief This is an implementation of the enable if idiom. 10 | * 11 | * This template enables specialization of a templated function based 12 | * on some traits or concepts. It is implemented with SFINAE. 13 | * 14 | * If the parameter V is true then the Type trait is the second 15 | * template parameter, otherwise an implementation does not exist and 16 | * with SFIANE another implementation may be choosen. 17 | * 18 | * Example: 19 | * \code 20 | * template 21 | * typename EnableIf::Value>::Type 22 | * AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth ); 23 | * 24 | * template 25 | * typename EnableIf::Value>::Type 26 | * AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth ); 27 | * \endcode 28 | * 29 | */ 30 | template struct EnableIf {}; 31 | /** \cond SPECIALIZATION_IMPLEMENTATION */ 32 | template struct EnableIf { typedef T Type; }; 33 | /**\endcond*/ 34 | 35 | 36 | /* \brief An implementation of the negation of the enable if idiom. 37 | * 38 | * \sa EnableIf 39 | */ 40 | template struct DisableIf {}; 41 | /** \cond SPECIALIZATION_IMPLEMENTATION */ 42 | template struct DisableIf { typedef T Type; }; 43 | /**\endcond*/ 44 | 45 | } 46 | } 47 | 48 | #endif // __sitkEnableIf_h 49 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/Flip.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Flip", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "filter_type" : "itk::FlipImageFilter< InputImageType >", 9 | "members" : [ 10 | { 11 | "dim_vec" : 1, 12 | "name" : "FlipAxes", 13 | "type" : "std::vector", 14 | "default" : "std::vector(3, false)", 15 | "doc" : "", 16 | "itk_type" : "typename FilterType::FlipAxesArrayType" 17 | }, 18 | { 19 | "name" : "FlipAboutOrigin", 20 | "type" : "bool", 21 | "default" : "false", 22 | "doc" : "" 23 | } 24 | ], 25 | "tests" : [ 26 | { 27 | "tag" : "default", 28 | "description" : "Test Flip with default, should be the same as input image", 29 | "inputA" : "Input/RA-Short.nrrd", 30 | "md5hash" : "a963bd6a755b853103a2d195e01a50d3", 31 | "settings" : [ 32 | ] 33 | }, 34 | { 35 | "tag" : "more", 36 | "description" : "Another test", 37 | "inputA" : "Input/RA-Float.nrrd", 38 | "md5hash" : "4cb0ddf2b3ac01d997f38e581635cb65", 39 | "settings" : [ 40 | { 41 | "parameter" : "FlipAxes", 42 | "type" : "bool", 43 | "dim_vec" : 1, 44 | "value" : "{ true, false, true }", 45 | "tcl_value" : "[list 1 0 1]", 46 | "python_value" : "[1, 0, 1]", 47 | "ruby_value" : "[ 1, 0, 1 ]" 48 | } 49 | ] 50 | } 51 | ] 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Code/Common/sitkExceptionObject.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkExceptionObject_h 2 | #define __sitkExceptionObject_h 3 | 4 | #include "itkMacro.h" 5 | #include "itkExceptionObject.h" 6 | 7 | namespace itk 8 | { 9 | namespace simple 10 | { 11 | 12 | /** \class GenericException 13 | * \brief The base SimpleITK exception class 14 | */ 15 | class GenericException : 16 | public ::itk::ExceptionObject 17 | { 18 | public: 19 | /** Default constructor. Needed to ensure the exception object can be 20 | * copied. */ 21 | GenericException():ExceptionObject() {} 22 | 23 | /** Constructor. Needed to ensure the exception object can be copied. */ 24 | GenericException(const char *file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {} 25 | 26 | /** Constructor. Needed to ensure the exception object can be copied. */ 27 | GenericException(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {} 28 | 29 | /** Constructor. Needed to ensure the exception object can be copied. */ 30 | GenericException(const std::string & file, 31 | unsigned int lineNumber, 32 | const std::string & desc, 33 | const std::string & loc):ExceptionObject(file, lineNumber, desc, loc) {} 34 | 35 | /** Virtual destructor needed for subclasses. Has to have empty throw(). */ 36 | virtual ~GenericException() 37 | throw( ) {} 38 | 39 | virtual const char * GetNameOfClass() const 40 | { return "GenericException"; } 41 | }; 42 | 43 | } 44 | } 45 | 46 | #endif // __sitkExceptionObject_h 47 | -------------------------------------------------------------------------------- /Wrapping/AssemblyInfo.cs.in: -------------------------------------------------------------------------------- 1 | #region Copyright (c) Insight Software Consortium. 2 | // 3 | // Copyright (c) Insight Software Consortium. All rights reserved. 4 | // See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 5 | // 6 | // This software is distributed WITHOUT ANY WARRANTY; without even 7 | // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 8 | // PURPOSE. See the above copyright notices for more information. 9 | // 10 | #endregion 11 | 12 | using System.Reflection; 13 | using System.Runtime.CompilerServices; 14 | 15 | [assembly: AssemblyVersion("@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@")] 16 | [assembly: AssemblyTitle("@PROJECT_NAME@ .NET Wrapper @ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@")] 17 | [assembly: AssemblyCopyright("Copyright (c) Insight Software Consortium")] 18 | [assembly: AssemblyDescription("@PROJECT_NAME@ .NET Wrapper @ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@ generated using @CMAKE_GENERATOR@")] 19 | [assembly: AssemblyCompany("Insight Software Consortium")] 20 | [assembly: AssemblyFileVersion("@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@")] 21 | [assembly: AssemblyCulture("")] 22 | [assembly: AssemblyTrademark("@PROJECT_NAME@")] 23 | [assembly: AssemblyProduct("@PROJECT_NAME@")] 24 | [assembly: AssemblyInformationalVersion("@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@")] 25 | [assembly: AssemblyConfiguration("")] 26 | [assembly: AssemblyDelaySign(false)] 27 | [assembly: AssemblyKeyName("")] 28 | [assembly: AssemblyKeyFile("")] -------------------------------------------------------------------------------- /Code/IO/sitkImageFileWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkImageFileWriter_h 2 | #define __sitkImageFileWriter_h 3 | 4 | #include "sitkMacro.h" 5 | #include "sitkImage.h" 6 | #include "sitkMemberFunctionFactory.h" 7 | 8 | #include 9 | 10 | namespace itk { 11 | namespace simple { 12 | 13 | /** \class ImageFileWriter 14 | * \brief Write out a SimpleITK image to the specified file location 15 | * 16 | * This writer tries to write the image out using the image's type to the 17 | * location specified in FileName. If writing fails, an ITK exception is 18 | * thrown. 19 | */ 20 | class ImageFileWriter { 21 | public: 22 | typedef ImageFileWriter Self; 23 | 24 | // function pointer type 25 | typedef Self& (Self::*MemberFunctionType)( const Image& ); 26 | 27 | // list of pixel types supported 28 | typedef NonLabelPixelIDTypeList PixelIDTypeList; 29 | 30 | ImageFileWriter( void ); 31 | 32 | Self& SetFileName ( std::string fn ); 33 | std::string GetFileName(); 34 | 35 | Self& Execute ( const Image& ); 36 | 37 | private: 38 | 39 | template Self& ExecuteInternal ( const Image& ); 40 | 41 | std::string m_FileName; 42 | 43 | // friend to get access to executeInternal member 44 | friend struct detail::MemberFunctionAddressor; 45 | 46 | std::auto_ptr > m_MemberFactory; 47 | 48 | }; 49 | void WriteImage ( const Image& image, std::string filename ); 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Testing/Unit/GoogleTest/COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/ShapeDetectionLevelSet.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "ShapeDetectionLevelSet", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Level Set filter that uses propagation and curvature terms.", 7 | "pixel_types" : "RealPixelIDTypeList", 8 | "filter_type" : "itk::ShapeDetectionLevelSetImageFilter" 9 | "custom_itk_cast" : "filter->SetFeatureImage( image2 );" 10 | "members" : [ 11 | { "name" : "MaximumRMSError", 12 | "type" : "double", 13 | "default" : 0.01, 14 | "doc" : "Value of RMS change below which the filter should stop. This is a convergence criterion." 15 | }, 16 | { "name" : "PropagationScaling", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "Weight of direct propagation contribution to the speed term" 20 | }, 21 | { "name" : "CurvatureScaling", 22 | "type" : "double", 23 | "default" : 1.0, 24 | "doc" : "Weight of the curvature contribution to the speed term" 25 | }, 26 | { 27 | "name" : "NumberOfIterations", 28 | "type" : "uint32_t", 29 | "default" : "50u", 30 | "doc" : "Number of iterations to run" 31 | } 32 | 33 | ] 34 | "tests" : [ 35 | { 36 | "tag" : "defaults", 37 | "description" : "Simply run with default settings", 38 | "inputA" : "Input/SmallWhiteCircle_Float.nrrd", 39 | "inputB" : "Input/LargeWhiteCircle_Float.nrrd", 40 | "settings" : [], 41 | "tolerance" : 0.1 42 | } 43 | ] 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Utilities/Doxygen/GenerateExamplesDox.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Usage: cmake -D "PROJECT_SOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}" 3 | # -D "OUTPUT_FILE:PATH=${PROJECT_BINARY_DIR}/Examples.dox" 4 | # -P GenerateExamplesDox.cmake 5 | 6 | # This cmake script gets a lists of example for the project and 7 | # generate a file suitable for doxygen. The file is a list of 8 | # "\examples filename", where doxygen will search for fileanme in it's 9 | # example path. Doxygen should then generate an examples page with the 10 | # referenced files. 11 | 12 | # glob the examples for each language 13 | file( GLOB_RECURSE EXAMPLES_CXX RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.cxx" ) 14 | file( GLOB_RECURSE EXAMPLES_PYTHON RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.py" ) 15 | file( GLOB_RECURSE EXAMPLES_JAVA RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.java" ) 16 | file( GLOB_RECURSE EXAMPLES_TCL RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.tcl" ) 17 | file( GLOB_RECURSE EXAMPLES_RUBY RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.rb" ) 18 | file( GLOB_RECURSE EXAMPLES_R RELATIVE "${PROJECT_SOURCE_DIR}/Examples" "*.R" ) 19 | 20 | # append the lists together 21 | set( EXAMPLES_LIST "${EXAMPLES_CXX};${EXAMPLES_PYTHON};${EXAMPLES_JAVA};${EXAMPLES_TCL};${EXAMPLES_RUBY};${EXAMPLES_R}" ) 22 | 23 | # remove the file before we begin appending 24 | file( REMOVE ${OUTPUT_FILE} ) 25 | 26 | # begin comment 27 | file( APPEND ${OUTPUT_FILE} "/**\n") 28 | 29 | FOREACH( f IN LISTS EXAMPLES_LIST ) 30 | file( APPEND ${OUTPUT_FILE} "\\example ${f}\n" ) 31 | ENDFOREACH( f IN LIST EXAMPLES_LIST ) 32 | 33 | # end comment 34 | file( APPEND ${OUTPUT_FILE} "*/\n" ) -------------------------------------------------------------------------------- /Testing/Unit/TypeListsTests.cxx: -------------------------------------------------------------------------------- 1 | #include "SimpleITKTestHarness.h" 2 | #include 3 | 4 | class TypeListTest 5 | : public ::testing::Test 6 | { 7 | public: 8 | TypeListTest() {}; 9 | struct CountPredicate 10 | { 11 | CountPredicate( void ) : count(0) {} 12 | 13 | template 14 | void operator()( void ) 15 | { 16 | ++count; 17 | } 18 | 19 | template 20 | void operator()( void ) 21 | { 22 | ++count; 23 | } 24 | 25 | template 26 | void operator()( void ) const 27 | { 28 | ++count; 29 | } 30 | 31 | template 32 | void operator()( void ) const 33 | { 34 | ++count; 35 | std::cout << typeid(TType1).name() << " " << typeid( TType2 ).name() << std::endl; 36 | } 37 | 38 | mutable int count; 39 | }; 40 | 41 | CountPredicate pred; 42 | const CountPredicate constPred; 43 | }; 44 | 45 | 46 | TEST_F(TypeListTest, Visit) { 47 | 48 | typedef typelist::MakeTypeList::Type MyTypeList; 49 | 50 | typelist::Visit ListVisitor; 51 | ListVisitor( pred ); 52 | ListVisitor( constPred ); 53 | 54 | EXPECT_EQ( pred.count, 3 ); 55 | EXPECT_EQ( constPred.count, 3 ); 56 | 57 | } 58 | 59 | TEST_F(TypeListTest, DualVisit) { 60 | 61 | typedef typelist::MakeTypeList::Type MyTypeList; 62 | 63 | typelist::DualVisit ListVisitor; 64 | ListVisitor( pred ); 65 | ListVisitor( constPred ); 66 | 67 | EXPECT_EQ( pred.count, 9 ); 68 | EXPECT_EQ( constPred.count, 9 ); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Lua License 2 | ----------- 3 | 4 | Lua is licensed under the terms of the MIT license reproduced below. 5 | This means that Lua is free software and can be used for both academic 6 | and commercial purposes at absolutely no cost. 7 | 8 | For details and rationale, see http://www.lua.org/license.html . 9 | 10 | =============================================================================== 11 | 12 | Copyright (C) 1994-2008 Lua.org, PUC-Rio. 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | =============================================================================== 33 | 34 | (end of COPYRIGHT) 35 | -------------------------------------------------------------------------------- /Code/BasicFilters/include/sitkStatisticsImageFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkStatisticsImageFilter_h 2 | #define __sitkStatisticsImageFilter_h 3 | 4 | #include "sitkImageFilter.h" 5 | 6 | 7 | namespace itk { 8 | namespace simple { 9 | 10 | /** \class StatisticsImageFilter 11 | * \brief Compute min, max, variance, and mean of an image 12 | */ 13 | class StatisticsImageFilter : public ImageFilter { 14 | public: 15 | typedef StatisticsImageFilter Self; 16 | 17 | /** 18 | * Default Constructor that takes no arguments and initializes 19 | * default parameters 20 | */ 21 | StatisticsImageFilter(); 22 | 23 | typedef BasicPixelIDTypeList PixelIDTypeList; 24 | 25 | /** Name of this class */ 26 | std::string GetName() const { return std::string ( "Statistics"); } 27 | 28 | // Print ourselves out 29 | std::string ToString() const; 30 | 31 | Image Execute ( const Image & ); 32 | double GetMinimum() { return this->m_Minimum; } 33 | double GetMaximum() { return this->m_Maximum; } 34 | double GetMean() { return this->m_Mean; } 35 | double GetVariance() { return this->m_Variance; } 36 | private: 37 | 38 | typedef Image (Self::*MemberFunctionType)( const Image& ); 39 | template Image ExecuteInternal ( const Image& image ); 40 | friend struct detail::MemberFunctionAddressor; 41 | std::auto_ptr > m_MemberFactory; 42 | 43 | double m_Minimum; 44 | double m_Maximum; 45 | double m_Mean; 46 | double m_Variance; 47 | 48 | }; 49 | 50 | 51 | } 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /Code/Registration/sitkMattesMutualInformationMetric.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkMattesMutualInformationMetric_h 2 | #define __sitkMattesMutualInformationMetric_h 3 | 4 | #include "sitkMacro.h" 5 | 6 | #include "sitkDetail.h" 7 | #include "sitkImage.h" 8 | #include "sitkPixelIDTokens.h" 9 | #include "sitkMetric.h" 10 | #include "itkMattesMutualInformationImageToImageMetric.h" 11 | #include "sitkMemberFunctionFactory.h" 12 | 13 | #include 14 | 15 | namespace itk 16 | { 17 | namespace simple 18 | { 19 | 20 | class MattesMutualInformationMetric : public Metric 21 | { 22 | public: 23 | MattesMutualInformationMetric(); 24 | virtual ::itk::SingleValuedCostFunction::Pointer GetMetric ( const Image &image ); 25 | 26 | protected: 27 | template 28 | ::itk::SingleValuedCostFunction::Pointer GetMetricInternal ( const Image &image ); 29 | 30 | template < class TMemberFunctionPointer > 31 | struct GetMetricMemberFunctionAddressor 32 | { 33 | typedef typename ::detail::FunctionTraits::ClassType ObjectType; 34 | 35 | template< typename TImage > 36 | TMemberFunctionPointer operator() ( void ) const 37 | { 38 | return &ObjectType::template GetMetricInternal < TImage >; 39 | } 40 | }; 41 | 42 | typedef ::itk::SingleValuedCostFunction::Pointer (MattesMutualInformationMetric::*MemberFunctionType)( const Image &image ); 43 | friend struct GetMetricMemberFunctionAddressor; 44 | std::auto_ptr > m_MemberFactory; 45 | virtual Metric* Clone() { return new MattesMutualInformationMetric ( *this ); } 46 | }; 47 | } 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Code/Common/sitkDetail.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkDetail_h 2 | #define __sitkDetail_h 3 | 4 | #include "sitkMemberFunctionFactoryBase.h" 5 | #include "FunctionTraits.h" 6 | 7 | namespace itk { 8 | namespace simple { 9 | 10 | // this namespace is internal classes not part of the external simple ITK interface 11 | namespace detail { 12 | 13 | 14 | template < class TMemberFunctionPointer > 15 | struct MemberFunctionAddressor 16 | { 17 | typedef typename ::detail::FunctionTraits::ClassType ObjectType; 18 | 19 | template< typename TImageType > 20 | TMemberFunctionPointer operator() ( void ) const 21 | { 22 | return &ObjectType::template ExecuteInternal< TImageType >; 23 | } 24 | }; 25 | 26 | template < class TMemberFunctionPointer > 27 | struct DualExecuteInternalAddressor 28 | { 29 | typedef typename ::detail::FunctionTraits::ClassType ObjectType; 30 | 31 | template< typename TImageType1, typename TImageType2 > 32 | TMemberFunctionPointer operator() ( void ) const 33 | { 34 | return &ObjectType::template DualExecuteInternal< TImageType1, TImageType2 >; 35 | } 36 | }; 37 | 38 | /** An addressor of ExecuteInternalCast to be utilized with 39 | * registering member functions with the factory. 40 | */ 41 | template < class TMemberFunctionPointer > 42 | struct ExecuteInternalVectorImageAddressor 43 | { 44 | typedef typename ::detail::FunctionTraits::ClassType ObjectType; 45 | 46 | template< typename TImageType > 47 | TMemberFunctionPointer operator() ( void ) const 48 | { 49 | return &ObjectType::template ExecuteInternalVectorImage< TImageType >; 50 | } 51 | }; 52 | 53 | 54 | } 55 | } 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /Code/Registration/sitkMattesMutualInformationMetric.cxx: -------------------------------------------------------------------------------- 1 | #include "sitkMattesMutualInformationMetric.h" 2 | 3 | namespace itk 4 | { 5 | namespace simple 6 | { 7 | MattesMutualInformationMetric::MattesMutualInformationMetric() { 8 | m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); 9 | // cast between basic images 10 | m_MemberFactory->RegisterMemberFunctions > (); 11 | m_MemberFactory->RegisterMemberFunctions > (); 12 | } 13 | 14 | 15 | 16 | template 17 | ::itk::SingleValuedCostFunction::Pointer MattesMutualInformationMetric::GetMetricInternal ( const Image &image ) 18 | { 19 | typename ::itk::MattesMutualInformationImageToImageMetric::Pointer metric = ::itk::MattesMutualInformationImageToImageMetric::New(); 20 | metric->SetNumberOfHistogramBins ( 128 ); 21 | metric->SetNumberOfSpatialSamples( 1000000 ); 22 | return metric.GetPointer(); 23 | } 24 | 25 | ::itk::SingleValuedCostFunction::Pointer MattesMutualInformationMetric::GetMetric ( const Image &image ) 26 | { 27 | const PixelIDValueType fixedType = image.GetPixelIDValue(); 28 | const unsigned int fixedDim = image.GetDimension(); 29 | if (this->m_MemberFactory->HasMemberFunction( fixedType, fixedDim ) ) 30 | { 31 | return this->m_MemberFactory->GetMemberFunction( fixedType, fixedDim )( image ); 32 | } 33 | 34 | sitkExceptionMacro( << "Filter does not support fixed image type: " << itk::simple::GetPixelIDValueAsString (fixedType) ); 35 | } 36 | } 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /Utilities/lua-5.1.4/src/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GrayscaleGeodesicDilate.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GrayscaleGeodesicDilate", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Input1 is input, Input2 is marker image", 7 | "pixel_types" : "BasicPixelIDTypeList", 8 | "filter_type" : "itk::GrayscaleGeodesicDilateImageFilter", 9 | "members" : [ 10 | { "name" : "RunOneIteration", 11 | "type" : "bool", 12 | "default" : "false", 13 | "doc" : "" 14 | }, 15 | { "name" : "FullyConnected", 16 | "type" : "bool", 17 | "default" : "false", 18 | "doc" : "" 19 | } 20 | ], 21 | "custom_methods" : [], 22 | "tests" : [ 23 | { 24 | "tag" : "GrayscaleGeodesicDilate1", 25 | "description" : "Test grayscale geodesic dilate", 26 | "inputA" : "Input/STAPLE1.png", 27 | "inputB" : "Input/STAPLE2.png", 28 | "md5hash" : "301858f5eee39b092d28d9837f008fb8" 29 | "settings" : [ 30 | { "parameter" : "RunOneIteration", "value" : "false", "python_value" : "False" }, 31 | { "parameter" : "FullyConnected", "value" : "true", "python_value" : "True" } 32 | ] 33 | } 34 | { 35 | "tag" : "GrayscaleGeodesicDilate2", 36 | "description" : "Test grayscale geodesic dilate, one iteration", 37 | "inputA" : "Input/STAPLE1.png", 38 | "inputB" : "Input/STAPLE2.png", 39 | "md5hash" : "512b043be99c423638db7cb7bc6fb2df" 40 | "settings" : [ 41 | { "parameter" : "RunOneIteration", "value" : "true", "python_value" : "True" }, 42 | { "parameter" : "FullyConnected", "value" : "true", "python_value" : "True" } 43 | ] 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /Code/Common/sitkNonCopyable.h: -------------------------------------------------------------------------------- 1 | #ifndef __sitkNonCopyable_h 2 | #define __sitkNonCopyable_h 3 | 4 | namespace itk 5 | { 6 | namespace simple 7 | { 8 | 9 | /** \class NonCopyable 10 | * \brief An inheratable class to disable copying of a class 11 | * 12 | * This class disable the implicit implementations of the assignment 13 | * and copy constructor for derived classes. The instantiation of the 14 | * default implementation for either method in a derived class will 15 | * result in a compile-time error because they are private in this 16 | * class. However, this policy is not absolute for derived classes 17 | * because explicit implementation of these methods could be 18 | * implemented. 19 | * 20 | * An advatange this apporach has is the class heiarchy makes it 21 | * obvious what the intent is, as compared to other appoaches. 22 | * 23 | * For example you should not be able to copy singleton object, because 24 | * there should only be one of them. To utilize this class just derive 25 | * from it: 26 | * \code 27 | * class Singleton 28 | * : protected NonCopyable {...}; 29 | * \endcode 30 | * 31 | */ 32 | class NonCopyable 33 | { 34 | protected: 35 | NonCopyable() {} 36 | private: 37 | NonCopyable &operator=( const NonCopyable & ); // Not implemented on purpose 38 | NonCopyable( const NonCopyable & ); // Not implemented on purpose 39 | }; 40 | 41 | #if SITK_EXPLICIT_DEFAULT_DELETE_FUNCTIONS 42 | 43 | // see other implementation for doxygen 44 | struct NonCopyable 45 | { 46 | NonCopyable() = default; 47 | NonCopyable &operator=( const NonCopyable & ) = delete; 48 | NonCopyable( const NonCopyable & ) = delete; 49 | }; 50 | 51 | #endif 52 | 53 | 54 | } // end namespace simple 55 | } // end namespace itk 56 | 57 | #endif // __sitkNonCopyable_h 58 | -------------------------------------------------------------------------------- /Documentation/Tutorials/Short/SimpleITKShortTutorial.tex: -------------------------------------------------------------------------------- 1 | \documentclass[18pt]{beamer} 2 | \usetheme{Madrid} 3 | 4 | \usepackage{graphics} 5 | 6 | 7 | \newcommand{\centeredlargetext}[3]{ 8 | { 9 | \setbeamertemplate{navigation symbols}{} 10 | \setbeamercolor{background canvas}{bg={#1}} 11 | \color{#2} 12 | \begin{frame}[plain] 13 | \fontsize{36pt}{36pt}\selectfont 14 | \center 15 | \begin{center} 16 | {#3} 17 | \end{center} 18 | \end{frame} 19 | }} 20 | 21 | \newcommand{\centeredhugetext}[3]{ 22 | { 23 | \setbeamertemplate{navigation symbols}{} 24 | \setbeamercolor{background canvas}{bg={#1}} 25 | \fontsize{72pt}{72pt}\selectfont 26 | \color{#2} 27 | \begin{frame}[plain] 28 | \center 29 | \begin{center} 30 | {#3} 31 | \end{center} 32 | \end{frame} 33 | }} 34 | 35 | 36 | \begin{document} 37 | 38 | \title[SimpleITK Tutorial]{SimpleITK - Short Tutorial} 39 | \subtitle[UH]{ITK for Human Beings} 40 | \institute[Insight Software Consortium]{Insight Software Consortium} 41 | \date[April 2011]{April 2011} 42 | 43 | \begin{frame} 44 | \titlepage 45 | \end{frame} 46 | 47 | 48 | { 49 | \setbeamertemplate{navigation symbols}{} 50 | \begin{frame}[plain] 51 | \center 52 | \begin{center} 53 | This presentation is copyrighted by\\ 54 | The \textbf{Insight Software Consortium}\\ 55 | \bigskip 56 | distributed under the\\ 57 | \textbf{Creative Commons by Attribution License 3.0}\\ 58 | \url{http://creativecommons.org/licenses/by/3.0}\\ 59 | \bigskip 60 | Images used in this presentation are attributed in the last slide. 61 | \end{center} 62 | \end{frame} 63 | } 64 | 65 | 66 | \begin{frame} 67 | \tableofcontents 68 | \end{frame} 69 | 70 | 71 | \centeredlargetext{black}{white}{ 72 | SimpleITK 73 | } 74 | 75 | 76 | \section{Introduction} 77 | 78 | \end{document} 79 | -------------------------------------------------------------------------------- /Documentation/Tutorials/Medium/SimpleITKMediumTutorial.tex: -------------------------------------------------------------------------------- 1 | \documentclass[18pt]{beamer} 2 | \usetheme{Madrid} 3 | 4 | \usepackage{graphics} 5 | 6 | 7 | \newcommand{\centeredlargetext}[3]{ 8 | { 9 | \setbeamertemplate{navigation symbols}{} 10 | \setbeamercolor{background canvas}{bg={#1}} 11 | \color{#2} 12 | \begin{frame}[plain] 13 | \fontsize{36pt}{36pt}\selectfont 14 | \center 15 | \begin{center} 16 | {#3} 17 | \end{center} 18 | \end{frame} 19 | }} 20 | 21 | \newcommand{\centeredhugetext}[3]{ 22 | { 23 | \setbeamertemplate{navigation symbols}{} 24 | \setbeamercolor{background canvas}{bg={#1}} 25 | \fontsize{72pt}{72pt}\selectfont 26 | \color{#2} 27 | \begin{frame}[plain] 28 | \center 29 | \begin{center} 30 | {#3} 31 | \end{center} 32 | \end{frame} 33 | }} 34 | 35 | 36 | \begin{document} 37 | 38 | \title[SimpleITK Tutorial]{SimpleITK - Short Tutorial} 39 | \subtitle[UH]{ITK for Human Beings} 40 | \institute[Insight Software Consortium]{Insight Software Consortium} 41 | \date[April 2011]{April 2011} 42 | 43 | \begin{frame} 44 | \titlepage 45 | \end{frame} 46 | 47 | 48 | { 49 | \setbeamertemplate{navigation symbols}{} 50 | \begin{frame}[plain] 51 | \center 52 | \begin{center} 53 | This presentation is copyrighted by\\ 54 | The \textbf{Insight Software Consortium}\\ 55 | \bigskip 56 | distributed under the\\ 57 | \textbf{Creative Commons by Attribution License 3.0}\\ 58 | \url{http://creativecommons.org/licenses/by/3.0}\\ 59 | \bigskip 60 | Images used in this presentation are attributed in the last slide. 61 | \end{center} 62 | \end{frame} 63 | } 64 | 65 | 66 | \begin{frame} 67 | \tableofcontents 68 | \end{frame} 69 | 70 | 71 | \centeredlargetext{black}{white}{ 72 | SimpleITK 73 | } 74 | 75 | 76 | \section{Introduction} 77 | 78 | \end{document} 79 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/AddConstantTo.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "AddConstantTo", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Add a constont to an image. The result is cast to the type of the input", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "include_files" : ["sitkConditional.h", "sitkPixelIDTokens.h"] 9 | "additional_template_types" : [ 10 | { 11 | "type" : "typename itk::simple::Conditional< std::tr1::is_same<\ 12 | typename InputImageType::PixelType, std::complex >::value, float, double>::Type" 13 | } 14 | ] 15 | "members" : [ 16 | { "name" : "Constant", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "The constant to add to the input image" 20 | } 21 | ], 22 | "tests" : [ 23 | { 24 | "tag" : "2d", 25 | "description" : "2D", 26 | "inputA" : "Input/STAPLE1.png", 27 | "settings" : [ 28 | { "parameter" : "Constant", 29 | "value" : 2.5 30 | } 31 | ], 32 | "md5hash" : "b4c712db593e362886b93ebab60a3c4b" 33 | }, 34 | { 35 | "tag" : "3d", 36 | "description" : "3D", 37 | "inputA" : "Input/RA-Short.nrrd", 38 | "settings" : [ 39 | { "parameter" : "Constant", 40 | "value" : 2.5 41 | } 42 | ], 43 | "md5hash" : "bf48d507dca5e384f049112b145fd7df" 44 | }, 45 | { 46 | "tag" : "2d-rgb", 47 | "description" : "2D-RGB", 48 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 49 | "settings" : [ 50 | { "parameter" : "Constant", 51 | "value" : 2.1 52 | } 53 | ], 54 | "md5hash" : "0e9c1619ece767729fb8a92b3d5f2689" 55 | } 56 | ] 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Testing/Unit/CXXTests.cxx: -------------------------------------------------------------------------------- 1 | #include "SimpleITKTestHarness.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class CXX : public ExternalProgramRunner { 9 | }; 10 | 11 | 12 | TEST_F(CXX,SimpleGaussian) { 13 | // Run the simple gaussian command line program 14 | std::string output = dataFinder.GetOutputFile ( "CXX.SimpleGaussian.nrrd" ); 15 | std::vector CommandLine; 16 | 17 | std::string exe = dataFinder.FindExecutable ( "SimpleGaussian" ); 18 | ASSERT_TRUE ( dataFinder.FileExists ( exe ) ) << "Couldn't find " << exe; 19 | 20 | CommandLine.push_back ( exe ); 21 | CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); 22 | CommandLine.push_back ( "2.0" ); 23 | CommandLine.push_back ( output ); 24 | 25 | // Run it! 26 | RunExecutable ( CommandLine, true ); 27 | 28 | this->CheckImageHash( output, "02ce020f462cf05f3c354bc33a7834603d65b906" ); 29 | 30 | } 31 | 32 | TEST_F(CXX,SimpleGaussianFunctional) { 33 | // Run the simple gaussian command line program 34 | std::string output = dataFinder.GetOutputFile ( "CXX.SimpleGaussianFunctional.nrrd" ); 35 | std::vector CommandLine; 36 | 37 | std::string exe = dataFinder.FindExecutable ( "SimpleGaussianFunctional" ); 38 | ASSERT_TRUE ( dataFinder.FileExists ( exe ) ) << "Couldn't find " << exe; 39 | 40 | CommandLine.push_back ( exe ); 41 | CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); 42 | CommandLine.push_back ( "2.0" ); 43 | CommandLine.push_back ( output ); 44 | 45 | // Run it! 46 | RunExecutable ( CommandLine, true ); 47 | 48 | this->CheckImageHash( output, "02ce020f462cf05f3c354bc33a7834603d65b906" ); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/SubtractConstantFrom.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "SubtractConstantFrom", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Add a constont to an image. The result is cast to the type of the input", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "include_files" : ["sitkConditional.h", "sitkPixelIDTokens.h"] 9 | "additional_template_types" : [ 10 | { 11 | "type" : "typename itk::simple::Conditional< std::tr1::is_same<\ 12 | typename InputImageType::PixelType, std::complex >::value, float, double>::Type" 13 | } 14 | ] 15 | "members" : [ 16 | { "name" : "Constant", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "The constant to add to the input image" 20 | } 21 | ], 22 | "tests" : [ 23 | { 24 | "tag" : "2d", 25 | "description" : "2D", 26 | "inputA" : "Input/STAPLE1.png", 27 | "settings" : [ 28 | { "parameter" : "Constant", 29 | "value" : 2.5 30 | } 31 | ], 32 | "md5hash" : "c0ba759e85778b02dce170d887ffacc7" 33 | }, 34 | { 35 | "tag" : "3d", 36 | "description" : "3D", 37 | "inputA" : "Input/RA-Short.nrrd", 38 | "settings" : [ 39 | { "parameter" : "Constant", 40 | "value" : 2.5 41 | } 42 | ], 43 | "md5hash" : "8d51cc68efed4d9156c99625ceebe915" 44 | }, 45 | { 46 | "tag" : "2d-rgb", 47 | "description" : "2D-RGB", 48 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 49 | "settings" : [ 50 | { "parameter" : "Constant", 51 | "value" : 2.1 52 | } 53 | ], 54 | "md5hash" : "d635db8d63bcf3a1f257cb42e635ec47" 55 | } 56 | ] 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/DivideByConstant.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "DivideByConstant", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Divide an image by a constant. The result is cast to the type of the input", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "include_files" : ["sitkConditional.h", "sitkPixelIDTokens.h"] 9 | "additional_template_types" : [ 10 | { 11 | "type" : "typename itk::simple::Conditional< std::tr1::is_same<\ 12 | typename InputImageType::PixelType, std::complex >::value, float, double>::Type" 13 | } 14 | ] 15 | "members" : [ 16 | { "name" : "Constant", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "The constant by which to divide the input image" 20 | } 21 | ], 22 | "tests" : [ 23 | { 24 | "tag" : "2d", 25 | "description" : "2D", 26 | "inputA" : "Input/STAPLE1.png", 27 | "settings" : [ 28 | { "parameter" : "Constant", 29 | "value" : 1.0 30 | } 31 | ], 32 | "md5hash" : "095f00a68a84df4396914fa758f34dcc" 33 | }, 34 | { 35 | "tag" : "3d", 36 | "description" : "3D", 37 | "inputA" : "Input/RA-Short.nrrd", 38 | "settings" : [ 39 | { "parameter" : "Constant", 40 | "value" : 1.1 41 | } 42 | ], 43 | "md5hash" : "cf4013912737472a277e080cc1654c22" 44 | }, 45 | { 46 | "tag" : "2d-rgb", 47 | "description" : "3D-RGB", 48 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 49 | "settings" : [ 50 | { "parameter" : "Constant", 51 | "value" : 255 52 | } 53 | ], 54 | "md5hash" : "c0a4d7ab0b2fd17cce2de4ecd6f2bffe" 55 | } 56 | ] 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Testing/Unit/PythonImageFilterTestTemplate.py.in: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING: DO NOT EDIT THIS FILE! 3 | # THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLEITK BUILD PROCESS. 4 | # Please look at PythonImageFilterTestTemplate.py.in to make changes. 5 | # 6 | 7 | 8 | # This is Python code to test ${name} 9 | import SimpleITK 10 | import sys 11 | 12 | inputs = 1 13 | $(if number_of_inputs then 14 | OUT=[[inputs = ${number_of_inputs}]] 15 | end) 16 | 17 | if len ( sys.argv ) < inputs + 2: 18 | print ( "Usage: ${name} tag output" ) 19 | sys.exit ( 1 ) 20 | 21 | tag = sys.argv[1] 22 | 23 | reader = SimpleITK.ImageFileReader() 24 | writer = SimpleITK.ImageFileWriter() 25 | filter = SimpleITK.${name}ImageFilter() 26 | 27 | $(if #tests == 0 then 28 | OUT=[[ 29 | print ( "No tests defined!" ) 30 | sys.exit ( 1 ) 31 | ]] 32 | end) 33 | 34 | $(foreach tests 35 | if tag == "${tag}": 36 | $(when settings 37 | $(foreach settings 38 | $(if parameter == "SeedList" and python_value then 39 | OUT=[[ filter.ClearSeeds() 40 | filter$(for i=1,#python_value do OUT=OUT .. ".AddSeed( " .. python_value[i] .. " )" end)]] 41 | elseif parameter == "SeedList" then 42 | OUT=[[ filter.ClearSeeds() 43 | filter$(for i=1,#value do OUT=OUT .. ".AddSeed( " .. value[i] .. " )" end)]] 44 | else 45 | OUT=[[ 46 | filter.Set${parameter}( $(if python_value then OUT='${python_value}' else OUT='${value}' end) )]] 47 | end) 48 | ) 49 | ) 50 | inputA = reader.SetFileName ( sys.argv[2] ).Execute() 51 | $(if inputB then 52 | OUT=[[inputB = reader.SetFileName ( sys.argv[3] ).Execute() 53 | output = filter.Execute ( inputA, inputB )]] 54 | else 55 | OUT=[[output = filter.Execute ( inputA )]] 56 | end) 57 | writer.SetFileName ( sys.argv[-1] ).Execute ( output ) 58 | ) 59 | 60 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/MultiplyByConstant.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "MultiplyByConstant", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 1, 6 | "doc" : "Multiply an image by a constant. The result is cast to the type of the input", 7 | "pixel_types" : "NonLabelPixelIDTypeList", 8 | "include_files" : ["sitkConditional.h", "sitkPixelIDTokens.h"] 9 | "additional_template_types" : [ 10 | { 11 | "type" : "typename itk::simple::Conditional< std::tr1::is_same<\ 12 | typename InputImageType::PixelType, std::complex >::value, float, double>::Type" 13 | } 14 | ] 15 | "members" : [ 16 | { "name" : "Constant", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "The constant by which to multiply the input image" 20 | } 21 | ], 22 | "tests" : [ 23 | { 24 | "tag" : "2d", 25 | "description" : "2D", 26 | "inputA" : "Input/STAPLE1.png", 27 | "settings" : [ 28 | { "parameter" : "Constant", 29 | "value" : 2.5 30 | } 31 | ], 32 | "md5hash" : "d242fd1847eac0f3f8702ee6abf00624" 33 | }, 34 | { 35 | "tag" : "3d", 36 | "description" : "3D", 37 | "inputA" : "Input/RA-Short.nrrd", 38 | "settings" : [ 39 | { "parameter" : "Constant", 40 | "value" : 2.5 41 | } 42 | ], 43 | "md5hash" : "41eba4bd56f47a3122d9ca7e1a350bd7" 44 | }, 45 | { 46 | "tag" : "2d-rgb", 47 | "description" : "2D-RGB", 48 | "inputA" : "Input/VM1111Shrink-RGBFloat.nrrd", 49 | "settings" : [ 50 | { "parameter" : "Constant", 51 | "value" : 2.1 52 | } 53 | ], 54 | "md5hash" : "b6c08dc54ae9082d0823a9df7130bb9f" 55 | } 56 | ] 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Code/BasicFilters/json/GeodesicActiveContourLevelSet.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GeodesicActiveContourLevelSet", 3 | "template_code_filename" : "ImageFilter", 4 | "template_test_filename" : "ImageFilter", 5 | "number_of_inputs" : 2, 6 | "doc" : "Level Set filter that uses propagation, curvature and advection terms.", 7 | "pixel_types" : "RealPixelIDTypeList", 8 | "filter_type" : "itk::GeodesicActiveContourLevelSetImageFilter" 9 | "custom_itk_cast" : "filter->SetFeatureImage( image2 );" 10 | "members" : [ 11 | { "name" : "MaximumRMSError", 12 | "type" : "double", 13 | "default" : 0.01, 14 | "doc" : "Value of RMS change below which the filter should stop. This is a convergence criterion." 15 | }, 16 | { "name" : "PropagationScaling", 17 | "type" : "double", 18 | "default" : 1.0, 19 | "doc" : "Weight of direct propagation contribution to the speed term" 20 | }, 21 | { "name" : "CurvatureScaling", 22 | "type" : "double", 23 | "default" : 1.0, 24 | "doc" : "Weight of the curvature contribution to the speed term" 25 | }, 26 | { "name" : "AdvectionScaling", 27 | "type" : "double", 28 | "default" : 0.2, 29 | "doc" : "Weight of the advection contribution to the speed term" 30 | }, 31 | { 32 | "name" : "NumberOfIterations", 33 | "type" : "uint32_t", 34 | "default" : "50u", 35 | "doc" : "Number of iterations to run" 36 | } 37 | 38 | ] 39 | "tests" : [ 40 | { 41 | "tag" : "defaults", 42 | "description" : "Simply run with default settings", 43 | "inputA" : "Input/SmallWhiteCircle_Float.nrrd", 44 | "inputB" : "Input/LargeWhiteCircle_Float.nrrd", 45 | "settings" : [], 46 | "tolerance" : 0.1 47 | } 48 | ] 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Testing/Unit/RegistrationTests.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "itkImage.h" 4 | #include "itkVectorImage.h" 5 | 6 | #include 7 | #include 8 | 9 | TEST(Registration,CreateMattes) { 10 | itk::simple::Image image2d( 32, 32, itk::simple::sitkUInt8 ); 11 | itk::simple::Image image3d( 32, 32, 32, itk::simple::sitkUInt8 ); 12 | 13 | itk::simple::MattesMutualInformationMetric metric; 14 | 15 | ASSERT_TRUE ( metric.GetMetric ( image2d ).IsNotNull() ); 16 | ASSERT_TRUE ( metric.GetMetric ( image3d ).IsNotNull() ); 17 | // Can't make a 2d to 3d registration yet... 18 | // ASSERT_THROW ( metric.GetMetric ( image2d.get(), image3d.get() ) ); 19 | } 20 | 21 | TEST(Registration,Simple) { 22 | itk::simple::ImageFileReader reader; 23 | 24 | itk::simple::Image fixed = reader.SetFileName ( dataFinder.GetFile ( "Input/Fixed.nrrd" ) ).Execute(); 25 | itk::simple::Image moving = reader.SetFileName ( dataFinder.GetFile ( "Input/Moving.nrrd" ) ).Execute(); 26 | 27 | itk::simple::AffineTransform transform; 28 | itk::simple::MattesMutualInformationMetric metric; 29 | itk::simple::LinearInterpolate interpolate; 30 | itk::simple::RegularStepGradientDescentOptimizer optimizer; 31 | 32 | itk::simple::Registration registration; 33 | registration.SetTransform ( &transform ); 34 | registration.SetMetric ( &metric ); 35 | registration.SetInterpolate ( &interpolate ); 36 | registration.SetOptimizer ( &optimizer ); 37 | std::vector params; 38 | try { 39 | params = registration.Execute ( fixed, moving ); 40 | } catch ( itk::ExceptionObject e ) { 41 | std::cout << "Registration failed: " << e.what() << std::endl; 42 | } 43 | ASSERT_NO_THROW ( params = registration.Execute ( fixed, moving ) ); 44 | ASSERT_NE ( params.size(), 0 ); 45 | } 46 | --------------------------------------------------------------------------------