From f23cef7ce1e635136f922174ae7b6e616993828d Mon Sep 17 00:00:00 2001 From: Lucas Gandel Date: Tue, 7 Nov 2017 09:57:47 +0100 Subject: [PATCH] Enable build with shared libraries Fix building with BUILD_SHARED_LIBS set to ON. Cleaning unused utilities and cmake scripts. Removing rtkcuda_EXPORT to exclusively use RTK_EXPORT. Future commits should remove rtkWin32Header.h to use the auto-generated header RTKExport.h instead. --- CMakeLists.txt | 57 +- cmake/RTKExternalData.cmake | 29 - ...gateGradientConeBeamReconstructionFilter.h | 6 - include/rtkCudaAverageOutOfROIImageFilter.h | 4 +- include/rtkCudaBackProjectionImageFilter.h | 4 +- .../rtkCudaConjugateGradientImageFilter_3f.h | 8 +- .../rtkCudaConjugateGradientImageFilter_4f.h | 8 +- include/rtkCudaConstantVolumeSeriesSource.h | 8 +- include/rtkCudaConstantVolumeSource.h | 8 +- include/rtkCudaCropImageFilter.h | 4 +- include/rtkCudaCyclicDeformationImageFilter.h | 4 +- include/rtkCudaDisplacedDetectorImageFilter.h | 4 +- include/rtkCudaFDKBackProjectionImageFilter.h | 4 +- .../rtkCudaFDKConeBeamReconstructionFilter.h | 4 +- include/rtkCudaFDKWeightProjectionFilter.h | 8 +- include/rtkCudaFFTConvolutionImageFilter.h | 2 +- include/rtkCudaFFTConvolutionImageFilter.hcu | 4 +- include/rtkCudaFFTRampImageFilter.h | 4 +- .../rtkCudaForwardProjectionImageFilter.hcu | 2 +- include/rtkCudaForwardWarpImageFilter.h | 4 +- include/rtkCudaInterpolateImageFilter.h | 4 +- ...IterativeFDKConeBeamReconstructionFilter.h | 4 +- include/rtkCudaLagCorrectionImageFilter.h | 4 +- include/rtkCudaLaplacianImageFilter.h | 8 +- ...kCudaLastDimensionTVDenoisingImageFilter.h | 8 +- include/rtkCudaParkerShortScanImageFilter.h | 4 +- ...kCudaPolynomialGainCorrectionImageFilter.h | 4 +- .../rtkCudaRayCastBackProjectionImageFilter.h | 4 +- include/rtkCudaSplatImageFilter.h | 4 +- ...daTotalVariationDenoisingBPDQImageFilter.h | 8 +- .../rtkCudaWarpBackProjectionImageFilter.h | 4 +- .../rtkCudaWarpBackProjectionImageFilter.hcu | 4 +- .../rtkCudaWarpForwardProjectionImageFilter.h | 2 +- ...tkCudaWarpForwardProjectionImageFilter.hcu | 4 +- include/rtkCudaWarpImageFilter.h | 4 +- include/rtkMedianImageFilter.h | 2 +- include/rtkWin32Header.h | 23 - ...DCircularProjectionGeometryXMLFileReader.h | 14 +- ...DCircularProjectionGeometryXMLFileWriter.h | 16 +- itk-module-init.cmake | 7 +- src/CMakeLists.txt | 7 +- ...ircularProjectionGeometryXMLFileReader.cxx | 7 +- ...ircularProjectionGeometryXMLFileWriter.cxx | 7 +- test/rtkdigisenstest.cxx | 3 +- test/rtkfdkprojweightcompcudatest.cxx | 1 + test/rtkimagxtest.cxx | 3 +- utilities/ITKCudaCommon/include/itkCudaUtil.h | 2 +- .../include/itkCudaWin32Header.h | 3 +- utilities/SimpleRTK/.gitignore | 9 - .../SimpleRTK/CMake/CTestCustom.cmake.in | 73 - utilities/SimpleRTK/CMake/FindCSharp.cmake | 72 - .../CMake/FindDotNetFrameworkSdk.cmake | 92 - utilities/SimpleRTK/CMake/FindGTest.cmake | 211 - utilities/SimpleRTK/CMake/FindLuaInterp.cmake | 45 - utilities/SimpleRTK/CMake/FindMono.cmake | 162 - .../CMake/FindPythonVirtualEnv.cmake | 53 - utilities/SimpleRTK/CMake/FindR.cmake | 48 - .../CMake/GetGitRevisionDescription.cmake | 169 - utilities/SimpleRTK/CMake/UseCSharp.cmake | 115 - .../CMake/UseDotNetFrameworkSdk.cmake | 12 - utilities/SimpleRTK/CMake/UseMono.cmake | 16 - utilities/SimpleRTK/CMake/VariableList.cmake | 61 - utilities/SimpleRTK/CMake/pre-commit | 7 - .../SimpleRTK/CMake/same_uint64_ulong.cxx | 13 - utilities/SimpleRTK/CMake/srtkAddTest.cmake | 289 - .../SimpleRTK/CMake/srtkCheckCXX11.cmake | 93 - .../srtkCheckForITKModuleDependencies.cmake | 66 - .../CMake/srtkCheckRequiredFlags.cmake | 107 - .../SimpleRTK/CMake/srtkCheckSourceTree.cmake | 15 - .../CMake/srtkCompilerWarningsSettings.cmake | 86 - .../CMake/srtkConfigureFileBuildtime.cmake | 61 - .../SimpleRTK/CMake/srtkExternalData.cmake | 52 - .../CMake/srtkForbidDownloadsOption.cmake | 12 - .../CMake/srtkGenerateFilterSource.cmake | 267 - .../SimpleRTK/CMake/srtkLanguageOptions.cmake | 216 - .../CMake/srtkPreventInBuildInstalls.cmake | 9 - .../CMake/srtkPreventInSourceBuilds.cmake | 18 - .../CMake/srtkProjectLanguageCommon.cmake | 111 - .../SimpleRTK/CMake/srtkSourceVersion.cmake | 117 - .../CMake/srtkSourceVersionVars.cmake.in | 14 - .../SimpleRTK/CMake/srtkStripOption.cmake | 30 - ...TargetLinkLibrariesWithDynamicLookup.cmake | 89 - utilities/SimpleRTK/CMake/srtkUseSWIG.cmake | 274 - .../SimpleRTK/CMake/srtk_check_cxx11.cxx | 194 - .../CMake/srtk_check_cxx11_required.cxx | 14 - utilities/SimpleRTK/CMakeLists.txt | 524 - .../Code/BasicFilters/CMakeLists.txt | 7 - .../BasicFilters/include/itkHashImageFilter.h | 123 - .../include/itkHashImageFilter.hxx | 185 - .../include/itkSliceImageFilter.h | 166 - .../include/itkSliceImageFilter.hxx | 363 - .../include/itkUnaryMinusImageFilter.h | 52 - .../include/srtkAdditionalProcedures.h | 102 - .../BasicFilters/include/srtkBasicFilters.h | 68 - .../include/srtkCastImageFilter.h | 180 - .../include/srtkHashImageFilter.h | 80 - .../BasicFilters/include/srtkImageFilter.h | 113 - .../BasicFilters/include/srtkImageOperators.h | 99 - .../include/srtkLabelStatisticsImageFilter.h | 146 - .../BasicFilters/include/srtkMeasurementMap.h | 61 - .../include/srtkStatisticsImageFilter.h | 78 - .../BasicFilters/json/AddImageFilter.json | 13 - .../BasicFilters/json/AndImageFilter.json | 13 - .../json/BackProjectionImageFilter.json | 22 - .../json/BinaryNotImageFilter.json | 59 - .../json/BitwiseNotImageFilter.json | 17 - .../json/ComplexToImaginaryImageFilter.json | 16 - .../json/ComplexToRealImageFilter.json | 13 - ...eGradientConeBeamReconstructionFilter.json | 72 - .../json/ConstantImageSource.json | 71 - .../CudaFDKConeBeamReconstructionFilter.json | 49 - .../CudaForwardProjectionImageFilter.json | 22 - ...tectorForOffsetFieldOfViewImageFilter.json | 22 - .../BasicFilters/json/DivideImageFilter.json | 13 - .../json/DrawCylinderImageFilter.json | 35 - .../json/DrawEllipsoidImageFilter.json | 35 - .../json/DrawSheppLoganFilter.json | 24 - ...lektaSynergyRawLookupTableImageFilter.json | 11 - .../BasicFilters/json/ExtractImageFilter.json | 53 - .../json/FDKBackProjectionImageFilter.json | 21 - .../json/FDKConeBeamReconstructionFilter.json | 49 - .../json/FDKWeightProjectionFilter.json | 21 - .../BasicFilters/json/FFTRampImageFilter.json | 16 - .../json/FieldOfViewImageFilter.json | 38 - .../json/GreaterEqualImageFilter.json | 39 - .../BasicFilters/json/GreaterImageFilter.json | 39 - .../json/I0EstimationProjectionFilter.json | 23 - .../json/IntensityWindowingImageFilter.json | 53 - .../JosephForwardProjectionImageFilter.json | 22 - .../json/LessEqualImageFilter.json | 39 - .../BasicFilters/json/LessImageFilter.json | 39 - .../BasicFilters/json/ModulusImageFilter.json | 12 - .../json/MultiplyImageFilter.json | 13 - .../json/NotEqualImageFilter.json | 39 - .../BasicFilters/json/NotImageFilter.json | 12 - .../Code/BasicFilters/json/OrImageFilter.json | 13 - .../json/PatchBasedDenoisingImageFilter.json | 155 - .../BasicFilters/json/PowImageFilter.json | 13 - .../ProjectGeometricPhantomImageFilter.json | 39 - .../json/RayBoxIntersectionImageFilter.json | 49 - .../RayEllipsoidIntersectionImageFilter.json | 70 - .../RealAndImaginaryToComplexImageFilter.json | 14 - .../json/RegionOfInterestImageFilter.json | 37 - .../json/ResampleImageFilter.json | 218 - .../json/SheppLoganPhantomFilter.json | 34 - .../BasicFilters/json/SliceImageFilter.json | 34 - .../BasicFilters/json/SqrtImageFilter.json | 13 - .../json/SubtractImageFilter.json | 13 - .../json/UnaryMinusImageFilter.json | 14 - .../VectorIndexSelectionCastImageFilter.json | 33 - .../json/WaterPrecorrectionImageFilter.json | 17 - .../BasicFilters/json/XorImageFilter.json | 13 - .../Code/BasicFilters/src/CMakeLists.txt | 104 - .../BasicFilters/src/itkBitwiseNotFunctor.h | 56 - .../src/srtkAdditionalProcedures.cxx | 138 - .../src/srtkCastImageFilter-2.cxx | 41 - .../src/srtkCastImageFilter-2l.cxx | 38 - .../src/srtkCastImageFilter-2v.cxx | 40 - .../src/srtkCastImageFilter-3.cxx | 42 - .../src/srtkCastImageFilter-3l.cxx | 39 - .../src/srtkCastImageFilter-3v.cxx | 37 - .../BasicFilters/src/srtkCastImageFilter.cxx | 112 - .../BasicFilters/src/srtkCastImageFilter.hxx | 150 - .../src/srtkCreateInterpolator.hxx | 153 - .../Code/BasicFilters/src/srtkCreateKernel.h | 73 - .../BasicFilters/src/srtkDirectionConvert.hxx | 49 - .../BasicFilters/src/srtkHashImageFilter.cxx | 140 - .../Code/BasicFilters/src/srtkImageFilter.cxx | 54 - .../BasicFilters/src/srtkImageToKernel.hxx | 89 - .../BasicFilters/src/srtkMeasurementMap.cxx | 93 - .../src/srtkPermuteAxis_Static.hxx | 36 - .../src/srtkStatisticsImageFilter.cxx | 164 - .../srtkBinaryFunctorFilterTemplate.cxx.in | 212 - .../srtkBinaryFunctorFilterTemplate.h.in | 69 - .../srtkDualImageFilterTemplate.cxx.in | 248 - .../srtkDualImageFilterTemplate.h.in | 60 - .../templates/srtkImageFilterTemplate.cxx.in | 79 - .../templates/srtkImageFilterTemplate.h.in | 48 - .../templates/srtkImageSourceTemplate.cxx.in | 112 - .../templates/srtkImageSourceTemplate.h.in | 66 - .../srtkRTKImageFilterTemplate.cxx.in | 79 - .../templates/srtkRTKImageFilterTemplate.h.in | 48 - utilities/SimpleRTK/Code/CMakeLists.txt | 3 - .../SimpleRTK/Code/Common/CMakeLists.txt | 11 - .../Common/include/Ancillary/FunctionTraits.h | 108 - .../Code/Common/include/Ancillary/TypeList.h | 477 - .../Code/Common/include/Ancillary/hl_md5.cxx | 403 - .../Code/Common/include/Ancillary/hl_md5.h | 209 - .../Code/Common/include/Ancillary/hl_sha1.cxx | 388 - .../Code/Common/include/Ancillary/hl_sha1.h | 225 - .../SimpleRTK/Code/Common/include/SimpleRTK.h | 57 - .../Code/Common/include/nsstd/auto_ptr.h | 41 - .../Code/Common/include/nsstd/functional.h | 52 - .../Code/Common/include/nsstd/type_traits.h | 55 - .../Code/Common/include/nsstd/unordered_map.h | 50 - .../Code/Common/include/srtkCommand.h | 95 - .../Code/Common/include/srtkCommon.h | 41 - .../Code/Common/include/srtkConditional.h | 66 - .../Code/Common/include/srtkDetail.h | 105 - .../include/srtkDualMemberFunctionFactory.h | 183 - .../include/srtkDualMemberFunctionFactory.hxx | 228 - .../Code/Common/include/srtkEnableIf.h | 65 - .../SimpleRTK/Code/Common/include/srtkEvent.h | 72 - .../Code/Common/include/srtkExceptionObject.h | 100 - .../Code/Common/include/srtkFunctionCommand.h | 73 - .../SimpleRTK/Code/Common/include/srtkImage.h | 471 - .../Code/Common/include/srtkInterpolator.h | 119 - .../SimpleRTK/Code/Common/include/srtkMacro.h | 130 - .../include/srtkMemberFunctionFactory.h | 165 - .../include/srtkMemberFunctionFactory.hxx | 224 - .../include/srtkMemberFunctionFactoryBase.h | 459 - .../Code/Common/include/srtkNonCopyable.h | 76 - .../Code/Common/include/srtkPixelIDTokens.h | 133 - .../Common/include/srtkPixelIDTypeLists.h | 209 - .../Code/Common/include/srtkPixelIDTypes.h | 173 - .../Code/Common/include/srtkPixelIDValues.h | 125 - .../Code/Common/include/srtkProcessObject.h | 367 - .../Common/include/srtkTemplateFunctions.h | 174 - .../srtkThreeDCircularProjectionGeometry.h | 134 - .../Code/Common/include/srtkTransform.h | 179 - .../Code/Common/include/srtkVersion.h | 55 - .../SimpleRTK/Code/Common/src/CMakeLists.txt | 38 - .../SimpleRTK/Code/Common/src/srtkCommand.cxx | 69 - .../Code/Common/src/srtkConfigure.h.in | 58 - .../SimpleRTK/Code/Common/src/srtkEvent.cxx | 44 - .../Code/Common/src/srtkExceptionObject.cxx | 178 - .../Code/Common/src/srtkFunctionCommand.cxx | 51 - .../SimpleRTK/Code/Common/src/srtkImage.cxx | 731 - .../SimpleRTK/Code/Common/src/srtkImage.hxx | 217 - .../Code/Common/src/srtkImageExplicit.cxx | 133 - .../Code/Common/src/srtkInterpolator.cxx | 46 - .../Code/Common/src/srtkPimpleImageBase.h | 157 - .../Code/Common/src/srtkPimpleImageBase.hxx | 820 - .../Code/Common/src/srtkPixelIDValues.cxx | 157 - .../Code/Common/src/srtkProcessObject.cxx | 546 - .../srtkThreeDCircularProjectionGeometry.cxx | 395 - .../Code/Common/src/srtkTransform.cxx | 600 - .../SimpleRTK/Code/Common/src/srtkVersion.cxx | 92 - .../Code/Common/src/srtkVersionConfig.h.in | 24 - utilities/SimpleRTK/Code/IO/CMakeLists.txt | 1 - utilities/SimpleRTK/Code/IO/include/srtkIO.h | 38 - .../Code/IO/include/srtkImageFileReader.h | 77 - .../Code/IO/include/srtkImageFileWriter.h | 98 - .../Code/IO/include/srtkImageReaderBase.h | 109 - .../Code/IO/include/srtkImageSeriesReader.h | 129 - .../Code/IO/include/srtkImageSeriesWriter.h | 97 - .../Code/IO/include/srtkImportImageFilter.h | 214 - .../Code/IO/include/srtkProjectionsReader.h | 72 - .../SimpleRTK/Code/IO/include/srtkShow.h | 94 - ...DCircularProjectionGeometryXMLFileReader.h | 68 - ...DCircularProjectionGeometryXMLFileWriter.h | 68 - .../SimpleRTK/Code/IO/src/CMakeLists.txt | 36 - .../Code/IO/src/srtkImageFileReader.cxx | 134 - .../Code/IO/src/srtkImageFileWriter.cxx | 129 - .../Code/IO/src/srtkImageReaderBase.cxx | 383 - .../Code/IO/src/srtkImageSeriesReader.cxx | 188 - .../Code/IO/src/srtkImageSeriesWriter.cxx | 146 - .../Code/IO/src/srtkImportImageFilter.cxx | 584 - .../Code/IO/src/srtkProjectionsReader.cxx | 130 - utilities/SimpleRTK/Code/IO/src/srtkShow.cxx | 588 - ...ircularProjectionGeometryXMLFileReader.cxx | 91 - ...ircularProjectionGeometryXMLFileWriter.cxx | 82 - utilities/SimpleRTK/Examples/CMakeLists.txt | 7 - .../Examples/RTKFirstCudaReconstruction.py | 85 - .../Examples/RTKFirstReconstruction.cs | 111 - .../Examples/RTKFirstReconstruction.cxx | 93 - .../Examples/RTKFirstReconstruction.py | 85 - utilities/SimpleRTK/SimpleRTKConfig.cmake.in | 54 - .../SimpleRTK/SimpleRTKConfigVersion.cmake.in | 6 - utilities/SimpleRTK/SimpleRTKWithSwig.cmake | 181 - utilities/SimpleRTK/SuperBuild/CMakeLists.txt | 26 - .../SimpleRTK/SuperBuild/CTestConfig.cmake | 7 - .../SimpleRTK/SuperBuild/External_GTest.cmake | 63 - .../SimpleRTK/SuperBuild/External_ITK.cmake | 104 - .../SimpleRTK/SuperBuild/External_Lua.cmake | 44 - .../SimpleRTK/SuperBuild/External_PCRE.cmake | 48 - .../SimpleRTK/SuperBuild/External_RTK.cmake | 66 - .../External_SimpleRTKExamples.cmake | 28 - .../SimpleRTK/SuperBuild/External_Swig.cmake | 122 - .../SuperBuild/External_virtualenv.cmake | 39 - .../SimpleRTK/SuperBuild/SuperBuild.cmake | 481 - utilities/SimpleRTK/SuperBuild/lua.cmake | 85 - .../SuperBuild/pcre_configure_step.cmake.in | 27 - .../SuperBuild/swig_configure_step.cmake.in | 37 - .../AddExtraIncludes.cxx.in | 5 - .../TemplateComponents/ClassDeclaration.h.in | 30 - .../TemplateComponents/ClassEnd.h.in | 1 - .../TemplateComponents/ClassNameAndPrint.h.in | 5 - .../ConstructorInitializeMembers.cxx.in | 22 - .../ConstructorMemberFunctionSetup.cxx.in | 9 - .../ConstructorSignature.cxx.in | 1 - .../ConstructorVectorPixels.cxx.in | 6 - .../TemplateComponents/CustomCasts.cxx | 46 - .../TemplateComponents/CustomMethods.cxx.in | 25 - .../TemplateComponents/CustomMethods.h.in | 19 - .../DesctuctorDefinition.cxx.in | 22 - .../DoNotEditWarning.cxx.in | 5 - .../TemplateComponents/DoNotEditWarning.h.in | 5 - .../ExecuteInternalGetImagePointers.cxx.in | 9 - .../ExecuteInternalITKFilter.cxx.in | 18 - .../ExecuteInternalMethod.h.in | 15 - .../ExecuteInternalSetITKFilterInputs.cxx.in | 37 - ...ecuteInternalSetITKFilterParameters.cxx.in | 16 - .../ExecuteInternalSignature.cxx.in | 23 - .../ExecuteInternalTypedefs.cxx.in | 21 - .../ExecuteInternalUpdateAndReturn.cxx.in | 68 - .../ExecuteInternalVectorImages.cxx.in | 71 - .../ExecuteMethodNoParameters.h.in | 15 - .../ExecuteMethodWithParameters.h.in | 15 - .../ExecuteNoParameters.cxx.in | 68 - .../ExecuteWithParameters.cxx.in | 45 - .../TemplateComponents/FunctionalAPI.cxx.in | 49 - .../TemplateComponents/FunctionalAPI.h.in | 24 - .../TemplateComponents/ImageParameters.in | 6 - .../TemplateComponents/InputParameters.in | 21 - .../InputParametersInternal.in | 17 - .../MemberFunctionDispatch.h.in | 5 - .../MemberGetSetDeclarations.h.in | 126 - .../TemplateComponents/MemberParameters.in | 19 - .../MemberParametersWithDefaults.in | 23 - .../MemberPointsGetSetDeclarations.h.in | 0 .../PrivateMemberDeclarations.h.in | 53 - .../PublicDeclarations.h.in | 5 - .../RTKFunctionalAPI.cxx.in | 22 - .../TemplateComponents/RTKFunctionalAPI.h.in | 20 - .../StandardIncludes.cxx.in | 22 - .../TemplateComponents/ToStringBody.cxx.in | 44 - .../TemplateComponents/ToStringReturn.cxx.in | 1 - .../ToStringSignature.cxx.in | 1 - utilities/SimpleRTK/Testing/CMakeLists.txt | 1 - .../SimpleRTK/Testing/Unit/CMakeLists.txt | 775 - .../Unit/CSharpImageFilterTestTemplate.cs.in | 172 - .../SimpleRTK/Testing/Unit/CSharpImageTest.cs | 95 - utilities/SimpleRTK/Testing/Unit/IOTest.py | 36 - utilities/SimpleRTK/Testing/Unit/IOTests.cxx | 186 - .../Testing/Unit/ImageIndexingTest.py | 156 - .../Unit/JavaImageFilterTestTemplate.java.in | 200 - .../Unit/LuaImageFilterTestTemplate.lua.in | 132 - .../Unit/PythonImageFilterTestTemplate.py.in | 108 - .../SimpleRTK/Testing/Unit/RArithmeticTest.R | 442 - .../Unit/RImageFilterTestTemplate.R.in | 114 - .../Unit/RubyImageFilterTestTemplate.rb.in | 139 - .../Testing/Unit/SimpleRTKTestHarness.cxx | 287 - .../Testing/Unit/SimpleRTKTestHarness.h | 234 - .../Unit/SimpleRTKTestHarnessPaths.h.in | 54 - .../Testing/Unit/SimpleRTKUnitTestDriver.cxx | 51 - .../Unit/TclImageFilterTestTemplate.tcl.in | 103 - .../Testing/Unit/rtkHashImageFilterTest.cxx | 190 - .../Testing/Unit/srtkBasicFiltersTests.cxx | 240 - .../Testing/Unit/srtkCommonTests.cxx | 512 - .../Testing/Unit/srtkExceptionsTests.cxx | 108 - .../Testing/Unit/srtkImageCompare.cxx | 229 - .../SimpleRTK/Testing/Unit/srtkImageCompare.h | 89 - .../Unit/srtkImageFilterTestTemplate.cxx.in | 715 - .../Testing/Unit/srtkImageIOTests.cxx | 298 - .../SimpleRTK/Testing/Unit/srtkImageTests.cxx | 1717 - .../SimpleRTK/Testing/Unit/srtkImageTests.py | 82 - .../Testing/Unit/srtkImportImageTest.cxx | 431 - .../Unit/srtkNumpyArrayConversionTest.py | 178 - .../Testing/Unit/srtkProcessObjectTest.java | 31 - .../Testing/Unit/srtkProcessObjectTest.py | 98 - .../Unit/srtkSystemInformationTest.cxx | 164 - .../Testing/Unit/srtkTypeListsTests.cxx | 87 - utilities/SimpleRTK/UseSimpleRTK.cmake.in | 19 - .../SimpleRTK/Utilities/C99/CMakeLists.txt | 3 - utilities/SimpleRTK/Utilities/C99/inttypes.h | 305 - utilities/SimpleRTK/Utilities/C99/stdint.h | 247 - utilities/SimpleRTK/Utilities/CMakeLists.txt | 1 - utilities/SimpleRTK/Utilities/CSVtoTable.py | 191 - .../Utilities/CompareRTKandSRTKFilters.py | 308 - .../SimpleRTK/Utilities/Doxygen/Doxygen.cmake | 66 - .../Doxygen/GenerateExamplesDox.cmake | 35 - .../Utilities/Doxygen/ITKDoxygenTags.cmake | 39 - .../Utilities/Doxygen/doxygen.config.in | 2379 - .../SimpleRTK/Utilities/ExpandTemplate.lua | 645 - .../GenerateDocs/GenerateDocumentation.groovy | 189 - .../Utilities/GenerateDocs/JSONDocUpdate.sh | 38 - .../SimpleRTK/Utilities/GenerateDocs/README | 25 - .../Utilities/GenerateDocs/SwigDocUpdate.sh | 35 - .../Utilities/GenerateDocs/config_vars.sh | 12 - .../Utilities/GenerateDocs/doxy2swig.py | 721 - .../Utilities/GenerateDocs/doxyall.py | 150 - utilities/SimpleRTK/Utilities/JSONBeautify.py | 25 - .../SimpleRTK/Utilities/JSONInputAtoInputs.py | 56 - utilities/SimpleRTK/Utilities/JSONValidate.py | 14 - utilities/SimpleRTK/Utilities/filters.csv | 387 - utilities/SimpleRTK/Version.cmake | 40 - utilities/SimpleRTK/Wrapping/CMakeLists.txt | 54 - .../Wrapping/CSharp/AssemblyInfo.cs.in | 33 - .../SimpleRTK/Wrapping/CSharp/CMakeLists.txt | 101 - utilities/SimpleRTK/Wrapping/CSharp/CSharp.i | 268 - .../Wrapping/CSharp/CSharpTypemapHelper.i | 55 - .../SimpleRTK/Wrapping/CSharp/SimpleRTK.i | 2 - .../Wrapping/CSharp/dist/CMakeLists.txt | 66 - .../Wrapping/Common/SimpleRTK_Common.i | 209 - .../SimpleRTK/Wrapping/Java/CMakeLists.txt | 76 - utilities/SimpleRTK/Wrapping/Java/Java.i | 47 - utilities/SimpleRTK/Wrapping/Java/JavaDoc.i | 50289 ---------------- utilities/SimpleRTK/Wrapping/Java/SimpleRTK.i | 1 - .../Wrapping/Java/dist/CMakeLists.txt | 75 - .../SimpleRTK/Wrapping/Lua/CMakeLists.txt | 48 - utilities/SimpleRTK/Wrapping/Lua/Lua.i | 26 - utilities/SimpleRTK/Wrapping/Lua/SimpleRTK.i | 1 - .../Wrapping/Lua/SimpleRTKLuaMain.cxx | 429 - .../SimpleRTK/Wrapping/Python/CMakeLists.txt | 175 - .../Wrapping/Python/Packaging/__init__.py | 1 - .../Wrapping/Python/Packaging/setup.py.in | 84 - .../Wrapping/Python/Packaging/setupegg.py | 17 - utilities/SimpleRTK/Wrapping/Python/Python.i | 792 - .../Wrapping/Python/PythonDocstrings.i | 40037 ------------ .../Python/PythonVirtualEnvInstall.cmake.in | 109 - .../SimpleRTK/Wrapping/Python/SimpleRTK.i | 3 - .../Wrapping/Python/dist/CMakeLists.txt | 33 - .../Wrapping/Python/dist/install_wheel.py | 5 - .../Python/srtkNumpyArrayConversion.cxx | 345 - .../Wrapping/Python/srtkPyCommand.cxx | 142 - .../SimpleRTK/Wrapping/Python/srtkPyCommand.h | 81 - utilities/SimpleRTK/Wrapping/R/CMakeLists.txt | 96 - .../R/Packaging/SimpleITK/DESCRIPTION.in | 17 - .../Wrapping/R/Packaging/SimpleITK/NAMESPACE | 1 - .../Wrapping/R/Packaging/SimpleITK/R/zA.R | 249 - .../Wrapping/R/Packaging/SimpleITK/R/zOps.R | 192 - .../SimpleITK/data/cthead1-Float.mha.md5 | 1 - .../Packaging/SimpleITK/data/cthead1.png.md5 | 1 - .../SimpleITK/inst/doc/SimpleITK_tutorial.pdf | Bin 515220 -> 0 bytes .../SimpleITK/man/SimpleITK_Image-class.Rd | 106 - .../R/Packaging/SimpleITK/src/Makefile | 6 - .../SimpleITK/vignettes/InsightArticle.cls | 153 - .../SimpleITK/vignettes/InsightJournal.sty | 1123 - .../vignettes/SimpleITK_tutorial.Rnw | 260 - .../SimpleITK/vignettes/algorithm.sty | 78 - .../SimpleITK/vignettes/algorithmic.sty | 143 - .../Packaging/SimpleITK/vignettes/amssymb.sty | 285 - .../SimpleITK/vignettes/fancyhdr.sty | 329 - .../SimpleITK/vignettes/floatflt.sty | 348 - .../SimpleITK/vignettes/fncychap.sty | 431 - .../R/Packaging/SimpleITK/vignettes/jss.cls | 467 - .../R/Packaging/SimpleITK/vignettes/times.sty | 32 - .../Packaging/SimpleITK/vignettes/upquote.sty | 76 - utilities/SimpleRTK/Wrapping/R/R.i | 197 - utilities/SimpleRTK/Wrapping/R/SimpleRTK.i | 3 - utilities/SimpleRTK/Wrapping/R/rrun.swg | 376 - utilities/SimpleRTK/Wrapping/R/srtkRArray.cxx | 194 - .../SimpleRTK/Wrapping/R/srtkRCommand.cxx | 123 - utilities/SimpleRTK/Wrapping/R/srtkRCommand.h | 99 - .../SimpleRTK/Wrapping/Ruby/CMakeLists.txt | 22 - utilities/SimpleRTK/Wrapping/Ruby/Ruby.i | 30 - utilities/SimpleRTK/Wrapping/Ruby/SimpleRTK.i | 1 - .../SimpleRTK/Wrapping/Tcl/CMakeLists.txt | 29 - utilities/SimpleRTK/Wrapping/Tcl/SimpleRTK.i | 1 - utilities/SimpleRTK/Wrapping/Tcl/Tcl.i | 27 - 451 files changed, 167 insertions(+), 140871 deletions(-) delete mode 100644 cmake/RTKExternalData.cmake rename include/srtkThreeDCircularProjectionGeometryXMLFileReader.hxx => src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx (93%) rename include/srtkThreeDCircularProjectionGeometryXMLFileWriter.hxx => src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx (89%) delete mode 100644 utilities/SimpleRTK/.gitignore delete mode 100644 utilities/SimpleRTK/CMake/CTestCustom.cmake.in delete mode 100644 utilities/SimpleRTK/CMake/FindCSharp.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindDotNetFrameworkSdk.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindGTest.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindLuaInterp.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindMono.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindPythonVirtualEnv.cmake delete mode 100644 utilities/SimpleRTK/CMake/FindR.cmake delete mode 100644 utilities/SimpleRTK/CMake/GetGitRevisionDescription.cmake delete mode 100644 utilities/SimpleRTK/CMake/UseCSharp.cmake delete mode 100644 utilities/SimpleRTK/CMake/UseDotNetFrameworkSdk.cmake delete mode 100644 utilities/SimpleRTK/CMake/UseMono.cmake delete mode 100644 utilities/SimpleRTK/CMake/VariableList.cmake delete mode 100644 utilities/SimpleRTK/CMake/pre-commit delete mode 100644 utilities/SimpleRTK/CMake/same_uint64_ulong.cxx delete mode 100644 utilities/SimpleRTK/CMake/srtkAddTest.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkCheckForITKModuleDependencies.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkCheckRequiredFlags.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkCheckSourceTree.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkCompilerWarningsSettings.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkConfigureFileBuildtime.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkExternalData.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkForbidDownloadsOption.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkGenerateFilterSource.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkLanguageOptions.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkPreventInBuildInstalls.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkPreventInSourceBuilds.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkProjectLanguageCommon.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkSourceVersion.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkSourceVersionVars.cmake.in delete mode 100644 utilities/SimpleRTK/CMake/srtkStripOption.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkTargetLinkLibrariesWithDynamicLookup.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtkUseSWIG.cmake delete mode 100644 utilities/SimpleRTK/CMake/srtk_check_cxx11.cxx delete mode 100644 utilities/SimpleRTK/CMake/srtk_check_cxx11_required.cxx delete mode 100644 utilities/SimpleRTK/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/itkUnaryMinusImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkAdditionalProcedures.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkBasicFilters.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkCastImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkHashImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkImageOperators.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkLabelStatisticsImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkMeasurementMap.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/include/srtkStatisticsImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/AddImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/AndImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/BackProjectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/BinaryNotImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/BitwiseNotImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ComplexToImaginaryImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ComplexToRealImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ConjugateGradientConeBeamReconstructionFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ConstantImageSource.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/CudaFDKConeBeamReconstructionFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/CudaForwardProjectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/DisplacedDetectorForOffsetFieldOfViewImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/DivideImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/DrawCylinderImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/DrawEllipsoidImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/DrawSheppLoganFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ElektaSynergyRawLookupTableImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ExtractImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/FDKBackProjectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/FDKConeBeamReconstructionFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/FDKWeightProjectionFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/FFTRampImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/FieldOfViewImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/GreaterEqualImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/GreaterImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/I0EstimationProjectionFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/IntensityWindowingImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/JosephForwardProjectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/LessEqualImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/LessImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ModulusImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/MultiplyImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/NotEqualImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/NotImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/OrImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/PowImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ProjectGeometricPhantomImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/RayBoxIntersectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/RayEllipsoidIntersectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/RealAndImaginaryToComplexImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/RegionOfInterestImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/ResampleImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/SheppLoganPhantomFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/SliceImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/SqrtImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/SubtractImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/UnaryMinusImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/VectorIndexSelectionCastImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/WaterPrecorrectionImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/json/XorImageFilter.json delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/itkBitwiseNotFunctor.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkAdditionalProcedures.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2l.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2v.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3l.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3v.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateInterpolator.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateKernel.h delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkDirectionConvert.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkHashImageFilter.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkImageFilter.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkImageToKernel.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkMeasurementMap.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkPermuteAxis_Static.hxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/src/srtkStatisticsImageFilter.cxx delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.h.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.h.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.h.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.h.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.h.in delete mode 100644 utilities/SimpleRTK/Code/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/Common/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/FunctionTraits.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/TypeList.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/SimpleRTK.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/nsstd/auto_ptr.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/nsstd/functional.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/nsstd/type_traits.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/nsstd/unordered_map.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkCommand.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkCommon.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkConditional.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkDetail.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.hxx delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkEnableIf.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkEvent.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkExceptionObject.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkFunctionCommand.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkImage.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkInterpolator.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkMacro.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.hxx delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactoryBase.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkNonCopyable.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkPixelIDTokens.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypeLists.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypes.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkPixelIDValues.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkProcessObject.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkTemplateFunctions.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkThreeDCircularProjectionGeometry.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkTransform.h delete mode 100644 utilities/SimpleRTK/Code/Common/include/srtkVersion.h delete mode 100644 utilities/SimpleRTK/Code/Common/src/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkCommand.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkConfigure.h.in delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkEvent.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkExceptionObject.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkFunctionCommand.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkImage.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkImage.hxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkImageExplicit.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkInterpolator.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.h delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.hxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkPixelIDValues.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkProcessObject.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkThreeDCircularProjectionGeometry.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkTransform.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkVersion.cxx delete mode 100644 utilities/SimpleRTK/Code/Common/src/srtkVersionConfig.h.in delete mode 100644 utilities/SimpleRTK/Code/IO/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkIO.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImageFileReader.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImageFileWriter.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImageReaderBase.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImageSeriesReader.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImageSeriesWriter.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkImportImageFilter.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkProjectionsReader.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkShow.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h delete mode 100644 utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h delete mode 100644 utilities/SimpleRTK/Code/IO/src/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImageFileReader.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImageFileWriter.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImageReaderBase.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImageSeriesReader.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImageSeriesWriter.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkImportImageFilter.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkProjectionsReader.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkShow.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx delete mode 100644 utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx delete mode 100644 utilities/SimpleRTK/Examples/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Examples/RTKFirstCudaReconstruction.py delete mode 100644 utilities/SimpleRTK/Examples/RTKFirstReconstruction.cs delete mode 100644 utilities/SimpleRTK/Examples/RTKFirstReconstruction.cxx delete mode 100644 utilities/SimpleRTK/Examples/RTKFirstReconstruction.py delete mode 100644 utilities/SimpleRTK/SimpleRTKConfig.cmake.in delete mode 100644 utilities/SimpleRTK/SimpleRTKConfigVersion.cmake.in delete mode 100644 utilities/SimpleRTK/SimpleRTKWithSwig.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/SuperBuild/CTestConfig.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_GTest.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_ITK.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_Lua.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_PCRE.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_RTK.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_SimpleRTKExamples.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_Swig.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/External_virtualenv.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/SuperBuild.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/lua.cmake delete mode 100644 utilities/SimpleRTK/SuperBuild/pcre_configure_step.cmake.in delete mode 100644 utilities/SimpleRTK/SuperBuild/swig_configure_step.cmake.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/AddExtraIncludes.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ClassDeclaration.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ClassEnd.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ClassNameAndPrint.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ConstructorInitializeMembers.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ConstructorMemberFunctionSetup.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ConstructorSignature.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ConstructorVectorPixels.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/CustomCasts.cxx delete mode 100644 utilities/SimpleRTK/TemplateComponents/CustomMethods.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/CustomMethods.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/DesctuctorDefinition.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalGetImagePointers.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalITKFilter.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalMethod.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterInputs.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterParameters.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalSignature.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalTypedefs.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalUpdateAndReturn.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteInternalVectorImages.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteMethodNoParameters.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteMethodWithParameters.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteNoParameters.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ExecuteWithParameters.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/FunctionalAPI.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/FunctionalAPI.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ImageParameters.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/InputParameters.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/InputParametersInternal.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/MemberFunctionDispatch.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/MemberGetSetDeclarations.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/MemberParameters.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/MemberParametersWithDefaults.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/MemberPointsGetSetDeclarations.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/PrivateMemberDeclarations.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/PublicDeclarations.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.h.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/StandardIncludes.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ToStringBody.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ToStringReturn.cxx.in delete mode 100644 utilities/SimpleRTK/TemplateComponents/ToStringSignature.cxx.in delete mode 100644 utilities/SimpleRTK/Testing/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Testing/Unit/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Testing/Unit/CSharpImageFilterTestTemplate.cs.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/CSharpImageTest.cs delete mode 100644 utilities/SimpleRTK/Testing/Unit/IOTest.py delete mode 100644 utilities/SimpleRTK/Testing/Unit/IOTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/ImageIndexingTest.py delete mode 100644 utilities/SimpleRTK/Testing/Unit/JavaImageFilterTestTemplate.java.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/LuaImageFilterTestTemplate.lua.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/PythonImageFilterTestTemplate.py.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/RArithmeticTest.R delete mode 100644 utilities/SimpleRTK/Testing/Unit/RImageFilterTestTemplate.R.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/RubyImageFilterTestTemplate.rb.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.h delete mode 100644 utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarnessPaths.h.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/SimpleRTKUnitTestDriver.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/TclImageFilterTestTemplate.tcl.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/rtkHashImageFilterTest.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkBasicFiltersTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkCommonTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkExceptionsTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageCompare.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageCompare.h delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageFilterTestTemplate.cxx.in delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageIOTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageTests.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImageTests.py delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkImportImageTest.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkNumpyArrayConversionTest.py delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.java delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.py delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkSystemInformationTest.cxx delete mode 100644 utilities/SimpleRTK/Testing/Unit/srtkTypeListsTests.cxx delete mode 100644 utilities/SimpleRTK/UseSimpleRTK.cmake.in delete mode 100644 utilities/SimpleRTK/Utilities/C99/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Utilities/C99/inttypes.h delete mode 100644 utilities/SimpleRTK/Utilities/C99/stdint.h delete mode 100644 utilities/SimpleRTK/Utilities/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Utilities/CSVtoTable.py delete mode 100644 utilities/SimpleRTK/Utilities/CompareRTKandSRTKFilters.py delete mode 100644 utilities/SimpleRTK/Utilities/Doxygen/Doxygen.cmake delete mode 100644 utilities/SimpleRTK/Utilities/Doxygen/GenerateExamplesDox.cmake delete mode 100644 utilities/SimpleRTK/Utilities/Doxygen/ITKDoxygenTags.cmake delete mode 100644 utilities/SimpleRTK/Utilities/Doxygen/doxygen.config.in delete mode 100644 utilities/SimpleRTK/Utilities/ExpandTemplate.lua delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/GenerateDocumentation.groovy delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/JSONDocUpdate.sh delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/README delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/SwigDocUpdate.sh delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/config_vars.sh delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/doxy2swig.py delete mode 100644 utilities/SimpleRTK/Utilities/GenerateDocs/doxyall.py delete mode 100644 utilities/SimpleRTK/Utilities/JSONBeautify.py delete mode 100644 utilities/SimpleRTK/Utilities/JSONInputAtoInputs.py delete mode 100644 utilities/SimpleRTK/Utilities/JSONValidate.py delete mode 100644 utilities/SimpleRTK/Utilities/filters.csv delete mode 100644 utilities/SimpleRTK/Version.cmake delete mode 100644 utilities/SimpleRTK/Wrapping/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/AssemblyInfo.cs.in delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/CSharp.i delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/CSharpTypemapHelper.i delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/CSharp/dist/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Common/SimpleRTK_Common.i delete mode 100644 utilities/SimpleRTK/Wrapping/Java/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Java/Java.i delete mode 100644 utilities/SimpleRTK/Wrapping/Java/JavaDoc.i delete mode 100644 utilities/SimpleRTK/Wrapping/Java/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/Java/dist/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Lua/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Lua/Lua.i delete mode 100644 utilities/SimpleRTK/Wrapping/Lua/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/Lua/SimpleRTKLuaMain.cxx delete mode 100644 utilities/SimpleRTK/Wrapping/Python/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Python/Packaging/__init__.py delete mode 100644 utilities/SimpleRTK/Wrapping/Python/Packaging/setup.py.in delete mode 100644 utilities/SimpleRTK/Wrapping/Python/Packaging/setupegg.py delete mode 100644 utilities/SimpleRTK/Wrapping/Python/Python.i delete mode 100644 utilities/SimpleRTK/Wrapping/Python/PythonDocstrings.i delete mode 100644 utilities/SimpleRTK/Wrapping/Python/PythonVirtualEnvInstall.cmake.in delete mode 100644 utilities/SimpleRTK/Wrapping/Python/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/Python/dist/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Python/dist/install_wheel.py delete mode 100644 utilities/SimpleRTK/Wrapping/Python/srtkNumpyArrayConversion.cxx delete mode 100644 utilities/SimpleRTK/Wrapping/Python/srtkPyCommand.cxx delete mode 100644 utilities/SimpleRTK/Wrapping/Python/srtkPyCommand.h delete mode 100644 utilities/SimpleRTK/Wrapping/R/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/DESCRIPTION.in delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/NAMESPACE delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/R/zA.R delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/R/zOps.R delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/data/cthead1-Float.mha.md5 delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/data/cthead1.png.md5 delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/inst/doc/SimpleITK_tutorial.pdf delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/man/SimpleITK_Image-class.Rd delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/src/Makefile delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/InsightArticle.cls delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/InsightJournal.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/SimpleITK_tutorial.Rnw delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/algorithm.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/algorithmic.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/amssymb.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/fancyhdr.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/floatflt.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/fncychap.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/jss.cls delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/times.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/Packaging/SimpleITK/vignettes/upquote.sty delete mode 100644 utilities/SimpleRTK/Wrapping/R/R.i delete mode 100644 utilities/SimpleRTK/Wrapping/R/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/R/rrun.swg delete mode 100644 utilities/SimpleRTK/Wrapping/R/srtkRArray.cxx delete mode 100644 utilities/SimpleRTK/Wrapping/R/srtkRCommand.cxx delete mode 100644 utilities/SimpleRTK/Wrapping/R/srtkRCommand.h delete mode 100644 utilities/SimpleRTK/Wrapping/Ruby/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Ruby/Ruby.i delete mode 100644 utilities/SimpleRTK/Wrapping/Ruby/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/Tcl/CMakeLists.txt delete mode 100644 utilities/SimpleRTK/Wrapping/Tcl/SimpleRTK.i delete mode 100644 utilities/SimpleRTK/Wrapping/Tcl/Tcl.i diff --git a/CMakeLists.txt b/CMakeLists.txt index f230248aa..b9974d6c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,31 @@ #========================================================= -# RTK +# RTK : Reconstruction Toolkit #========================================================= cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR) if(WIN32 OR NOT EXISTS /dev/urandom) cmake_minimum_required(VERSION 2.8.5) endif() +## Tell CMake to be quiet +cmake_policy(SET CMP0003 NEW) +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + project(RTK) +## RTK Version +set(RTK_VERSION_MAJOR "1") +set(RTK_VERSION_MINOR "3") +set(RTK_VERSION_PATCH "0") + set(RTK_LIBRARIES RTK) +## Default to release +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif () + #========================================================= # Installation variables #========================================================= @@ -38,11 +54,34 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) endif() -#Initialization +#========================================================= +# Remove some Intel compiler warnings +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + string(REPLACE "-Wno-unused-parameter" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + if(WIN32) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qwd1268") + else() + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd1268") + endif() +endif() + +# -------------------------------------------------------- +# Shared libraries option +set(RTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + +# -------------------------------------------------------- +# Initialization if(NOT ITK_SOURCE_DIR) include(itk-module-init.cmake) endif() +#========================================================= +# If choose to build documentation, then search for Doxygen executables. +option(BUILD_DOXYGEN "Build Doxygen Documentation" OFF) +if(BUILD_DOXYGEN) + add_subdirectory(documentation/Doxygen) +endif() + #========================================================= # lp_solve library #========================================================= @@ -66,6 +105,13 @@ if(NOT ITK_SOURCE_DIR) find_package(ITK 4.2.0 REQUIRED) endif() +if(ITK_VERSION_MINOR LESS "4") + include_directories(BEFORE utilities/itkImageScanlineConstIterator) +endif() +if(ITK_VERSION_MINOR LESS "5") + include_directories(BEFORE utilities/itkBinShrinkImageFilter) +endif() + #========================================================= # ITKCudaCommon #========================================================= @@ -95,6 +141,13 @@ else() itk_module_impl() endif() +#========================================================= +# Generate RTKConfig.cmake for the build tree. +set (RTK_USE_FILE "${RTK_SOURCE_DIR}/cmake/UseRTK.cmake") +set (RTK_LIBRARY_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +configure_file(cmake/RTKConfig.cmake.in RTKConfig.cmake @ONLY) +configure_file(cmake/RTKConfigVersion.cmake.in RTKConfigVersion.cmake @ONLY) + #----------------------------------------------------------------------------- # The subdirectories added below this line should use only the public # interface with find_package(ITK). Set ITK_DIR to use this ITK build. diff --git a/cmake/RTKExternalData.cmake b/cmake/RTKExternalData.cmake deleted file mode 100644 index d695de22c..000000000 --- a/cmake/RTKExternalData.cmake +++ /dev/null @@ -1,29 +0,0 @@ -get_filename_component(_RTKExternalData_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${_RTKExternalData_DIR}/ExternalData.cmake) - - -set(ExternalData_BINARY_ROOT ${CMAKE_BINARY_DIR}/ExternalData) - -set(ExternalData_URL_TEMPLATES "" CACHE STRING - "Additional URL templates for the ExternalData CMake script to look for testing data. E.g. -file:///var/bigharddrive/%(algo)/%(hash)") -mark_as_advanced(ExternalData_URL_TEMPLATES) -list(APPEND ExternalData_URL_TEMPLATES - # Data published by MIDAS - "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" - ) - -# Tell ExternalData commands to transform raw files to content links. -# TODO: Condition this feature on presence of our pre-commit hook. -set(ExternalData_LINK_CONTENT MD5) - - -#----------------------------------------------------------------------------- -# ITK wrapper for add_test that automatically sets the test's LABELS property -# to the value of its containing module. -# -function(rtk_add_test) - # Add tests with data in the ITKData group. - ExternalData_add_test(rtkData ${ARGN}) -endfunction() - diff --git a/include/rtkConjugateGradientConeBeamReconstructionFilter.h b/include/rtkConjugateGradientConeBeamReconstructionFilter.h index e918e85ff..4a9070712 100644 --- a/include/rtkConjugateGradientConeBeamReconstructionFilter.h +++ b/include/rtkConjugateGradientConeBeamReconstructionFilter.h @@ -117,12 +117,6 @@ class ConjugateGradientConeBeamReconstructionFilter : public rtk::IterativeConeB /** Run-time type information (and related methods). */ itkTypeMacro(ConjugateGradientConeBeamReconstructionFilter, itk::ImageToImageFilter) - /** The 3D image to be updated */ - void SetInputVolume(const TOutputImage* Volume); - - /** The gated measured projections */ - void SetInputProjectionStack(const TOutputImage* Projection); - typedef rtk::ForwardProjectionImageFilter< TOutputImage, TOutputImage > ForwardProjectionFilterType; typedef typename ForwardProjectionFilterType::Pointer ForwardProjectionFilterPointer; typedef rtk::BackProjectionImageFilter< TOutputImage, TOutputImage > BackProjectionFilterType; diff --git a/include/rtkCudaAverageOutOfROIImageFilter.h b/include/rtkCudaAverageOutOfROIImageFilter.h index 39b1952b9..ef66a4b23 100644 --- a/include/rtkCudaAverageOutOfROIImageFilter.h +++ b/include/rtkCudaAverageOutOfROIImageFilter.h @@ -40,7 +40,7 @@ namespace rtk * * \ingroup CudaImageToImageFilter */ -class ITK_EXPORT CudaAverageOutOfROIImageFilter : +class RTK_EXPORT CudaAverageOutOfROIImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, AverageOutOfROIImageFilter< itk::CudaImage, itk::CudaImage > > @@ -59,7 +59,7 @@ class ITK_EXPORT CudaAverageOutOfROIImageFilter : itkTypeMacro(CudaAverageOutOfROIImageFilter, AverageOutOfROIImageFilter) protected: - rtkcuda_EXPORT CudaAverageOutOfROIImageFilter(); + CudaAverageOutOfROIImageFilter(); ~CudaAverageOutOfROIImageFilter(){ } diff --git a/include/rtkCudaBackProjectionImageFilter.h b/include/rtkCudaBackProjectionImageFilter.h index 9aef7d10b..3b2ce8912 100644 --- a/include/rtkCudaBackProjectionImageFilter.h +++ b/include/rtkCudaBackProjectionImageFilter.h @@ -45,7 +45,7 @@ namespace rtk * * \ingroup Projector CudaImageToImageFilter */ -class CudaBackProjectionImageFilter : +class RTK_EXPORT CudaBackProjectionImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, BackProjectionImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -70,7 +70,7 @@ class CudaBackProjectionImageFilter : itkTypeMacro(CudaBackProjectionImageFilter, Superclass); protected: - rtkcuda_EXPORT CudaBackProjectionImageFilter(); + CudaBackProjectionImageFilter(); virtual ~CudaBackProjectionImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkCudaConjugateGradientImageFilter_3f.h b/include/rtkCudaConjugateGradientImageFilter_3f.h index c1055b781..5612d12b7 100644 --- a/include/rtkCudaConjugateGradientImageFilter_3f.h +++ b/include/rtkCudaConjugateGradientImageFilter_3f.h @@ -40,9 +40,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaConjugateGradientImageFilter_3f : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - ConjugateGradientImageFilter< itk::CudaImage > > +class RTK_EXPORT CudaConjugateGradientImageFilter_3f : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + ConjugateGradientImageFilter< itk::CudaImage > > { public: /** Standard class typedefs. */ @@ -59,7 +59,7 @@ namespace rtk itkTypeMacro(CudaConjugateGradientImageFilter_3f, ConjugateGradientImageFilter) protected: - rtkcuda_EXPORT CudaConjugateGradientImageFilter_3f(); + CudaConjugateGradientImageFilter_3f(); ~CudaConjugateGradientImageFilter_3f(){ } diff --git a/include/rtkCudaConjugateGradientImageFilter_4f.h b/include/rtkCudaConjugateGradientImageFilter_4f.h index 9a16d3013..0cdcfeb7c 100644 --- a/include/rtkCudaConjugateGradientImageFilter_4f.h +++ b/include/rtkCudaConjugateGradientImageFilter_4f.h @@ -40,9 +40,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaConjugateGradientImageFilter_4f : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - ConjugateGradientImageFilter< itk::CudaImage > > +class RTK_EXPORT CudaConjugateGradientImageFilter_4f : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + ConjugateGradientImageFilter< itk::CudaImage > > { public: /** Standard class typedefs. */ @@ -59,7 +59,7 @@ namespace rtk itkTypeMacro(CudaConjugateGradientImageFilter_4f, ConjugateGradientImageFilter) protected: - rtkcuda_EXPORT CudaConjugateGradientImageFilter_4f(); + CudaConjugateGradientImageFilter_4f(); ~CudaConjugateGradientImageFilter_4f(){ } diff --git a/include/rtkCudaConstantVolumeSeriesSource.h b/include/rtkCudaConstantVolumeSeriesSource.h index 3d69373e0..523a446a4 100644 --- a/include/rtkCudaConstantVolumeSeriesSource.h +++ b/include/rtkCudaConstantVolumeSeriesSource.h @@ -40,9 +40,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaConstantVolumeSeriesSource : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - ConstantImageSource< itk::CudaImage > > +class RTK_EXPORT CudaConstantVolumeSeriesSource : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + ConstantImageSource< itk::CudaImage > > { public: /** Standard class typedefs. */ @@ -59,7 +59,7 @@ namespace rtk itkTypeMacro(CudaConstantVolumeSeriesSource, ImageToImageFilter) protected: - rtkcuda_EXPORT CudaConstantVolumeSeriesSource(); + CudaConstantVolumeSeriesSource(); ~CudaConstantVolumeSeriesSource(){ } diff --git a/include/rtkCudaConstantVolumeSource.h b/include/rtkCudaConstantVolumeSource.h index acaf50440..7bb7b80bc 100644 --- a/include/rtkCudaConstantVolumeSource.h +++ b/include/rtkCudaConstantVolumeSource.h @@ -40,9 +40,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaConstantVolumeSource : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - ConstantImageSource< itk::CudaImage > > +class RTK_EXPORT CudaConstantVolumeSource : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + ConstantImageSource< itk::CudaImage > > { public: /** Standard class typedefs. */ @@ -59,7 +59,7 @@ namespace rtk itkTypeMacro(CudaConstantVolumeSource, ImageToImageFilter) protected: - rtkcuda_EXPORT CudaConstantVolumeSource(); + CudaConstantVolumeSource(); ~CudaConstantVolumeSource(){ } diff --git a/include/rtkCudaCropImageFilter.h b/include/rtkCudaCropImageFilter.h index 751f8eff7..98bad30bd 100644 --- a/include/rtkCudaCropImageFilter.h +++ b/include/rtkCudaCropImageFilter.h @@ -45,7 +45,7 @@ namespace rtk * \ingroup CudaImageToImageFilter * */ -class CudaCropImageFilter : +class RTK_EXPORT CudaCropImageFilter : public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, itk::CropImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -65,7 +65,7 @@ class CudaCropImageFilter : itkTypeMacro(CudaCropImageFilter, ImageToImageFilter); protected: - rtkcuda_EXPORT CudaCropImageFilter(); + CudaCropImageFilter(); virtual ~CudaCropImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkCudaCyclicDeformationImageFilter.h b/include/rtkCudaCyclicDeformationImageFilter.h index 11f1b1450..1d3d9a7f9 100644 --- a/include/rtkCudaCyclicDeformationImageFilter.h +++ b/include/rtkCudaCyclicDeformationImageFilter.h @@ -41,7 +41,7 @@ namespace rtk * \ingroup CudaImageToImageFilter */ -class ITK_EXPORT CudaCyclicDeformationImageFilter : +class RTK_EXPORT CudaCyclicDeformationImageFilter : public itk::CudaImageToImageFilter< itk::CudaImage, 4>, itk::CudaImage, 3>, CyclicDeformationImageFilter< itk::CudaImage, 4>, itk::CudaImage, 3> > > @@ -62,7 +62,7 @@ public itk::CudaImageToImageFilter< itk::CudaImage itkTypeMacro(CudaCyclicDeformationImageFilter, CyclicDeformationImageFilter) protected: - rtkcuda_EXPORT CudaCyclicDeformationImageFilter(); + CudaCyclicDeformationImageFilter(); ~CudaCyclicDeformationImageFilter(){ } diff --git a/include/rtkCudaDisplacedDetectorImageFilter.h b/include/rtkCudaDisplacedDetectorImageFilter.h index 805b404b9..a16f87317 100644 --- a/include/rtkCudaDisplacedDetectorImageFilter.h +++ b/include/rtkCudaDisplacedDetectorImageFilter.h @@ -44,7 +44,7 @@ namespace rtk * \author peter * \version 0.1 */ -class CudaDisplacedDetectorImageFilter : +class RTK_EXPORT CudaDisplacedDetectorImageFilter : public itk::CudaInPlaceImageFilter, itk::CudaImage, rtk::DisplacedDetectorImageFilter > > { @@ -68,7 +68,7 @@ class CudaDisplacedDetectorImageFilter : protected: /** Standard constructor **/ - rtkcuda_EXPORT CudaDisplacedDetectorImageFilter(); + CudaDisplacedDetectorImageFilter(); /** Destructor **/ virtual ~CudaDisplacedDetectorImageFilter(); diff --git a/include/rtkCudaFDKBackProjectionImageFilter.h b/include/rtkCudaFDKBackProjectionImageFilter.h index 7bab486fb..ecedc1feb 100644 --- a/include/rtkCudaFDKBackProjectionImageFilter.h +++ b/include/rtkCudaFDKBackProjectionImageFilter.h @@ -43,7 +43,7 @@ namespace rtk * * \ingroup Projector CudaImageToImageFilter */ -class CudaFDKBackProjectionImageFilter : +class RTK_EXPORT CudaFDKBackProjectionImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, FDKBackProjectionImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -68,7 +68,7 @@ class CudaFDKBackProjectionImageFilter : itkTypeMacro(CudaFDKBackProjectionImageFilter, Superclass); protected: - rtkcuda_EXPORT CudaFDKBackProjectionImageFilter(); + CudaFDKBackProjectionImageFilter(); virtual ~CudaFDKBackProjectionImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkCudaFDKConeBeamReconstructionFilter.h b/include/rtkCudaFDKConeBeamReconstructionFilter.h index b271bdd40..fb34c10c9 100644 --- a/include/rtkCudaFDKConeBeamReconstructionFilter.h +++ b/include/rtkCudaFDKConeBeamReconstructionFilter.h @@ -46,7 +46,7 @@ namespace rtk * * \ingroup ReconstructionAlgorithm CudaImageToImageFilter */ -class CudaFDKConeBeamReconstructionFilter : +class RTK_EXPORT CudaFDKConeBeamReconstructionFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, FDKConeBeamReconstructionFilter< itk::CudaImage, itk::CudaImage, float > > { @@ -69,7 +69,7 @@ class CudaFDKConeBeamReconstructionFilter : itkTypeMacro(CudaFDKConeBeamReconstructionFilter, FDKConeBeamReconstructionFilter); protected: - rtkcuda_EXPORT CudaFDKConeBeamReconstructionFilter(); + CudaFDKConeBeamReconstructionFilter(); ~CudaFDKConeBeamReconstructionFilter(){} virtual void GPUGenerateData(); diff --git a/include/rtkCudaFDKWeightProjectionFilter.h b/include/rtkCudaFDKWeightProjectionFilter.h index a8242ab3d..94c671610 100644 --- a/include/rtkCudaFDKWeightProjectionFilter.h +++ b/include/rtkCudaFDKWeightProjectionFilter.h @@ -45,9 +45,9 @@ namespace rtk * \author peter * \version 0.1 */ -class CudaFDKWeightProjectionFilter : - public itk::CudaInPlaceImageFilter, itk::CudaImage, - rtk::FDKWeightProjectionFilter > > +class RTK_EXPORT CudaFDKWeightProjectionFilter : + public itk::CudaInPlaceImageFilter, itk::CudaImage, + rtk::FDKWeightProjectionFilter > > { public: /** Convenience typedefs **/ @@ -69,7 +69,7 @@ class CudaFDKWeightProjectionFilter : protected: /** Standard constructor **/ - rtkcuda_EXPORT CudaFDKWeightProjectionFilter(); + CudaFDKWeightProjectionFilter(); /** Destructor **/ virtual ~CudaFDKWeightProjectionFilter(); diff --git a/include/rtkCudaFFTConvolutionImageFilter.h b/include/rtkCudaFFTConvolutionImageFilter.h index 9362f621a..6ce1b10af 100644 --- a/include/rtkCudaFFTConvolutionImageFilter.h +++ b/include/rtkCudaFFTConvolutionImageFilter.h @@ -46,7 +46,7 @@ namespace rtk * \ingroup CudaImageToImageFilter */ template< class TParentImageFilter > -class ITK_EXPORT CudaFFTConvolutionImageFilter: +class CudaFFTConvolutionImageFilter: public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, TParentImageFilter > diff --git a/include/rtkCudaFFTConvolutionImageFilter.hcu b/include/rtkCudaFFTConvolutionImageFilter.hcu index b6e9cba51..7b0007f1e 100644 --- a/include/rtkCudaFFTConvolutionImageFilter.hcu +++ b/include/rtkCudaFFTConvolutionImageFilter.hcu @@ -24,13 +24,13 @@ #include "rtkWin32Header.h" void -rtkcuda_EXPORT CUDA_fft_convolution(const int3 &inputDimension, +RTK_EXPORT CUDA_fft_convolution(const int3 &inputDimension, const int2 &kernelDimension, float *deviceProjection, float2 *deviceKernelFFT); void -rtkcuda_EXPORT CUDA_padding(const int3 &paddingIndex, +RTK_EXPORT CUDA_padding(const int3 &paddingIndex, const uint3 &paddingSize, const uint3 &inputSize, float *deviceVolume, diff --git a/include/rtkCudaFFTRampImageFilter.h b/include/rtkCudaFFTRampImageFilter.h index bf32ffe35..7e8508eaf 100644 --- a/include/rtkCudaFFTRampImageFilter.h +++ b/include/rtkCudaFFTRampImageFilter.h @@ -23,8 +23,8 @@ //Conditional definition of the class to pass ITKHeaderTest #ifdef RTK_USE_CUDA -#include "rtkFFTRampImageFilter.h" #include "rtkCudaFFTConvolutionImageFilter.h" +#include "rtkFFTRampImageFilter.h" namespace rtk { @@ -55,7 +55,7 @@ class CudaFFTRampImageFilter : itkTypeMacro(CudaFFTRampImageFilter, FFTRampImageFilter); protected: - rtkcuda_EXPORT CudaFFTRampImageFilter(){} + CudaFFTRampImageFilter(){} ~CudaFFTRampImageFilter(){} private: diff --git a/include/rtkCudaForwardProjectionImageFilter.hcu b/include/rtkCudaForwardProjectionImageFilter.hcu index f1b761264..5f730172d 100644 --- a/include/rtkCudaForwardProjectionImageFilter.hcu +++ b/include/rtkCudaForwardProjectionImageFilter.hcu @@ -22,7 +22,7 @@ #include "rtkWin32Header.h" void -rtkcuda_EXPORT CUDA_forward_project( int projSize[3], +RTK_EXPORT CUDA_forward_project( int projSize[3], int volSize[3], float *translatedProjectionIndexTransformMatrices, float* translatedVolumeTransformMatrices, diff --git a/include/rtkCudaForwardWarpImageFilter.h b/include/rtkCudaForwardWarpImageFilter.h index 02b4f056d..7f3e40015 100644 --- a/include/rtkCudaForwardWarpImageFilter.h +++ b/include/rtkCudaForwardWarpImageFilter.h @@ -44,7 +44,7 @@ namespace rtk * * \ingroup CudaImageToImageFilter */ -class CudaForwardWarpImageFilter : +class RTK_EXPORT CudaForwardWarpImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, rtk::ForwardWarpImageFilter< itk::CudaImage, itk::CudaImage, itk::CudaImage, 3> > > { @@ -69,7 +69,7 @@ class CudaForwardWarpImageFilter : itkTypeMacro(CudaForwardWarpImageFilter, Superclass); protected: - rtkcuda_EXPORT CudaForwardWarpImageFilter(); + CudaForwardWarpImageFilter(); virtual ~CudaForwardWarpImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkCudaInterpolateImageFilter.h b/include/rtkCudaInterpolateImageFilter.h index 82972e136..23008538d 100644 --- a/include/rtkCudaInterpolateImageFilter.h +++ b/include/rtkCudaInterpolateImageFilter.h @@ -40,7 +40,7 @@ namespace rtk * * \ingroup CudaImageToImageFilter */ -class ITK_EXPORT CudaInterpolateImageFilter : +class RTK_EXPORT CudaInterpolateImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, InterpolatorWithKnownWeightsImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -58,7 +58,7 @@ class ITK_EXPORT CudaInterpolateImageFilter : itkTypeMacro(CudaInterpolateImageFilter, InterpolatorWithKnownWeightsImageFilter) protected: - rtkcuda_EXPORT CudaInterpolateImageFilter(); + CudaInterpolateImageFilter(); ~CudaInterpolateImageFilter(){ } diff --git a/include/rtkCudaIterativeFDKConeBeamReconstructionFilter.h b/include/rtkCudaIterativeFDKConeBeamReconstructionFilter.h index 9ae988daa..25c3348f5 100644 --- a/include/rtkCudaIterativeFDKConeBeamReconstructionFilter.h +++ b/include/rtkCudaIterativeFDKConeBeamReconstructionFilter.h @@ -48,7 +48,7 @@ namespace rtk * * \ingroup ReconstructionAlgorithm CudaImageToImageFilter */ -class CudaIterativeFDKConeBeamReconstructionFilter : +class RTK_EXPORT CudaIterativeFDKConeBeamReconstructionFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, IterativeFDKConeBeamReconstructionFilter< itk::CudaImage, itk::CudaImage, float > > { @@ -72,7 +72,7 @@ class CudaIterativeFDKConeBeamReconstructionFilter : itkTypeMacro(CudaIterativeFDKConeBeamReconstructionFilter, IterativeFDKConeBeamReconstructionFilter); protected: - rtkcuda_EXPORT CudaIterativeFDKConeBeamReconstructionFilter(); + CudaIterativeFDKConeBeamReconstructionFilter(); ~CudaIterativeFDKConeBeamReconstructionFilter(){} virtual void GPUGenerateData(); diff --git a/include/rtkCudaLagCorrectionImageFilter.h b/include/rtkCudaLagCorrectionImageFilter.h index e1f91246d..4b4429192 100644 --- a/include/rtkCudaLagCorrectionImageFilter.h +++ b/include/rtkCudaLagCorrectionImageFilter.h @@ -43,7 +43,7 @@ namespace rtk * * \author Sebastien Brousmiche */ -class CudaLagCorrectionImageFilter : +class RTK_EXPORT CudaLagCorrectionImageFilter : public itk::CudaInPlaceImageFilter < itk::CudaImage, itk::CudaImage, LagCorrectionImageFilter < itk::CudaImage, 4> > { @@ -66,7 +66,7 @@ class CudaLagCorrectionImageFilter : protected: /** Standard constructor **/ - rtkcuda_EXPORT CudaLagCorrectionImageFilter(); + CudaLagCorrectionImageFilter(); /** Destructor **/ virtual ~CudaLagCorrectionImageFilter(); diff --git a/include/rtkCudaLaplacianImageFilter.h b/include/rtkCudaLaplacianImageFilter.h index 18ffa549b..56cd53be6 100644 --- a/include/rtkCudaLaplacianImageFilter.h +++ b/include/rtkCudaLaplacianImageFilter.h @@ -38,9 +38,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaLaplacianImageFilter : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - LaplacianImageFilter< itk::CudaImage, itk::CudaImage,3> > > +class RTK_EXPORT CudaLaplacianImageFilter : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + LaplacianImageFilter< itk::CudaImage, itk::CudaImage,3> > > { public: /** Standard class typedefs. */ @@ -58,7 +58,7 @@ namespace rtk itkTypeMacro(CudaLaplacianImageFilter, LaplacianImageFilter) protected: - rtkcuda_EXPORT CudaLaplacianImageFilter(); + CudaLaplacianImageFilter(); ~CudaLaplacianImageFilter(){} virtual void GPUGenerateData(); diff --git a/include/rtkCudaLastDimensionTVDenoisingImageFilter.h b/include/rtkCudaLastDimensionTVDenoisingImageFilter.h index 3de5f2cfd..2047348eb 100644 --- a/include/rtkCudaLastDimensionTVDenoisingImageFilter.h +++ b/include/rtkCudaLastDimensionTVDenoisingImageFilter.h @@ -41,9 +41,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaLastDimensionTVDenoisingImageFilter : - public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, - TotalVariationDenoisingBPDQImageFilter< itk::CudaImage, itk::CudaImage< itk::CovariantVector < float, 1 >, 4 > > > +class RTK_EXPORT CudaLastDimensionTVDenoisingImageFilter : + public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, + TotalVariationDenoisingBPDQImageFilter< itk::CudaImage, itk::CudaImage< itk::CovariantVector < float, 1 >, 4 > > > { public: /** Standard class typedefs. */ @@ -61,7 +61,7 @@ namespace rtk itkTypeMacro(CudaLastDimensionTVDenoisingImageFilter, TotalVariationDenoisingBPDQImageFilter) protected: - rtkcuda_EXPORT CudaLastDimensionTVDenoisingImageFilter(); + CudaLastDimensionTVDenoisingImageFilter(); ~CudaLastDimensionTVDenoisingImageFilter(){} virtual void GPUGenerateData(); diff --git a/include/rtkCudaParkerShortScanImageFilter.h b/include/rtkCudaParkerShortScanImageFilter.h index dbfa8b8f6..9ecc17bb6 100644 --- a/include/rtkCudaParkerShortScanImageFilter.h +++ b/include/rtkCudaParkerShortScanImageFilter.h @@ -44,7 +44,7 @@ namespace rtk * \author peter * \version 0.1 */ -class CudaParkerShortScanImageFilter : +class RTK_EXPORT CudaParkerShortScanImageFilter : public itk::CudaInPlaceImageFilter, itk::CudaImage, rtk::ParkerShortScanImageFilter > > { @@ -68,7 +68,7 @@ class CudaParkerShortScanImageFilter : protected: /** Standard constructor **/ - rtkcuda_EXPORT CudaParkerShortScanImageFilter(); + CudaParkerShortScanImageFilter(); /** Destructor **/ virtual ~CudaParkerShortScanImageFilter(); diff --git a/include/rtkCudaPolynomialGainCorrectionImageFilter.h b/include/rtkCudaPolynomialGainCorrectionImageFilter.h index 7f7ae8a48..b3e47b65e 100644 --- a/include/rtkCudaPolynomialGainCorrectionImageFilter.h +++ b/include/rtkCudaPolynomialGainCorrectionImageFilter.h @@ -43,7 +43,7 @@ namespace rtk * * \author Sebastien Brousmiche */ -class CudaPolynomialGainCorrectionImageFilter : +class RTK_EXPORT CudaPolynomialGainCorrectionImageFilter : public itk::CudaInPlaceImageFilter < itk::CudaImage, itk::CudaImage, PolynomialGainCorrectionImageFilter , itk::CudaImage > > { @@ -67,7 +67,7 @@ class CudaPolynomialGainCorrectionImageFilter : protected: /** Standard constructor **/ - rtkcuda_EXPORT CudaPolynomialGainCorrectionImageFilter(); + CudaPolynomialGainCorrectionImageFilter(); /** Destructor **/ virtual ~CudaPolynomialGainCorrectionImageFilter(); diff --git a/include/rtkCudaRayCastBackProjectionImageFilter.h b/include/rtkCudaRayCastBackProjectionImageFilter.h index c99908924..2551d8897 100644 --- a/include/rtkCudaRayCastBackProjectionImageFilter.h +++ b/include/rtkCudaRayCastBackProjectionImageFilter.h @@ -46,7 +46,7 @@ namespace rtk * * \ingroup Projector CudaImageToImageFilter */ -class CudaRayCastBackProjectionImageFilter : +class RTK_EXPORT CudaRayCastBackProjectionImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, BackProjectionImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -81,7 +81,7 @@ class CudaRayCastBackProjectionImageFilter : itkSetMacro(Normalize, bool); protected: - rtkcuda_EXPORT CudaRayCastBackProjectionImageFilter(); + CudaRayCastBackProjectionImageFilter(); virtual ~CudaRayCastBackProjectionImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkCudaSplatImageFilter.h b/include/rtkCudaSplatImageFilter.h index 99c856013..caabb7cd1 100644 --- a/include/rtkCudaSplatImageFilter.h +++ b/include/rtkCudaSplatImageFilter.h @@ -40,7 +40,7 @@ namespace rtk * * \ingroup CudaImageToImageFilter */ -class ITK_EXPORT CudaSplatImageFilter : +class RTK_EXPORT CudaSplatImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, SplatWithKnownWeightsImageFilter< itk::CudaImage, itk::CudaImage > > @@ -59,7 +59,7 @@ class ITK_EXPORT CudaSplatImageFilter : itkTypeMacro(CudaSplatImageFilter, SplatWithKnownWeightsImageFilter) protected: - rtkcuda_EXPORT CudaSplatImageFilter(); + CudaSplatImageFilter(); ~CudaSplatImageFilter(){ } diff --git a/include/rtkCudaTotalVariationDenoisingBPDQImageFilter.h b/include/rtkCudaTotalVariationDenoisingBPDQImageFilter.h index c351e36d0..0cee3590d 100644 --- a/include/rtkCudaTotalVariationDenoisingBPDQImageFilter.h +++ b/include/rtkCudaTotalVariationDenoisingBPDQImageFilter.h @@ -40,9 +40,9 @@ namespace rtk * \ingroup CudaImageToImageFilter */ - class ITK_EXPORT CudaTotalVariationDenoisingBPDQImageFilter : - public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, - TotalVariationDenoisingBPDQImageFilter< itk::CudaImage, itk::CudaImage< itk::CovariantVector < float, 3 >, 3 > > > +class RTK_EXPORT CudaTotalVariationDenoisingBPDQImageFilter : + public itk::CudaImageToImageFilter< itk::CudaImage, itk::CudaImage, + TotalVariationDenoisingBPDQImageFilter< itk::CudaImage, itk::CudaImage< itk::CovariantVector < float, 3 >, 3 > > > { public: /** Standard class typedefs. */ @@ -60,7 +60,7 @@ namespace rtk itkTypeMacro(CudaTotalVariationDenoisingBPDQImageFilter, TotalVariationDenoisingBPDQImageFilter) protected: - rtkcuda_EXPORT CudaTotalVariationDenoisingBPDQImageFilter(); + CudaTotalVariationDenoisingBPDQImageFilter(); ~CudaTotalVariationDenoisingBPDQImageFilter(){ } diff --git a/include/rtkCudaWarpBackProjectionImageFilter.h b/include/rtkCudaWarpBackProjectionImageFilter.h index 23c0b2c0c..0d3155858 100644 --- a/include/rtkCudaWarpBackProjectionImageFilter.h +++ b/include/rtkCudaWarpBackProjectionImageFilter.h @@ -44,7 +44,7 @@ namespace rtk * * \ingroup Projector CudaImageToImageFilter */ -class rtkcuda_EXPORT CudaWarpBackProjectionImageFilter : +class RTK_EXPORT CudaWarpBackProjectionImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, BackProjectionImageFilter< itk::CudaImage, itk::CudaImage > > { @@ -83,7 +83,7 @@ class rtkcuda_EXPORT CudaWarpBackProjectionImageFilter : protected: CudaWarpBackProjectionImageFilter(); - virtual ~CudaWarpBackProjectionImageFilter() {}; + ~CudaWarpBackProjectionImageFilter() {}; virtual void GenerateInputRequestedRegion(); diff --git a/include/rtkCudaWarpBackProjectionImageFilter.hcu b/include/rtkCudaWarpBackProjectionImageFilter.hcu index 5a30690dd..393253d98 100644 --- a/include/rtkCudaWarpBackProjectionImageFilter.hcu +++ b/include/rtkCudaWarpBackProjectionImageFilter.hcu @@ -19,10 +19,8 @@ #ifndef __rtkCudaWarpBackProjectionImageFilter_hcu #define __rtkCudaWarpBackProjectionImageFilter_hcu -#include "rtkWin32Header.h" - void -rtkcuda_EXPORT CUDA_warp_back_project(int projSize[3], +CUDA_warp_back_project(int projSize[3], int volSize[3], int dvf_size[3], float *matrices, diff --git a/include/rtkCudaWarpForwardProjectionImageFilter.h b/include/rtkCudaWarpForwardProjectionImageFilter.h index f7cbff336..0e9529cea 100644 --- a/include/rtkCudaWarpForwardProjectionImageFilter.h +++ b/include/rtkCudaWarpForwardProjectionImageFilter.h @@ -44,7 +44,7 @@ namespace rtk { -class rtkcuda_EXPORT CudaWarpForwardProjectionImageFilter : +class RTK_EXPORT CudaWarpForwardProjectionImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, ForwardProjectionImageFilter< itk::CudaImage, itk::CudaImage > > { diff --git a/include/rtkCudaWarpForwardProjectionImageFilter.hcu b/include/rtkCudaWarpForwardProjectionImageFilter.hcu index 52cb26d73..dc10897e4 100644 --- a/include/rtkCudaWarpForwardProjectionImageFilter.hcu +++ b/include/rtkCudaWarpForwardProjectionImageFilter.hcu @@ -19,10 +19,8 @@ #ifndef __rtkCudaWarpForwardProjectionImageFilter_hcu #define __rtkCudaWarpForwardProjectionImageFilter_hcu -#include "rtkWin32Header.h" - void -rtkcuda_EXPORT CUDA_warp_forward_project(int projSize[3], +CUDA_warp_forward_project(int projSize[3], int volSize[3], int dvfSize[3], float *matrices, diff --git a/include/rtkCudaWarpImageFilter.h b/include/rtkCudaWarpImageFilter.h index aece52553..8278f4613 100644 --- a/include/rtkCudaWarpImageFilter.h +++ b/include/rtkCudaWarpImageFilter.h @@ -43,7 +43,7 @@ namespace rtk * * \ingroup CudaImageToImageFilter */ -class CudaWarpImageFilter : +class RTK_EXPORT CudaWarpImageFilter : public itk::CudaInPlaceImageFilter< itk::CudaImage, itk::CudaImage, itk::WarpImageFilter< itk::CudaImage, itk::CudaImage, itk::CudaImage, 3> > > { @@ -68,7 +68,7 @@ class CudaWarpImageFilter : itkTypeMacro(CudaWarpImageFilter, Superclass); protected: - rtkcuda_EXPORT CudaWarpImageFilter(); + CudaWarpImageFilter(); virtual ~CudaWarpImageFilter() {}; virtual void GPUGenerateData(); diff --git a/include/rtkMedianImageFilter.h b/include/rtkMedianImageFilter.h index 9342f8759..6ab7751a4 100644 --- a/include/rtkMedianImageFilter.h +++ b/include/rtkMedianImageFilter.h @@ -45,7 +45,7 @@ namespace rtk //FIXME: not templated yet //template typedef itk::Image TImage; -class ITK_EXPORT MedianImageFilter: +class RTK_EXPORT MedianImageFilter: public itk::ImageToImageFilter< TImage, TImage > { public: diff --git a/include/rtkWin32Header.h b/include/rtkWin32Header.h index 2dca42a9d..f7edf15bd 100644 --- a/include/rtkWin32Header.h +++ b/include/rtkWin32Header.h @@ -31,27 +31,4 @@ #define RTK_EXPORT #endif - -#if (defined(_WIN32) || defined(WIN32)) && defined(RTK_BUILD_SHARED_LIBS) -# ifdef rtkcuda_EXPORTS -# define rtkcuda_EXPORT __declspec(dllexport) -# else -# define rtkcuda_EXPORT __declspec(dllimport) -# endif /* RTK_EXPORT */ -#else -/* unix needs nothing */ -#define rtkcuda_EXPORT -#endif - -#if (defined(_WIN32) || defined(WIN32)) && defined(RTK_BUILD_SHARED_LIBS) -# ifdef ITKCudaCommon_EXPORTS -# define ITKCudaCommon_EXPORT __declspec(dllexport) -# else -# define ITKCudaCommon_EXPORT __declspec(dllimport) -# endif /* RTK_EXPORT */ -#else -/* unix needs nothing */ -#define ITKCudaCommon_EXPORT -#endif - #endif diff --git a/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h b/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h index 6b550dd8a..542e0727e 100644 --- a/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h +++ b/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h @@ -20,7 +20,9 @@ #include "rtkMacro.h" #include "rtkThreeDCircularProjectionGeometryXMLFile.h" -#include "itkProcessObject.h" +#include "rtkWin32Header.h" + +#include #include @@ -29,6 +31,10 @@ namespace rtk { /** \class ThreeDCircularProjectionGeometryXMLFileReader * \brief Reads in an RTK 3D circular geometry as XML + * This class shadows rtk::ThreeDCircularProjectionGeometryXMLFileReader + * defined in rtkThreeDCircularProjectionGeometryXMLFile.h to expose the + * reader when wrapping RTK for python. + * \sa rtkThreeDCircularProjectionGeometryXMLFile.h */ class RTK_EXPORT ThreeDCircularProjectionGeometryXMLFileReader : public itk::ProcessObject @@ -63,7 +69,7 @@ namespace rtk { GeometryPointer GetOutput(); protected: - ThreeDCircularProjectionGeometryXMLFileReader(void); + ThreeDCircularProjectionGeometryXMLFileReader(); ~ThreeDCircularProjectionGeometryXMLFileReader() {} //void PrintSelf(std::ostream & os, itk::Indent indent) const; @@ -77,8 +83,4 @@ namespace rtk { } } -#ifndef ITK_MANUAL_INSTANTIATION - #include "srtkThreeDCircularProjectionGeometryXMLFileReader.hxx" -#endif - #endif diff --git a/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h b/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h index 90ace776c..c3b361b64 100644 --- a/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h +++ b/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h @@ -20,7 +20,9 @@ #include "rtkMacro.h" #include "rtkThreeDCircularProjectionGeometryXMLFile.h" -#include "itkProcessObject.h" +#include "rtkWin32Header.h" + +#include #include @@ -28,7 +30,11 @@ namespace rtk { namespace simple { /** \class ThreeDCircularProjectionGeometryXMLFileWriter - * \brief Reads in an RTK 3D circular geometry as XML + * \brief Writes an RTK 3D circular geometry to an XML file + * This class shadows rtk::ThreeDCircularProjectionGeometryXMLFileWriter + * defined in rtkThreeDCircularProjectionGeometryXMLFile.h to expose the + * writer when wrapping RTK for python. + * \sa rtkThreeDCircularProjectionGeometryXMLFile.h */ class RTK_EXPORT ThreeDCircularProjectionGeometryXMLFileWriter : public itk::ProcessObject @@ -61,7 +67,7 @@ namespace rtk { void SetInput(GeometryType* geometry); protected: - ThreeDCircularProjectionGeometryXMLFileWriter(void); + ThreeDCircularProjectionGeometryXMLFileWriter(); ~ThreeDCircularProjectionGeometryXMLFileWriter() {} //void PrintSelf(std::ostream & os, itk::Indent indent) const; @@ -75,8 +81,4 @@ namespace rtk { } } -#ifndef ITK_MANUAL_INSTANTIATION -#include "srtkThreeDCircularProjectionGeometryXMLFileWriter.hxx" -#endif - #endif diff --git a/itk-module-init.cmake b/itk-module-init.cmake index c5bd021dd..87ca2c1c5 100644 --- a/itk-module-init.cmake +++ b/itk-module-init.cmake @@ -5,7 +5,12 @@ list(APPEND CMAKE_MODULE_PATH ${RTK_SOURCE_DIR}/cmake) find_package(CUDA_wrap QUIET) if(CUDA_FOUND) - set(RTK_USE_CUDA_DEFAULT ON) + if(${CUDA_VERSION} LESS 4.1) + message(WARNING "CUDA version ${CUDA_VERSION} is not supported by RTK.") + set(RTK_USE_CUDA_DEFAULT OFF) + else() + set(RTK_USE_CUDA_DEFAULT ON) + endif() else() set(RTK_USE_CUDA_DEFAULT OFF) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23046c4ee..3aefd032e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,6 +41,8 @@ set(RTK_SRCS rtkXRadGeometryReader.cxx rtkXRadImageIO.cxx rtkXRadImageIOFactory.cxx + srtkThreeDCircularProjectionGeometryXMLFileReader.cxx + srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx ) #========================================================= @@ -114,12 +116,9 @@ if (RTK_USE_CUDA) endif () #========================================================= -add_library(RTK ${RTK_SRCS}) +itk_module_add_library(RTK ${RTK_SRCS}) target_link_libraries(RTK LINK_PUBLIC lpsolve55) if (RTK_USE_CUDA) target_link_libraries( RTK LINK_PUBLIC ${CUDA_LIBRARIES} ${CUDA_cufft_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} ) endif () - -itk_module_link_dependencies() -itk_module_target(RTK) \ No newline at end of file diff --git a/include/srtkThreeDCircularProjectionGeometryXMLFileReader.hxx b/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx similarity index 93% rename from include/srtkThreeDCircularProjectionGeometryXMLFileReader.hxx rename to src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx index 2151f0044..4094a19e6 100644 --- a/include/srtkThreeDCircularProjectionGeometryXMLFileReader.hxx +++ b/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx @@ -15,9 +15,6 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __srtkThreeDCircularProjectionGeometryXMLFileReader_hxx -#define __srtkThreeDCircularProjectionGeometryXMLFileReader_hxx - #include "srtkThreeDCircularProjectionGeometryXMLFileReader.h" #include @@ -25,7 +22,7 @@ namespace rtk { namespace simple { ThreeDCircularProjectionGeometryXMLFileReader -::ThreeDCircularProjectionGeometryXMLFileReader(void) +::ThreeDCircularProjectionGeometryXMLFileReader() { this->m_Reader = rtk::ThreeDCircularProjectionGeometryXMLFileReader::New(); } @@ -83,5 +80,3 @@ ::GetOutput() } // end namespace simple } // end namespace rtk - -#endif \ No newline at end of file diff --git a/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.hxx b/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx similarity index 89% rename from include/srtkThreeDCircularProjectionGeometryXMLFileWriter.hxx rename to src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx index d25ec6368..996458847 100644 --- a/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.hxx +++ b/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx @@ -15,9 +15,6 @@ * limitations under the License. * *=========================================================================*/ -#ifndef __srtkThreeDCircularProjectionGeometryXMLFileWriter_hxx -#define __srtkThreeDCircularProjectionGeometryXMLFileWriter_hxx - #include "srtkThreeDCircularProjectionGeometryXMLFileWriter.h" #include @@ -25,7 +22,7 @@ namespace rtk { namespace simple { ThreeDCircularProjectionGeometryXMLFileWriter -::ThreeDCircularProjectionGeometryXMLFileWriter(void) +::ThreeDCircularProjectionGeometryXMLFileWriter() { this->m_Writer = rtk::ThreeDCircularProjectionGeometryXMLFileWriter::New(); } @@ -62,5 +59,3 @@ ::SetInput(GeometryType* geometry) } // end namespace simple } // end namespace rtk - -#endif \ No newline at end of file diff --git a/test/rtkdigisenstest.cxx b/test/rtkdigisenstest.cxx index abb27e079..10a178286 100644 --- a/test/rtkdigisenstest.cxx +++ b/test/rtkdigisenstest.cxx @@ -1,7 +1,8 @@ #include "rtkTest.h" -#include "rtkProjectionsReader.h" #include "rtkMacro.h" #include "rtkDigisensGeometryReader.h" +#include "rtkProjectionsReader.h" +#include "rtkThreeDCircularProjectionGeometryXMLFile.h" #include diff --git a/test/rtkfdkprojweightcompcudatest.cxx b/test/rtkfdkprojweightcompcudatest.cxx index 6dcb3fdf2..1ffd9e8c4 100644 --- a/test/rtkfdkprojweightcompcudatest.cxx +++ b/test/rtkfdkprojweightcompcudatest.cxx @@ -3,6 +3,7 @@ #include "rtkCudaFDKWeightProjectionFilter.h" #include "rtkConstantImageSource.h" #include "rtkSheppLoganPhantomFilter.h" +#include "rtkThreeDCircularProjectionGeometry.h" #include #if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 4) diff --git a/test/rtkimagxtest.cxx b/test/rtkimagxtest.cxx index 6b3446194..8cab32cd1 100644 --- a/test/rtkimagxtest.cxx +++ b/test/rtkimagxtest.cxx @@ -1,7 +1,8 @@ #include "rtkTest.h" -#include "rtkProjectionsReader.h" #include "rtkMacro.h" #include "rtkImagXGeometryReader.h" +#include "rtkProjectionsReader.h" +#include "rtkThreeDCircularProjectionGeometryXMLFile.h" /** * \file rtkimagxtest.cxx diff --git a/utilities/ITKCudaCommon/include/itkCudaUtil.h b/utilities/ITKCudaCommon/include/itkCudaUtil.h index 480b24607..3db564873 100644 --- a/utilities/ITKCudaCommon/include/itkCudaUtil.h +++ b/utilities/ITKCudaCommon/include/itkCudaUtil.h @@ -42,7 +42,7 @@ namespace itk * provides the GPU kernel source code as a const char* */ #define itkCudaKernelClassMacro(kernel) \ -class ITK_EXPORT kernel \ +class ITKCudaCommon_EXPORT kernel \ { \ public: \ static std::string GetCudaPTXSource(); \ diff --git a/utilities/ITKCudaCommon/include/itkCudaWin32Header.h b/utilities/ITKCudaCommon/include/itkCudaWin32Header.h index 71ed1a618..f0e6db7c1 100644 --- a/utilities/ITKCudaCommon/include/itkCudaWin32Header.h +++ b/utilities/ITKCudaCommon/include/itkCudaWin32Header.h @@ -19,8 +19,9 @@ #define itkCudaWin32Header_h #include "itkConfigure.h" +#include "rtkConfiguration.h" -#if (defined(_WIN32) || defined(WIN32)) && defined(ITK_BUILD_SHARED_LIBS) +#if (defined(_WIN32) || defined(WIN32)) && defined(RTK_BUILD_SHARED_LIBS) # ifdef ITKCudaCommon_EXPORTS # define ITKCudaCommon_EXPORT __declspec(dllexport) # else diff --git a/utilities/SimpleRTK/.gitignore b/utilities/SimpleRTK/.gitignore deleted file mode 100644 index 978c8b814..000000000 --- a/utilities/SimpleRTK/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store -build -*.o -\#*\# -*\# -*~ -*.pyc -*.orig -.ExternalData diff --git a/utilities/SimpleRTK/CMake/CTestCustom.cmake.in b/utilities/SimpleRTK/CMake/CTestCustom.cmake.in deleted file mode 100644 index d576e92ee..000000000 --- a/utilities/SimpleRTK/CMake/CTestCustom.cmake.in +++ /dev/null @@ -1,73 +0,0 @@ -SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 99) -SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 999) - -# test to ignore for memcheck -SET (CTEST_CUSTOM_MEMCHECK_IGNORE - "ProcessObjectDeathTest.DeleteCommandActiveProcess" - ) - -SET(CTEST_CUSTOM_COVERAGE_EXCLUDE - ${CTEST_CUSTOM_COVERAGE_EXCLUDE} - - # Exclude try_compile sources from coverage results: - "/CMakeFiles/CMakeTmp/" - - # Exclude files from the Testing directories - ".*/Testing/.*" - - # Exclude files from the Utilities directories - ".*/Utilities/.*" - - # exclude certain wrapping files - "/Wrapping/SimpleRTKLuaMain.cxx" - "/Wrapping/.*_wrap.cxx" - ) - -SET(CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} - - # Ignore warning for files with no symbols - "warning LNK4221.*not define any previously undefined public symbols" - "warning LNK4221.*no public symbols found" - ".*ranlib:.*file:.*has no symbols" - "libtool:.*file:.*has no symbols" - - # Ignore warning building SWIG - "Swig-prefix/src/Swig" - "parser.y.*warning" - - # Ignore warning building PCRE - "PCRE-prefix/src/PCRE" - - # Ignore apple warning - "ld.*warning.*duplicate dylib.*" - - # Ignore warning from the SWIG wrapped file ( not much we can do about those ) - ".*_wrap.cxx" - - # Ignore warning in lua about the use of `tmpnam' is dangerous - "loslib" - - # RH5 GCC 4.1 is producing warnings internally for functional headers - "mu_iterate.h.*warning? unused parameter '__tuple'" - - # Ignore CSharp invalid version warning for dev - "warning CS1607.*The version number.*dev.*is invalid" - "warning CS1607.*The version.*dev.*is not in the normal" - - # Warning when building R, issue related to make file - "warning: jobserver unavailable:" - - # Warning when compiling ITK v4.5.1 with clang - "clang: warning: argument unused during.*-fno-ipa-cp-clone" - - # Warning from RHEL5 GCC 4.1 about visibility change - "warning: lowering visibility of .* to match its type" - - # Warning from SWIG with self member type - "srtkCommand.* [wW]arning 314.*self.*is a python keyword" - - # Warning from RH5 gcc 4.1.2 - "tr1/mu_iterate.h.* warning: unused parameter '__tuple'" -) - diff --git a/utilities/SimpleRTK/CMake/FindCSharp.cmake b/utilities/SimpleRTK/CMake/FindCSharp.cmake deleted file mode 100644 index ba15f6843..000000000 --- a/utilities/SimpleRTK/CMake/FindCSharp.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# -# A CMake Module for finding and using C# (.NET and Mono). -# -# The following variables are set: -# CSHARP_FOUND - set to ON if C# is found -# CSHARP_USE_FILE - the path to the C# use file -# CSHARP_TYPE - the type of the C# compiler (eg. ".NET" or "Mono") -# CSHARP_VERSION - the version of the C# compiler (eg. "v4.0" or "2.10.2") -# CSHARP_COMPILER - the path to the C# compiler executable (eg. "C:/Windows/Microsoft.NET/Framework/v4.0.30319/csc.exe" or "/usr/bin/gmcs") -# CSHARP_INTERPRETER - the path to interpreter needed to run CSharp executables -# CSHARP_PLATFORM - the C# target platform -# CSHARP_SDK - the SDK commandline switch (empty for .NET, for Mono eg. "/sdk:2" or "/sdk:4") -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindCSharp.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -# TODO: ADD ABILITY TO SELECT WHICH C# COMPILER eg. .NET or Mono (if both exist). For the moment, .NET is selected above Mono. - -# Make sure find package macros are included -include( FindPackageHandleStandardArgs ) - -unset( CSHARP_COMPILER CACHE ) -unset( CSHARP_INTERPRETER CACHE ) -unset( CSHARP_TYPE CACHE ) -unset( CSHARP_VERSION CACHE ) -unset( CSHARP_FOUND CACHE ) - -# By default use anycpu platform, allow the user to override -set( CSHARP_PLATFORM "anycpu" CACHE STRING "C# target platform: x86, x64, anycpu, or itanium" ) -if( NOT ${CSHARP_PLATFORM} MATCHES "x86|x64|anycpu|itanium" ) - message( FATAL_ERROR "The C# target platform '${CSHARP_PLATFORM}' is not valid. Please enter one of the following: x86, x64, anycpu, or itanium" ) -endif( ) - -if( WIN32 ) - find_package( DotNetFrameworkSdk ) - if( NOT CSHARP_DOTNET_FOUND ) - find_package( Mono ) - endif( ) -else( UNIX ) - find_package( Mono ) -endif( ) - -if( CSHARP_DOTNET_FOUND ) - set( CSHARP_TYPE ".NET" CACHE STRING "Using the .NET compiler" ) - set( CSHARP_VERSION ${CSHARP_DOTNET_VERSION} CACHE STRING "C# .NET compiler version" FORCE ) - set( CSHARP_COMPILER ${CSHARP_DOTNET_COMPILER_${CSHARP_DOTNET_VERSION}} CACHE STRING "Full path to .NET compiler" FORCE ) - set( CSHARP_INTERPRETER "" CACHE INTERNAL "Interpretor not required for .NET" FORCE ) -elseif( CSHARP_MONO_FOUND ) - set( CSHARP_TYPE "Mono" CACHE STRING "Using the Mono compiler" ) - set( CSHARP_VERSION ${CSHARP_MONO_VERSION} CACHE STRING "C# Mono compiler version" FORCE ) - set( CSHARP_COMPILER ${CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION}} CACHE STRING "Full path to Mono compiler" FORCE ) - set( CSHARP_INTERPRETER ${CSHARP_MONO_INTERPRETER_${CSHARP_MONO_VERSION}} CACHE STRING "Full path to Mono interpretor" FORCE ) - set( CSHARP_SDK "/sdk:2" CACHE STRING "C# Mono SDK commandline switch (e.g. /sdk:2, /sdk:4, /sdk:5)" ) -endif( ) - -# Handle WIN32 specific issues -if ( WIN32 ) - if ( CSHARP_COMPILER MATCHES "bat" ) - set( CSHARP_COMPILER "call ${CSHARP_COMPILER}" ) - endif ( ) -endif( ) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CSharp DEFAULT_MSG CSHARP_TYPE CSHARP_VERSION CSHARP_COMPILER) - -mark_as_advanced( CSHARP_TYPE CSHARP_VERSION CSHARP_COMPILER CSHARP_INTERPRETER CSHARP_PLATFORM CSHARP_SDK ) - -# Set the USE_FILE path -# http://public.kitware.com/Bug/view.php?id=7757 -get_filename_component( current_list_path ${CMAKE_CURRENT_LIST_FILE} PATH ) -set( CSHARP_USE_FILE ${current_list_path}/UseCSharp.cmake ) diff --git a/utilities/SimpleRTK/CMake/FindDotNetFrameworkSdk.cmake b/utilities/SimpleRTK/CMake/FindDotNetFrameworkSdk.cmake deleted file mode 100644 index 3d84a536c..000000000 --- a/utilities/SimpleRTK/CMake/FindDotNetFrameworkSdk.cmake +++ /dev/null @@ -1,92 +0,0 @@ -# -# A CMake Module for finding C# .NET. -# -# The following variables are set: -# CSHARP_DOTNET_FOUND -# CSHARP_DOTNET_COMPILER_${version} eg. "CSHARP_DOTNET_COMPILER_v4.0.30319" -# CSHARP_DOTNET_VERSION eg. "v4.0.30319" -# CSHARP_DOTNET_VERSIONS eg. "v2.0.50727, v3.5, v4.0.30319" -# DotNetFrameworkSdk_USE_FILE -# -# Additional references can be found here: -# .NET SDK 1.1: http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d&displaylang=en -# .NET SDK 2.0: http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en -# .NET SDK 3.5: http://www.microsoft.com/downloads/details.aspx?familyid=333325fd-ae52-4e35-b531-508d977d32a6&displaylang=en -# C# Compiler options: http://msdn.microsoft.com/en-us/library/2fdbz5xd(v=VS.71).aspx -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindDotNETFrameworkSDK.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -set( csharp_dotnet_valid 1 ) -if( DEFINED CSHARP_DOTNET_FOUND ) - # The .NET compiler has already been found - # It may have been reset by the user, verify it is correct - if( NOT DEFINED CSHARP_DOTNET_COMPILER_${CSHARP_DOTNET_VERSION} ) - set( csharp_dotnet_version_user ${CSHARP_DOTNET_VERSION} ) - set( csharp_dotnet_valid 0 ) - set( CSHARP_DOTNET_FOUND 0 ) - set( CSHARP_DOTNET_VERSION "CSHARP_DOTNET_VERSION-NOTVALID" CACHE STRING "C# .NET compiler version, choices: ${CSHARP_DOTNET_VERSIONS}" FORCE ) - message( FATAL_ERROR "The C# .NET version '${csharp_dotnet_version_user}' is not valid. Please enter one of the following: ${CSHARP_DOTNET_VERSIONS}" ) - endif( ) -endif( ) - -unset( CSHARP_DOTNET_VERSIONS CACHE ) # Clear versions - -# Get the framework directory based on platform -if( ${CSHARP_PLATFORM} MATCHES "x64|itanium" ) - set( csharp_dotnet_framework_dir "$ENV{windir}/Microsoft.NET/Framework64" ) -else( ) - set( csharp_dotnet_framework_dir "$ENV{windir}/Microsoft.NET/Framework" ) -endif( ) - -# Search for .NET versions -string( REPLACE "\\" "/" csharp_dotnet_framework_dir ${csharp_dotnet_framework_dir} ) -file( GLOB_RECURSE csharp_dotnet_executables "${csharp_dotnet_framework_dir}/csc.exe" ) -list( SORT csharp_dotnet_executables ) -list( REVERSE csharp_dotnet_executables ) -foreach ( csharp_dotnet_executable ${csharp_dotnet_executables} ) - if( csharp_dotnet_valid ) - # Extract version number (eg. v4.0.30319) - # TODO: Consider using REGEX - string( REPLACE "${csharp_dotnet_framework_dir}/" "" csharp_dotnet_version_temp ${csharp_dotnet_executable} ) - string( REPLACE "/csc.exe" "" csharp_dotnet_version_temp ${csharp_dotnet_version_temp} ) - - # Add variable holding executable - set( CSHARP_DOTNET_COMPILER_${csharp_dotnet_version_temp} ${csharp_dotnet_executable} CACHE STRING "C# .NET compiler ${csharp_dotnet_version}" FORCE ) - mark_as_advanced( CSHARP_DOTNET_COMPILER_${csharp_dotnet_version_temp} ) - endif( ) - - # Create a list of supported compiler versions - if( NOT DEFINED CSHARP_DOTNET_VERSIONS ) - set( CSHARP_DOTNET_VERSIONS "${csharp_dotnet_version_temp}" CACHE STRING "Available C# .NET compiler versions" FORCE ) - else( ) - set( CSHARP_DOTNET_VERSIONS "${CSHARP_DOTNET_VERSIONS}, ${csharp_dotnet_version_temp}" CACHE STRING "Available C# .NET compiler versions" FORCE ) - endif( ) - mark_as_advanced( CSHARP_DOTNET_VERSIONS ) - - # We found at least one .NET compiler version - set( CSHARP_DOTNET_FOUND 1 CACHE INTERNAL "Boolean indicating if C# .NET was found" ) -endforeach( csharp_dotnet_executable ) - -if( CSHARP_DOTNET_FOUND ) - # Report the found versions - message( STATUS "Found the following C# .NET versions: ${CSHARP_DOTNET_VERSIONS}" ) - - # Set the compiler version - # Do not force, so that the user can manually select their own version if they wish - if ( DEFINED CSHARP_DOTNET_COMPILER_v2.0.50727 ) - # If available, select .NET v2.0.50727 (this is the minimal version as it supports generics, and allows use of VS2008) - set( CSHARP_DOTNET_VERSION "v2.0.50727" CACHE STRING "C# .NET compiler version" ) - else( ) - # Select the highest version (first in reverse sorted list) - list( GET CSHARP_DOTNET_VERSIONS 0 csharp_dotnet_version_temp ) - set( CSHARP_DOTNET_VERSION ${csharp_dotnet_version_temp} CACHE STRING "C# .NET compiler version" ) - endif( ) - mark_as_advanced( CSHARP_DOTNET_VERSION ) -endif( ) - -# Set USE_FILE -get_filename_component( current_list_path ${CMAKE_CURRENT_LIST_FILE} PATH ) -set( DotNetFrameworkSdk_USE_FILE ${current_list_path}/UseDotNetFrameworkSdk.cmake ) diff --git a/utilities/SimpleRTK/CMake/FindGTest.cmake b/utilities/SimpleRTK/CMake/FindGTest.cmake deleted file mode 100644 index 55b0edfbc..000000000 --- a/utilities/SimpleRTK/CMake/FindGTest.cmake +++ /dev/null @@ -1,211 +0,0 @@ -#.rst: -# FindGTest -# --------- -# -# Locate the Google C++ Testing Framework. -# -# Defines the following variables: -# -# :: -# -# GTEST_FOUND - Found the Google Testing framework -# GTEST_INCLUDE_DIRS - Include directories -# -# -# -# Also defines the library variables below as normal variables. These -# contain debug/optimized keywords when a debugging library is found. -# -# :: -# -# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main -# GTEST_LIBRARIES - libgtest -# GTEST_MAIN_LIBRARIES - libgtest-main -# -# -# -# Accepts the following variables as input: -# -# :: -# -# GTEST_ROOT - (as a CMake or environment variable) -# The root directory of the gtest install prefix -# -# -# -# :: -# -# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to -# "MD" or "MT" to enable searching a GTest build tree -# (defaults: "MD") -# -# -# -# Example Usage: -# -# :: -# -# enable_testing() -# find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) -# -# -# -# :: -# -# add_executable(foo foo.cc) -# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) -# -# -# -# :: -# -# add_test(AllTestsInFoo foo) -# -# -# -# -# -# If you would like each Google test to show up in CTest as a test you -# may use the following macro. NOTE: It will slow down your tests by -# running an executable for each test and test fixture. You will also -# have to rerun CMake after adding or removing tests or test fixtures. -# -# GTEST_ADD_TESTS(executable extra_args ARGN) -# -# :: -# -# executable = The path to the test executable -# extra_args = Pass a list of extra arguments to be passed to -# executable enclosed in quotes (or "" for none) -# ARGN = A list of source files to search for tests & test -# fixtures. Or AUTO to find them from executable target. -# -# -# -# :: -# -# Example: -# set(FooTestArgs --foo 1 --bar 2) -# add_executable(FooTest FooUnitTest.cc) -# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO) - -#============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman -# Copyright 2009 Daniel Blezek -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) -# -# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code - -function(GTEST_ADD_TESTS executable extra_args) - if(NOT ARGN) - message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") - endif() - if(ARGN STREQUAL "AUTO") - # obtain sources used for building that executable - get_property(ARGN TARGET ${executable} PROPERTY SOURCES) - endif() - set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*") - set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)") - foreach(source ${ARGN}) - file(READ "${source}" contents) - string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) - foreach(hit ${found_tests}) - string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit}) - - # Parameterized tests have a different signature for the filter - if("x${test_type}" STREQUAL "xTEST_P") - string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) - elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST") - string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) - elseif("x${test_type}" STREQUAL "xTYPED_TEST") - string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit}) - else() - message(WARNING "Could not parse GTest ${hit} for adding to CTest.") - continue() - endif() - add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args}) - endforeach() - endforeach() -endfunction() - -function(_gtest_append_debugs _endvar _library) - if(${_library} AND ${_library}_DEBUG) - set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) - else() - set(_output ${${_library}}) - endif() - set(${_endvar} ${_output} PARENT_SCOPE) -endfunction() - -function(_gtest_find_library _name) - find_library(${_name} - NAMES ${ARGN} - HINTS - ENV GTEST_ROOT - ${GTEST_ROOT} - PATH_SUFFIXES ${_gtest_libpath_suffixes} - ) - mark_as_advanced(${_name}) -endfunction() - -# - -if(NOT DEFINED GTEST_MSVC_SEARCH) - set(GTEST_MSVC_SEARCH MD) -endif() - -set(_gtest_libpath_suffixes lib) -if(MSVC) - if(GTEST_MSVC_SEARCH STREQUAL "MD") - list(APPEND _gtest_libpath_suffixes - msvc/gtest-md/Debug - msvc/gtest-md/Release) - elseif(GTEST_MSVC_SEARCH STREQUAL "MT") - list(APPEND _gtest_libpath_suffixes - msvc/gtest/Debug - msvc/gtest/Release) - endif() -endif() - - -find_path(GTEST_INCLUDE_DIR gtest/gtest.h - HINTS - $ENV{GTEST_ROOT}/include - ${GTEST_ROOT}/include -) -mark_as_advanced(GTEST_INCLUDE_DIR) - -if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") - # The provided /MD project files for Google Test add -md suffixes to the - # library names. - _gtest_find_library(GTEST_LIBRARY gtest-md gtest) - _gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd) - _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main) - _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind) -else() - _gtest_find_library(GTEST_LIBRARY gtest) - _gtest_find_library(GTEST_LIBRARY_DEBUG gtestd) - _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main) - _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) - -if(GTEST_FOUND) - set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) - _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) - _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) - set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) -endif() diff --git a/utilities/SimpleRTK/CMake/FindLuaInterp.cmake b/utilities/SimpleRTK/CMake/FindLuaInterp.cmake deleted file mode 100644 index ddb610db7..000000000 --- a/utilities/SimpleRTK/CMake/FindLuaInterp.cmake +++ /dev/null @@ -1,45 +0,0 @@ -#.rst: -# FindLuaInterp -# -------- -# -# Find Lua Interpreter -# -# :: -# -# LUA_EXECUTABLE - the full path to lua -# LUA_EXECUTABLE_FOUND - If false, don't attempt to use lua -# LUA_EXECUTABLE_VERSION_STRING - version of lua found - -find_program(LUA_EXECUTABLE - NAMES lua - ) - -if(LUA_EXECUTABLE) - ### LUA_VERSION - execute_process( - COMMAND ${LUA_EXECUTABLE} -v - OUTPUT_VARIABLE - LUA_EXECUTABLE_VERSION_STRING - ERROR_VARIABLE - LUA_EXECUTABLE_VERSION_STRING - RESULT_VARIABLE - LUA_VERSION_RESULT_VARIABLE - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if (NOT LUA_VERSION_RESULT_VARIABLE) - string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" - LUA_EXECUTABLE_VERSION - ${LUA_EXECUTABLE_VERSION_STRING} ) - endif() -endif() - - -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Lua - REQUIRED_VARS LUA_EXECUTABLE - VERSION_VAR LUA_VERSION_STRING) - -mark_as_advanced(LUA_EXECUTABLE) diff --git a/utilities/SimpleRTK/CMake/FindMono.cmake b/utilities/SimpleRTK/CMake/FindMono.cmake deleted file mode 100644 index ed2d1f469..000000000 --- a/utilities/SimpleRTK/CMake/FindMono.cmake +++ /dev/null @@ -1,162 +0,0 @@ -# -# A CMake Module for finding Mono. -# -# The following variables are set: -# CSHARP_MONO_FOUND -# CSHARP_MONO_COMPILER_${version} eg. "CSHARP_MONO_COMPILER_2.10.2" -# CSHARP_MONO_INTERPRETOR_${version} eg. "CSHARP_MONO_INTERPRETOR_2.10.2" -# CSHARP_MONO_VERSION eg. "2.10.2" -# CSHARP_MONO_VERSIONS eg. "2.10.2, 2.6.7" -# -# Additional references can be found here: -# http://www.mono-project.com/Main_Page -# http://www.mono-project.com/CSharp_Compiler -# http://mono-project.com/FAQ:_Technical (How can I tell where the Mono runtime is installed) -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindMono.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -set( csharp_mono_valid 1 ) -if( DEFINED CSHARP_MONO_FOUND ) - # The Mono compiler has already been found - # It may have been reset by the user, verify it is correct - if( NOT DEFINED CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) - set( csharp_mono_version_user ${CSHARP_MONO_VERSION} ) - set( csharp_mono_valid 0 ) - set( CSHARP_MONO_FOUND 0 ) - set( CSHARP_MONO_VERSION "CSHARP_MONO_VERSION-NOTVALID" CACHE STRING "C# Mono compiler version, choices: ${CSHARP_MONO_VERSIONS}" FORCE ) - message( FATAL_ERROR "The C# Mono version '${csharp_mono_version_user}' is not valid. Please enter one of the following: ${CSHARP_MONO_VERSIONS}" ) - endif( NOT DEFINED CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) -endif( DEFINED CSHARP_MONO_FOUND ) - -unset( CSHARP_MONO_VERSIONS CACHE ) # Clear versions -if( WIN32 ) - # Search for Mono on Win32 systems - # See http://mono-project.com/OldReleases and http://www.go-mono.com/mono-downloads/download.html - set( csharp_mono_bin_dirs ) - set( csharp_mono_search_hints - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.11.2;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.9;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.8;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.7;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.6;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.5;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.4;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.3;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.2;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.1;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.8;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.7;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.4;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.3;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.1;SdkInstallRoot]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6;SdkInstallRoot]/bin" - ) - foreach( csharp_mono_search_hint ${csharp_mono_search_hints} ) - get_filename_component( csharp_mono_bin_dir "${csharp_mono_search_hint}" ABSOLUTE ) - if ( EXISTS "${csharp_mono_bin_dir}" ) - set( csharp_mono_bin_dirs ${csharp_mono_bin_dirs} ${csharp_mono_bin_dir} ) - endif ( EXISTS "${csharp_mono_bin_dir}" ) - endforeach( csharp_mono_search_hint ) - # TODO: Use HKLM_LOCAL_MACHINE\Software\Novell\Mono\DefaultCLR to specify default version - # get_filename_component( test "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono;DefaultCLR]" NAME ) - - foreach ( csharp_mono_bin_dir ${csharp_mono_bin_dirs} ) - string( REPLACE "\\" "/" csharp_mono_bin_dir ${csharp_mono_bin_dir} ) - if (EXISTS "${csharp_mono_bin_dir}/dmcs.bat") - set( csharp_mono_executable "${csharp_mono_bin_dir}/dmcs.bat") - elseif (EXISTS "${csharp_mono_bin_dir}/gmcs.bat") - set( csharp_mono_executable "${csharp_mono_bin_dir}/gmcs.bat") - elseif (EXISTS "${csharp_mono_bin_dir}/mcs.bat") - set( csharp_mono_executable "${csharp_mono_bin_dir}/mcs.bat") - endif (EXISTS "${csharp_mono_bin_dir}/dmcs.bat") - - if( csharp_mono_valid ) - # Extract version number (eg. 2.10.2) - string(REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" csharp_mono_version_temp ${csharp_mono_bin_dir}) - set( CSHARP_MONO_VERSION ${csharp_mono_version_temp} CACHE STRING "C# Mono compiler version" ) - mark_as_advanced( CSHARP_MONO_VERSION ) - - # Add variable holding executable - set( CSHARP_MONO_COMPILER_${csharp_mono_version_temp} ${csharp_mono_executable} CACHE STRING "C# Mono compiler ${csharp_mono_version_temp}" FORCE ) - mark_as_advanced( CSHARP_MONO_COMPILER_${csharp_mono_version_temp} ) - - # Set interpreter - if (EXISTS "${csharp_mono_bin_dir}/mono.exe") - set( CSHARP_MONO_INTERPRETER_${csharp_mono_version_temp} "${csharp_mono_bin_dir}/mono.exe" CACHE STRING "C# Mono interpreter ${csharp_mono_version_temp}" FORCE ) - mark_as_advanced( CSHARP_MONO_INTERPRETER_${csharp_mono_version_temp} ) - endif (EXISTS "${csharp_mono_bin_dir}/mono.exe") - endif( csharp_mono_valid ) - - # Create a list of supported compiler versions - if( NOT DEFINED CSHARP_MONO_VERSIONS ) - set( CSHARP_MONO_VERSIONS "${csharp_mono_version_temp}" CACHE STRING "Available C# Mono compiler versions" FORCE ) - else( NOT DEFINED CSHARP_MONO_VERSIONS ) - set( CSHARP_MONO_VERSIONS "${CSHARP_MONO_VERSIONS}, ${csharp_mono_version_temp}" CACHE STRING "Available C# Mono versions" FORCE ) - endif( NOT DEFINED CSHARP_MONO_VERSIONS ) - mark_as_advanced( CSHARP_MONO_VERSIONS ) - - # We found at least one Mono compiler version - set( CSHARP_MONO_FOUND 1 CACHE INTERNAL "Boolean indicating if C# Mono was found" ) - endforeach( csharp_mono_bin_dir ) - -else( UNIX ) - # Search for Mono on non-Win32 systems - set( chsarp_mono_names "mcs" "mcs.exe" "dmcs" "dmcs.exe" "smcs" "smcs.exe" "gmcs" "gmcs.exe" ) - set( - csharp_mono_paths - "/usr/bin/" - "/usr/local/bin/" - "/usr/lib/mono/2.0" - "/opt/novell/mono/bin" - ) - find_program( - csharp_mono_compiler # variable is added to the cache, we removed it below - NAMES ${chsarp_mono_names} - PATHS ${csharp_mono_paths} - ) - - if( EXISTS ${csharp_mono_compiler} ) - # Determine version - find_program( - csharp_mono_interpreter # variable is added to the cache, we removed it below - NAMES mono - PATHS ${csharp_mono_paths} - ) - if ( EXISTS ${csharp_mono_interpreter} ) - execute_process( - COMMAND ${csharp_mono_interpreter} -V - OUTPUT_VARIABLE csharp_mono_version_string - ) - string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" csharp_mono_version_temp ${csharp_mono_version_string} ) - set( CSHARP_MONO_INTERPRETER_${CSHARP_MONO_VERSION} ${csharp_mono_interpreter} CACHE STRING "C# Mono interpreter ${csharp_mono_version_temp}" FORCE ) - mark_as_advanced( CSHARP_MONO_INTERPRETER_${CSHARP_MONO_VERSION} ) - endif ( EXISTS ${csharp_mono_interpreter} ) - unset( csharp_mono_interpreter CACHE ) - - # We found Mono compiler - set( CSHARP_MONO_VERSION ${csharp_mono_version_temp} CACHE STRING "C# Mono compiler version" ) - mark_as_advanced( CSHARP_MONO_VERSION ) - set( CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ${csharp_mono_compiler} CACHE STRING "C# Mono compiler ${CSHARP_MONO_VERSION}" FORCE ) - mark_as_advanced( CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) - set( CSHARP_MONO_VERSIONS ${CSHARP_MONO_VERSION} CACHE STRING "Available C# Mono compiler versions" FORCE ) - mark_as_advanced( CSHARP_MONO_VERSIONS ) - set( CSHARP_MONO_FOUND 1 CACHE INTERNAL "Boolean indicating if C# Mono was found" ) - endif( EXISTS ${csharp_mono_compiler} ) - - # Remove temp variable from cache - unset( csharp_mono_compiler CACHE ) - -endif( WIN32 ) - -if( CSHARP_MONO_FOUND ) - # Report the found versions - message( STATUS "Found the following C# Mono versions: ${CSHARP_MONO_VERSIONS}" ) -endif( CSHARP_MONO_FOUND ) - -# Set USE_FILE -get_filename_component( current_list_path ${CMAKE_CURRENT_LIST_FILE} PATH ) -set( Mono_USE_FILE ${current_list_path}/UseMono.cmake ) diff --git a/utilities/SimpleRTK/CMake/FindPythonVirtualEnv.cmake b/utilities/SimpleRTK/CMake/FindPythonVirtualEnv.cmake deleted file mode 100644 index 03df7946a..000000000 --- a/utilities/SimpleRTK/CMake/FindPythonVirtualEnv.cmake +++ /dev/null @@ -1,53 +0,0 @@ -#.rst: -# FindPythonVirtualEnv -# -------- -# -# Find Python's VirtualEnv Utility -# -# :: -# -# PYTHON_VIRTUALENV_SCRIPT - the full path to virtualenv -# PYTHON_VIRTUALENV_SCRIPT_FOUND - If false, don't attempt to use lua -# PYTHON_VIRTUALENV_VERSION_STRING - version of lua found - -find_program(PYTHON_VIRTUALENV_SCRIPT - NAMES virtualenv.py virtualenv - ) - -if(PYTHON_VIRTUALENV_SCRIPT) - - if ("${PYTHON_EXECUTABLE}" STREQUAL "") - find_package(PythonInterp REQUIRED) - endif() - - ### PYTHON_VIRTUALENV_VERSION - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_VIRTUALENV_SCRIPT} --version - OUTPUT_VARIABLE - PYTHON_VIRTUALENV_VERSION_STRING - ERROR_VARIABLE - PYTHON_VIRTUALENV_VERSION_STRING - RESULT_VARIABLE - PYTHON_VIRTUALENV_VERSION_RESULT_VARIABLE - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if (PYTHON_VIRTUALENV_VERSION_RESULT_VARIABLE) - message(ERROR "Unable to determing PythonVirtualEnv version!\n${PYTHON_VIRTUALENV_VERSION_STRING}") - set(PYTHON_VIRTUALENV_VERSION_STRING "") - else() - string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" - PYTHON_VIRTUALENV_VERSION - ${PYTHON_VIRTUALENV_VERSION_STRING} ) - endif() -endif() - - -# handle the QUIETLY and REQUIRED arguments and set PYTHON_VIRTUALENV_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PythonVirtualEnv - REQUIRED_VARS PYTHON_VIRTUALENV_SCRIPT - VERSION_VAR PYTHON_VIRTUALENV_VERSION_STRING) - -mark_as_advanced(PYTHON_VIRTUALENV_SCRIPT) diff --git a/utilities/SimpleRTK/CMake/FindR.cmake b/utilities/SimpleRTK/CMake/FindR.cmake deleted file mode 100644 index 63f37c5f0..000000000 --- a/utilities/SimpleRTK/CMake/FindR.cmake +++ /dev/null @@ -1,48 +0,0 @@ - -# -# - This module locates an installed R distribution. -# -# Defines the following: -# -# R_INCLUDE_DIR - Path to R include directory -# R_LIBRARIES - Path to R library -# R_LIBRARY_BASE - -# R_COMMAND - Path to R command -# RSCRIPT_EXECUTABLE - Path to Rscript command -# - - -# Make sure find package macros are included -include( FindPackageHandleStandardArgs ) - -set(TEMP_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE}) -set(CMAKE_FIND_APPBUNDLE "NEVER") -find_program(R_COMMAND R DOC "R executable.") -if(R_COMMAND) - execute_process(WORKING_DIRECTORY . COMMAND ${R_COMMAND} RHOME OUTPUT_VARIABLE R_BASE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) - set(R_HOME ${R_BASE_DIR} CACHE PATH "R home directory obtained from R RHOME") - mark_as_advanced(R_HOME) -endif(R_COMMAND) - -find_program(RSCRIPT_EXECUTABLE Rscript DOC "Rscript executable.") - -set(CMAKE_FIND_APPBUNDLE ${TEMP_CMAKE_FIND_APPBUNDLE}) - -# R.h gets installed in all sorts of places - -# ubuntu: /usr/share/R/include, RHEL/Fedora: /usr/include/R/R.h -find_path(R_INCLUDE_DIR R.h PATHS /usr/local/lib /usr/local/lib64 /usr/share /usr/include ${R_BASE_DIR} PATH_SUFFIXES include R R/include DOC "Path to file R.h") -find_library(R_LIBRARY_BASE R PATHS ${R_BASE_DIR} PATH_SUFFIXES /lib DOC "R library (example libR.a, libR.dylib, etc.).") - -set(R_LIBRARIES ${R_LIBRARY_BASE}) -mark_as_advanced(RSCRIPT_EXECUTABLE R_LIBRARIES R_INCLUDE_DIR R_COMMAND R_LIBRARY_BASE) - - -set( _REQUIRED_R_VARIABLES R_INCLUDE_DIR R_COMMAND ) - -if( APPLE ) - # On linux platform some times the libR.so is not available, however - # on apple a link error results if the library is linked. - list( APPEND _REQUIRED_R_VARIABLES R_LIBRARIES R_LIBRARY_BASE ) -endif() - -find_package_handle_standard_args(R DEFAULT_MSG ${_REQUIRED_R_VARIABLES} ) diff --git a/utilities/SimpleRTK/CMake/GetGitRevisionDescription.cmake b/utilities/SimpleRTK/CMake/GetGitRevisionDescription.cmake deleted file mode 100644 index f43b91e3a..000000000 --- a/utilities/SimpleRTK/CMake/GetGitRevisionDescription.cmake +++ /dev/null @@ -1,169 +0,0 @@ -# - Returns a version string from Git -# -# These functions force a re-configure on each git commit so that you can -# trust the values of the variables in your build system. -# -# get_git_head_revision( [ ...]) -# -# Returns the ref and sha hash of the current head revision -# -# git_describe( [ ...]) -# -# Returns the results of git describe on the source tree, and adjusting -# the output so that it tests false if an error occurs. -# -# git_get_exact_tag( [ ...]) -# -# Returns the results of git describe --exact-match on the source tree, -# and adjusting the output so that it tests false if there was no exact -# matching tag. -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -if(__get_git_revision_description) - return() -endif() -set(__get_git_revision_description YES) - -# We must run the following at "include" time, not at function call time, -# to find the path to this module rather than the path to a calling list file -get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) - -find_package(Git QUIET) - -function(get_git_head_revision _refvar _hashvar) - if(NOT GIT_EXECUTABLE) - set(${_refvar} "GIT-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - - set(src_dir ${PROJECT_SOURCE_DIR}) - set(bin_dir ${PROJECT_BINARY_DIR}) - - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir - WORKING_DIRECTORY ${src_dir} - OUTPUT_VARIABLE GIT_DIR - ERROR_VARIABLE error - RESULT_VARIABLE failed - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(NOT IS_ABSOLUTE "${GIT_DIR}") - set(GIT_DIR "${src_dir}/${GIT_DIR}") - endif() - if(failed OR NOT EXISTS "${GIT_DIR}/HEAD") - # not in git - set(${_refvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - set(GIT_DATA "${bin_dir}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() - configure_file("${GIT_DIR}/HEAD" "${GIT_DATA}/HEAD" COPYONLY) - - file(STRINGS "${GIT_DIR}/HEAD" head LIMIT_COUNT 1 LIMIT_INPUT 1024) - if("${head}" MATCHES "^ref: (.*)$") - set(HEAD_REF "${CMAKE_MATCH_1}") - if(EXISTS "${GIT_DIR}/${HEAD_REF}") - configure_file("${GIT_DIR}/${HEAD_REF}" "${GIT_DATA}/HEAD-REF" COPYONLY) - endif() - else() - set(HEAD_REF "") - endif() - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${src_dir} - OUTPUT_VARIABLE HEAD_HASH OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE error - RESULT_VARIABLE failed) - if(failed) - set(HEAD_HASH "HEAD-HASH-NOTFOUND") - endif() - set(${_refvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) -endfunction() - -# get the number of commits since the file has last been modified -function(git_commits_since file _commits ) - get_git_head_revision(ref head) - - set(src_dir ${PROJECT_SOURCE_DIR}) - - execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${head} -n 1 -- ${file} - WORKING_DIRECTORY ${src_dir} - OUTPUT_VARIABLE tag OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE error - RESULT_VARIABLE failed - ) - if(failed) - set( tag "") - endif() - - execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${tag}..${head} - WORKING_DIRECTORY ${src_dir} - OUTPUT_VARIABLE rev_list OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE error - RESULT_VARIABLE failed - ) - - if(failed) - set( rev_list "") - endif() - - string( REGEX MATCHALL "[a-fA-F0-9]+" rev_list "${rev_list}") - list( LENGTH rev_list COUNT) - - set(${_commits} "${COUNT}" PARENT_SCOPE) -endfunction() - -function(git_describe _var) - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() - - set(src_dir ${PROJECT_SOURCE_DIR}) - - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() - - #message(STATUS "Arguments to execute_process: ${ARGN}") - - execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN} "--tags" - WORKING_DIRECTORY "${src_dir}" - RESULT_VARIABLE res - OUTPUT_VARIABLE out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() - - set(${_var} "${out}" PARENT_SCOPE) -endfunction() - -function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) -endfunction() diff --git a/utilities/SimpleRTK/CMake/UseCSharp.cmake b/utilities/SimpleRTK/CMake/UseCSharp.cmake deleted file mode 100644 index 5c539afc5..000000000 --- a/utilities/SimpleRTK/CMake/UseCSharp.cmake +++ /dev/null @@ -1,115 +0,0 @@ -# -# A CMake Module for finding and using C# (.NET and Mono). -# -# The following global variables are assumed to exist: -# CSHARP_SOURCE_DIRECTORY - path to C# sources -# CSHARP_BINARY_DIRECTORY - path to place resultant C# binary files -# -# The following variables are set: -# CSHARP_TYPE - the type of the C# compiler (eg. ".NET" or "Mono") -# CSHARP_COMPILER - the path to the C# compiler executable (eg. "C:/Windows/Microsoft.NET/Framework/v4.0.30319/csc.exe") -# CSHARP_VERSION - the version number of the C# compiler (eg. "v4.0.30319") -# -# The following macros are defined: -# CSHARP_ADD_EXECUTABLE( name references [files] [output_dir] ) - Define C# executable with the given name -# CSHARP_ADD_LIBRARY( name references [files] [output_dir] ) - Define C# library with the given name -# -# Examples: -# CSHARP_ADD_EXECUTABLE( MyExecutable "" "Program.cs" ) -# CSHARP_ADD_EXECUTABLE( MyExecutable "ref1.dll ref2.dll" "Program.cs File1.cs" ) -# CSHARP_ADD_EXECUTABLE( MyExecutable "ref1.dll;ref2.dll" "Program.cs;File1.cs" ) -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/UseCSharp.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -# TODO: ADD SUPPORT FOR LINK LIBRARIES - -# Check something was found -if( NOT CSHARP_COMPILER ) - message( WARNING "A C# compiler executable was not found on your system" ) -endif( NOT CSHARP_COMPILER ) - -# Include type-based USE_FILE -if( CSHARP_TYPE MATCHES ".NET" ) - include( ${DotNetFrameworkSdk_USE_FILE} ) -elseif ( CSHARP_TYPE MATCHES "Mono" ) - include( ${Mono_USE_FILE} ) -endif ( CSHARP_TYPE MATCHES ".NET" ) - -macro( CSHARP_ADD_LIBRARY name ) - CSHARP_ADD_PROJECT( "library" ${name} ${ARGN} ) -endmacro( CSHARP_ADD_LIBRARY ) - -macro( CSHARP_ADD_EXECUTABLE name ) - CSHARP_ADD_PROJECT( "exe" ${name} ${ARGN} ) -endmacro( CSHARP_ADD_EXECUTABLE ) - -# Private macro -macro( CSHARP_ADD_PROJECT type name ) - set( refs "/reference:System.dll" ) - set( sources ) - set( sources_dep ) - - if( ${type} MATCHES "library" ) - set( output "dll" ) - elseif( ${type} MATCHES "exe" ) - set( output "exe" ) - endif( ${type} MATCHES "library" ) - - # Step through each argument - foreach( it ${ARGN} ) - if( ${it} MATCHES "(.*)(dll)" ) - # Argument is a dll, add reference - list( APPEND refs /reference:${it} ) - else( ) - # Argument is a source file - if( EXISTS ${it} ) - list( APPEND sources ${it} ) - list( APPEND sources_dep ${it} ) - elseif( EXISTS ${CSHARP_SOURCE_DIRECTORY}/${it} ) - list( APPEND sources ${CSHARP_SOURCE_DIRECTORY}/${it} ) - list( APPEND sources_dep ${CSHARP_SOURCE_DIRECTORY}/${it} ) - elseif( ${it} MATCHES "[*]" ) - # For dependencies, we need to expand wildcards - FILE( GLOB it_glob ${it} ) - list( APPEND sources ${it} ) - list( APPEND sources_dep ${it_glob} ) - elseif( IS_ABSOLUTE ${it} ) - list( APPEND sources ${it} ) - list( APPEND sources_dep ${it} ) - endif( ) - endif ( ) - endforeach( ) - - # Check we have at least one source - list( LENGTH sources_dep sources_length ) - if ( ${sources_length} LESS 1 ) - MESSAGE( SEND_ERROR "No C# sources were specified for ${type} ${name}" ) - endif () - list( SORT sources_dep ) - - # Perform platform specific actions - if (WIN32) - string( REPLACE "/" "\\" sources ${sources} ) - else (UNIX) - string( REPLACE "\\" "/" sources ${sources} ) - endif (WIN32) - - # Add custom target and command - MESSAGE( STATUS "Adding C# ${type} ${name}: '${CSHARP_COMPILER} /t:${type} /out:${name}.${output} /platform:${CSHARP_PLATFORM} ${CSHARP_SDK} ${refs} ${sources}'" ) - add_custom_command( - COMMENT "Compiling C# ${type} ${name}: '${CSHARP_COMPILER} /t:${type} /out:${name}.${output} /platform:${CSHARP_PLATFORM} ${CSHARP_SDK} ${refs} ${sources}'" - OUTPUT ${CSHARP_BINARY_DIRECTORY}/${name}.${output} - COMMAND ${CSHARP_COMPILER} - ARGS /t:${type} /out:${name}.${output} /platform:${CSHARP_PLATFORM} ${CSHARP_SDK} ${refs} ${sources} - WORKING_DIRECTORY ${CSHARP_BINARY_DIRECTORY} - DEPENDS ${sources_dep} - ) - add_custom_target( - ${name} ALL - DEPENDS ${CSHARP_BINARY_DIRECTORY}/${name}.${output} - SOURCES ${sources_dep} - ) -endmacro( CSHARP_ADD_PROJECT ) diff --git a/utilities/SimpleRTK/CMake/UseDotNetFrameworkSdk.cmake b/utilities/SimpleRTK/CMake/UseDotNetFrameworkSdk.cmake deleted file mode 100644 index bf3cb5286..000000000 --- a/utilities/SimpleRTK/CMake/UseDotNetFrameworkSdk.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# A CMake Module for using C# .NET. -# -# The following variables are set: -# (none) -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/UseDotNETFrameworkSDK.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -message( STATUS "Using .NET compiler version ${CSHARP_DOTNET_VERSION}" ) diff --git a/utilities/SimpleRTK/CMake/UseMono.cmake b/utilities/SimpleRTK/CMake/UseMono.cmake deleted file mode 100644 index 7d1ad7f09..000000000 --- a/utilities/SimpleRTK/CMake/UseMono.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -# A CMake Module for using Mono. -# -# The following variables are set: -# (none) -# -# Additional references can be found here: -# http://www.mono-project.com/Main_Page -# http://www.mono-project.com/CSharp_Compiler -# -# This file is based on the work of GDCM: -# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindMono.cmake -# Copyright (c) 2006-2010 Mathieu Malaterre -# - -message( STATUS "Using Mono compiler version ${CSHARP_MONO_VERSION}" ) \ No newline at end of file diff --git a/utilities/SimpleRTK/CMake/VariableList.cmake b/utilities/SimpleRTK/CMake/VariableList.cmake deleted file mode 100644 index 62216962d..000000000 --- a/utilities/SimpleRTK/CMake/VariableList.cmake +++ /dev/null @@ -1,61 +0,0 @@ - -# -# Function converts a list of cmake cache varibles to a string of -# cmake code which set each cmake cache variable. The output in cache -# is suitable to be writen to a file for "-C file" command line -# argument for cmake. -# -function( VariableListToCache var_list cache ) - foreach( var IN LISTS ${var_list} ) - if( DEFINED var ) - set( value "${${var}}" ) - get_property( type CACHE ${var} PROPERTY TYPE ) - get_property( advanced CACHE ${var} PROPERTY ADVANCED ) - get_property( helpstring CACHE ${var} PROPERTY HELPSTRING ) - get_property( strings CACHE ${var} PROPERTY STRINGS ) - - # apply escape sequences - foreach( e "\\" "(" ")" "#" "$" "^" "@" ) - STRING( REPLACE "${e}" "\\${e}" value "${value}" ) - endforeach() - - if ( "${type}" STREQUAL "" ) - set( type STRING ) - endif() - - set( _cache "${_cache} -set( ${var} \"${value}\" CACHE \"${type}\" \"${helpstring}\" FORCE )") - - if( "${advanced}" ) - set( _cache "${_cache} - mark_as_advanced( ${var} )") - endif() - if( NOT "${strings}" STREQUAL "" ) - set( _cache "${_cache} - set_property(CACHE ${var} PROPERTY STRINGS \"${strings}\")") - endif() - endif() - endforeach() - set( ${cache} "${_cache}" PARENT_SCOPE) -endfunction( ) - -# -# Function which converts a list a cmake cache variable into a list of -# "-Dvar:type=value;" suitable for command line initialization. -# -function( VariableListToArgs var_list args ) - foreach( var IN LISTS ${var_list} ) - if( DEFINED ${var} AND NOT ${var} STREQUAL "" ) # if variable has been set - get_property( type CACHE ${var} PROPERTY TYPE ) - if (NOT "${type}" STREQUAL "") - set(type ":${type}") - else() - set(type ":UNINITIALIZED") - endif() - set(value ${${var}}) - STRING( REPLACE ";" "$" value "${value}" ) - list( APPEND _args "-D${var}:${type}=${value}" ) - endif() - endforeach() - set( ${args} "${_args}" PARENT_SCOPE) -endfunction( ) diff --git a/utilities/SimpleRTK/CMake/pre-commit b/utilities/SimpleRTK/CMake/pre-commit deleted file mode 100644 index 06dd9bdee..000000000 --- a/utilities/SimpleRTK/CMake/pre-commit +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -echo 'Your work tree has not been configured for SimpleRTK development. -Paste the following commands into a shell: - - ./Utilities/SetupForDevelopment.sh - -exit 1 diff --git a/utilities/SimpleRTK/CMake/same_uint64_ulong.cxx b/utilities/SimpleRTK/CMake/same_uint64_ulong.cxx deleted file mode 100644 index 23c575ad0..000000000 --- a/utilities/SimpleRTK/CMake/same_uint64_ulong.cxx +++ /dev/null @@ -1,13 +0,0 @@ -#include - -// This program compiles when unsignedlong and uint64_t are the same type - -template struct IsSame; -template< typename T > -struct IsSame { }; - -int main( void ) -{ - IsSame FailsWhenNotSameTypes; - return 0; -} diff --git a/utilities/SimpleRTK/CMake/srtkAddTest.cmake b/utilities/SimpleRTK/CMake/srtkAddTest.cmake deleted file mode 100644 index 4d08e05b3..000000000 --- a/utilities/SimpleRTK/CMake/srtkAddTest.cmake +++ /dev/null @@ -1,289 +0,0 @@ -include(srtkExternalData) -include(CMakeParseArguments) - -set(SimpleRTK_DATA_ROOT ${SimpleRTK_SOURCE_DIR}/Testing/Data) - -#----------------------------------------------------------------------------- -# SimpleRTK wrapper for add_test that adds support for external data, -# and post comparison processes. -# -# ARGUMENTS -# -# [ADD_TEST ARGUMENTS...] -# The first arguments are passed to cmake's add_test function with -# support for the DATA{} references to external data -# TRANSFORM_COMPARE [tolerance] -function(srtk_add_test) - set(options "") - set(oneValueArgs "NAME") - set(multiValueArgs COMMAND TRANSFORM_COMPARE) - cmake_parse_arguments("_" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - - if ( NOT "${__TRANSFORM_COMPARE}" STREQUAL "" ) - set(COMPARE_ARGS ${COMPARE_ARGS} --compareTransform ${__TRANSFORM_COMPARE}) - endif() - - if (COMPARE_ARGS) - set(__COMMAND $ ${COMPARE_ARGS} -- ${__COMMAND}) - endif() - - # Add test with data in the SimpleRTKData group. - ExternalData_add_test(SimpleRTKData NAME ${__NAME} COMMAND ${__COMMAND} ${__UNPARSED_ARGUMENTS}) - - -endfunction() - - -# -# This is a function which set up the environment for executing python examples and tests -# -function(srtk_add_python_test name) - - if ( NOT WRAP_PYTHON ) - return() - endif() - - set(command "${TEST_PYTHON_EXECUTABLE}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - srtk_add_test(NAME Python.${name} - COMMAND "${ITK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - set_property(TEST Python.${name} - PROPERTY ENVIRONMENT SRTK_NOSHOW=YES - ) - if (NOT SRTK_PYTHON_USE_VIRTUALENV) - set_property(TEST Python.${name} - APPEND PROPERTY ENVIRONMENT PYTHONPATH=${SimpleRTK_BINARY_DIR}/Wrapping/Python - ) - endif() - -endfunction() - - -# -# This is a function which set up the enviroment for executing lua examples and tests -# -function(srtk_add_lua_test name) - - if ( NOT WRAP_LUA ) - return() - endif() - - set(command "${LUA_EXECUTABLE}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - srtk_add_test(NAME Lua.${name} - COMMAND "${ITK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - set_property(TEST Lua.${name} - PROPERTY ENVIRONMENT LUA_CPATH=$ - ) - set_property(TEST Lua.${name} - APPEND PROPERTY ENVIRONMENT SRTK_NOSHOW=YES - ) -endfunction() - - -# -# This is a function which set up the enviroment for executing ruby examples and tests -# -function(srtk_add_ruby_test name) - - if ( NOT WRAP_RUBY ) - return() - endif() - - set(command "${RUBY_EXECUTABLE}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - srtk_add_test(NAME Ruby.${name} - COMMAND "${ITK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - - set_property(TEST Ruby.${name} - PROPERTY ENVIRONMENT RUBYLIB=$ - ) -endfunction() - - -# -# This is a function which set up the enviroment for executing TCL examples and tests -# -function(srtk_add_tcl_test name) - - if ( NOT WRAP_TCL ) - return() - endif() - - set(command "$") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - srtk_add_test(NAME Tcl.${name} - COMMAND "${ITK_TEST_DRIVER}" - ${command} - ${ARGN} - ) -endfunction() - - -# -# This is a function which set up the enviroment for executing JAVA examples and tests -# -function(srtk_add_java_test name java_file) - - if ( NOT WRAP_JAVA ) - return() - endif() - - # the root is with out extension or path, it is also assumed to the the name of the main class - get_filename_component( _java_class ${java_file} NAME_WE ) - set( _java_file_class "${_java_class}.class" ) - set( _class_path "${CMAKE_CURRENT_BINARY_DIR}" ) - set(JAR_FILE "SimpleRTK-${SimpleRTK_VERSION}.jar") # from target? - - set( _JAVA_LIBRARY_PATH "$") - if(WIN32) - set( _JAVA_CLASSPATH "${SimpleRTK_BINARY_DIR}/Wrapping/Java/${JAR_FILE}$${_class_path}" ) - else() - set( _JAVA_CLASSPATH "${SimpleRTK_BINARY_DIR}/Wrapping/Java/${JAR_FILE}:${_class_path}" ) - endif() - - if (NOT TARGET ${_java_class}Java) - - add_custom_command( - OUTPUT "${_class_path}/${_java_file_class}" - COMMAND "${CMAKE_COMMAND}" - ARGS -E remove -f "${_class_path}/${_java_file_class}" - COMMAND "${Java_JAVAC_EXECUTABLE}" - ARGS -classpath "${_JAVA_CLASSPATH}" - -d "${_class_path}" - "${java_file}" - DEPENDS ${java_file} ${SWIG_MODULE_SimpleRTKJava_TARGET_NAME} org_itk_simple_jar - COMMENT "Building ${_class_path}/${_java_file_class}" - ) - add_custom_target( ${_java_class}Java ALL - DEPENDS "${_class_path}/${_java_file_class}" - SOURCES ${java_file} - ) - endif() - - - srtk_add_test(NAME Java.${name} - COMMAND "${ITK_TEST_DRIVER}" - "${Java_JAVA_EXECUTABLE}" - "-Djava.library.path=${_JAVA_LIBRARY_PATH}" - "-classpath" "${_JAVA_CLASSPATH}" - "${_java_class}" - ${ARGN} - ) -endfunction() - - -# -# This is a function which set up the enviroment for executing R examples and tests -# -function(srtk_add_r_test name) - - if ( NOT WRAP_R ) - return() - endif() - - set(command "${R_COMMAND}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - srtk_add_test(NAME R.${name} - COMMAND "${ITK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - - set_property(TEST R.${name} - PROPERTY ENVIRONMENT R_LIBS=${SimpleRTK_BINARY_DIR}/Wrapping/R/R_libs/ - ) -endfunction() - - -# -# This is a function which compiles the program and set up the -# enviroment for executing CSharp examples and tests. -# -function(srtk_add_csharp_test name csharp_file) - - if ( NOT WRAP_CSHARP ) - return() - endif() - - # the root is with out extension or path - get_filename_component( CSHARP_EXECUTABLE ${csharp_file} NAME_WE ) - - # make sure the executable has CSharp in it - if ( NOT CSHARP_EXECUTABLE MATCHES "CSharp" ) - set( CSHARP_EXECUTABLE "CSharp${CSHARP_EXECUTABLE}" ) - endif() - - - if (NOT TARGET "${CSHARP_EXECUTABLE}") - - # add the target to compile the test - csharp_add_executable( - "${CSHARP_EXECUTABLE}" - SimpleRTKCSharpManaged.dll - ${csharp_file} - ) - endif() - - # because each executable is it's own target we actually don't - # need to make a target depend on this list - list( APPEND compiled_csharp_tests "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe") - - add_dependencies("${CSHARP_EXECUTABLE}" SimpleRTKCSharpManaged) - - # the interpreter is set to "" when none is needed - if( CSHARP_INTERPRETER ) - srtk_add_test(NAME CSharp.${name} - COMMAND "${ITK_TEST_DRIVER}" - "${CSHARP_INTERPRETER}" - "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe" - ${ARGN} - ) - else () - srtk_add_test(NAME CSharp.${name} - COMMAND "${ITK_TEST_DRIVER}" - "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe" - ${ARGN} - ) - endif() - -endfunction() diff --git a/utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake b/utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake deleted file mode 100644 index ce60e1838..000000000 --- a/utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake +++ /dev/null @@ -1,93 +0,0 @@ -# -# CMake Module to check for TR1 and C++11 features -# -# SRTK_HAS_CXX11_STATIC_ASSERT - True if "static_assert" keyword is supported -# SRTK_HAS_CXX11_FUNCTIONAL - True if functional header has C++11 features -# SRTK_HAS_CXX11_TYPE_TRAITS -# SRTK_HAS_CXX11_UNORDERED_MAP -# SRTK_HAS_CXX11_NULLPTR - True if "nullptr" keyword is supported -# SRTK_HAS_CXX11_UNIQUE_PTR -# SRTK_HAS_CXX11_ALIAS_TEMPLATE - Able to use alias templates -# -# SRTK_HAS_TR1_SUB_INCLUDE -# -# SRTK_HAS_TR1_FUNCTIONAL -# SRTK_HAS_TR1_TYPE_TRAITS -# SRTK_HAS_TR1_UNORDERED_MAP - -# -# Function to wrap try compiles on the aggregate cxx test file1 -# -function(srtkCXX11Test VARIABLE) - # use the hash of the dependent cxx flags in the variable name to - # cache the results. - string(MD5 cmake_cxx_flags_hash "#${CMAKE_CXX_FLAGS}") - set(cache_var "${VARIABLE}_${cmake_cxx_flags_hash}") - - if(DEFINED "${cache_var}") - set(${VARIABLE} "${${cache_var}}" CACHE INTERNAL "Using hashed value from TRY_COMPILE") - else() - message(STATUS "Performing Test ${VARIABLE}") - set(requred_definitions "${CMAKE_REQUIRED_DEFINITIONS} -D${VARIABLE}") - try_compile(${VARIABLE} - "${PROJECT_BINARY_DIR}/CMakeTmp" - "${CMAKE_CURRENT_LIST_DIR}/srtk_check_cxx11.cxx" - CMAKE_FLAGS - -DCOMPILE_DEFINITIONS:STRING=${requred_definitions} - OUTPUT_VARIABLE output) - - set(${cache_var} ${${VARIABLE}} CACHE INTERNAL "hashed flags with try_compile results") - - if(${VARIABLE}) - message(STATUS "Performing Test ${VARIABLE} - Success") - else() - message(STATUS "Performing Test ${VARIABLE} - Failed") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing Test ${VARIABLE} failed with the following output:\n" - "${OUTPUT}\n") - endif() - endif() -endfunction() - -# -# Check for CXX11 Features -# -srtkCXX11Test(SRTK_HAS_CXX11_STATIC_ASSERT) -srtkCXX11Test(SRTK_HAS_CXX11_FUNCTIONAL) -srtkCXX11Test(SRTK_HAS_CXX11_TYPE_TRAITS) -srtkCXX11Test(SRTK_HAS_CXX11_UNORDERED_MAP) -srtkCXX11Test(SRTK_HAS_CXX11_NULLPTR) -srtkCXX11Test(SRTK_HAS_CXX11_UNIQUE_PTR) -srtkCXX11Test(SRTK_HAS_CXX11_ALIAS_TEMPLATE) - - - -# Microsoft Visual Studio 2008sp1,2010,2012 don't need tr1 as a path -# prefix to tr1 headers, while libc++ -srtkCXX11Test(SRTK_HAS_TR1_SUB_INCLUDE) - -set(CMAKE_REQUIRED_DEFINITIONS_SAVE ${CMAKE_REQUIRED_DEFINITIONS}) -if (SRTK_HAS_TR1_SUB_INCLUDE) - list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DHAS_TR1_SUB_INCLUDE") -endif() - -# -# Check for TR1 features -# -srtkCXX11Test(SRTK_HAS_TR1_FUNCTIONAL) -srtkCXX11Test(SRTK_HAS_TR1_TYPE_TRAITS) -srtkCXX11Test(SRTK_HAS_TR1_UNORDERED_MAP) - -# restore varaible -set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_SAVE}) - - -if ( (NOT SRTK_HAS_TR1_FUNCTIONAL AND NOT SRTK_HAS_CXX11_FUNCTIONAL) - OR - (NOT SRTK_HAS_TR1_TYPE_TRAITS AND NOT SRTK_HAS_CXX11_TYPE_TRAITS) ) - message( FATAL_ERROR - "SimpleRTK requires usage of C++11 or C++ Technical Report 1 (TR1).\n" - "It may be available as an optional download for your compiler or difference CXX_FLAGS." - "Please see the FAQs for details." - "https://www.itk.org/Wiki/SimpleITK/FAQ#Do_I_need_to_download_an_option_package_for_TR1_support.3F\n" ) -endif ( ) diff --git a/utilities/SimpleRTK/CMake/srtkCheckForITKModuleDependencies.cmake b/utilities/SimpleRTK/CMake/srtkCheckForITKModuleDependencies.cmake deleted file mode 100644 index 6b6814ccb..000000000 --- a/utilities/SimpleRTK/CMake/srtkCheckForITKModuleDependencies.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# -# The list of ITK modules on which SimpleRTK is dependent. Dependencies -# were obtained using the WhatModulesITK.py script -# (see itk_source_directory/Utilities/Maintenance): -# WhatModulesITK.py itk_source_directory \ -# $(find SimpleRTK_binary_directory/SimpleRTK-build/Code \ -# -name '*.h' -o -name '*.hxx' -o -name '*.cxx') -# -# Don't do "find SimpleRTK_binary_directory/SimpleRTK-build/Code type -f" -# as this will attempt to analyze all of the object files too. -# -# The script does not list the IO modules as they are indirectly included. -# SimpleRTK requires that the ITKReview module be turned on, and ITKReview -# is dependent on most of the IO modules so we only need to force 'review on' to -# ensure that we have the 'IO on' too. -# -list(APPEND _SRTK_REQUIRED_ITK_MODULES - ITKAnisotropicSmoothing - ITKAntiAlias - ITKBiasCorrection - ITKBinaryMathematicalMorphology - ITKClassifiers - ITKColormap - ITKCommon - ITKConnectedComponents - ITKConvolution - ITKCurvatureFlow - ITKDeconvolution - ITKDenoising - ITKDisplacementField - ITKDistanceMap - ITKFFT - ITKFastMarching - ITKImageAdaptors - ITKImageCompare - ITKImageCompose - ITKImageFeature - ITKImageFilterBase - ITKImageFusion - ITKImageGradient - ITKImageGrid - ITKImageIntensity - ITKImageLabel - ITKImageNoise - ITKImageSources - ITKImageStatistics - ITKLabelMap - ITKLabelVoting - ITKLevelSets - ITKMathematicalMorphology - ITKPDEDeformableRegistration - ITKRegionGrowing - ITKReview - ITKSmoothing - ITKStatistics - ITKThresholding - ITKTransform - ITKWatersheds -) - -foreach(itkDependency ${_SRTK_REQUIRED_ITK_MODULES}) - list(FIND ITK_MODULES_ENABLED ${itkDependency} ITKDependency_FOUND) - if(ITKDependency_FOUND EQUAL -1) - message(FATAL_ERROR "SimpleRTK requires that the ${itkDependency} module be turned on in ITK") - endif() -endforeach() diff --git a/utilities/SimpleRTK/CMake/srtkCheckRequiredFlags.cmake b/utilities/SimpleRTK/CMake/srtkCheckRequiredFlags.cmake deleted file mode 100644 index ec18f170c..000000000 --- a/utilities/SimpleRTK/CMake/srtkCheckRequiredFlags.cmake +++ /dev/null @@ -1,107 +0,0 @@ -# -# Sets the following variables: -# SimpleRTK_REQUIRED_C_FLAGS -# SimpleRTK_REQUIRED_CXX_FLAGS -# SimpleRTK_REQUIRED_LINK_FLAGS -# -# In particular, this marks the "-std=", and the "-stdlib=" as -# required, if present and check if c++11 is needed. - -include(CheckCXXCompilerFlag) - -if( NOT DEFINED SimpleRTK_REQUIRED_C_FLAGS ) - set(SimpleRTK_REQUIRED_C_FLAGS "") -endif() -if( NOT DEFINED SimpleRTK_REQUIRED_CXX_FLAGS ) - set(SimpleRTK_REQUIRED_CXX_FLAGS "") -endif() -if( NOT DEFINED SimpleRTK_REQUIRED_LINK_FLAGS ) - set(SimpleRTK_REQUIRED_LINK_FLAGS "") -endif() - -if(MSVC) - # /bigobj is required for windows builds because of the size of - # some object files (CastImage for instance) - # Also supress the pesky warning about std::vector not being marked - # for export in the dll - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251" ) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) - - # Avoid some warnings - add_definitions ( -D_SCL_SECURE_NO_WARNINGS ) - - - # force debug linking not to be incremental - foreach( _varName - CMAKE_EXE_LINKER_FLAGS_DEBUG - CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_MODULE_LINKER_FLAGS_DEBUG - CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_SHARED_LINKER_FLAGS_DEBUG - CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ) - STRING(REGEX REPLACE "INCREMENTAL(:[a-zA-Z]+)?" "INCREMENTAL:NO" ${_varName} ${${_varName}}) - endforeach() - -endif() - -if(MINGW) - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj" ) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wa,-mbig-obj" ) -endif() - - -# -# Search CMAKE_CXX_FLAGS for flags that should be considered required, -# and propagated to other projects, via the -# SimpleRTK_REQUIRED_CXX_FLAGS variable. -# - -string(REPLACE " " ";" cmake_cxx_flags_list "${CMAKE_CXX_FLAGS}") - -# list of regular expressions flags that are to be required flags for SimpleRTK -set(required_flags_regex_to_test - "^-std=" - "^-stdlib=" -) - -foreach(f ${cmake_cxx_flags_list}) - foreach( _r ${required_flags_regex_to_test} ) - string(REGEX MATCH ${_r} _HAS_FLAG ${f} ) - if (_HAS_FLAG ) - string(FIND "${SimpleRTK_REQUIRED_CXX_FLAGS}" "${f}" required) - if(required LESS 0) - set(SimpleRTK_REQUIRED_CXX_FLAGS "${SimpleRTK_REQUIRED_CXX_FLAGS} ${f}") - endif() - endif() - endforeach() -endforeach() - -# -# Check if we need to enable C++11 with a compiler flag -# - - -string(FIND "${SimpleRTK_REQUIRED_CXX_FLAGS}" "-std=c++11" required) -if(required LESS 0) - - check_cxx_compiler_flag( "-std=c++11" CXX_HAS_stdcxx11) - if (CXX_HAS_stdcxx11) - - message(STATUS "Checking if c++11 is required...") - try_compile(SRTK_CHECK_CXX11_REQUIRED - "${PROJECT_BINARY_DIR}/CMakeTmp" - "${CMAKE_CURRENT_LIST_DIR}/srtk_check_cxx11_required.cxx" - OUTPUT_VARIABLE OUTPUT) - if(${SRTK_CHECK_CXX11_REQUIRED}) - message(STATUS "Checking if c++11 is required... NO" ) - else() - message(STATUS "Checking if c++11 is required... YES" ) - file(APPEND ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Checking if C++11 required try_compile failed with the following output:\n" - "${OUTPUT}\n") - set(SimpleRTK_REQUIRED_CXX_FLAGS "${SimpleRTK_REQUIRED_CXX_FLAGS} -std=c++11") - endif() - - endif() - -endif() diff --git a/utilities/SimpleRTK/CMake/srtkCheckSourceTree.cmake b/utilities/SimpleRTK/CMake/srtkCheckSourceTree.cmake deleted file mode 100644 index 966166603..000000000 --- a/utilities/SimpleRTK/CMake/srtkCheckSourceTree.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# Install a pre-commit hook to bootstrap commit hooks. -if(EXISTS "${SimpleRTK_SOURCE_DIR}/.git/config" AND - NOT EXISTS "${SimpleRTK_SOURCE_DIR}/.git/hooks/pre-commit") - # Silently ignore the error if the hooks directory is read-only. - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy ${RTK_SOURCE_DIR}/CMake/pre-commit - ${RTK_SOURCE_DIR}/.git/hooks/pre-commit - OUTPUT_VARIABLE _output - ERROR_VARIABLE _output - RESULT_VARIABLE _result - ) - if(_result AND NOT "${_output}" MATCHES "Error copying file") - message("${_output}") - endif() -endif() diff --git a/utilities/SimpleRTK/CMake/srtkCompilerWarningsSettings.cmake b/utilities/SimpleRTK/CMake/srtkCompilerWarningsSettings.cmake deleted file mode 100644 index 7635eb408..000000000 --- a/utilities/SimpleRTK/CMake/srtkCompilerWarningsSettings.cmake +++ /dev/null @@ -1,86 +0,0 @@ -# trict-null-sentinel Check the set of common warning flags supported by C and C++ compilers -# check_compiler_warning_flags( ) -# - variable to store valid C warning flags -# - variable to store valid CXX warning flags -# This internally calls the check_c_compiler_flag and check_cxx_compiler_flag macros. - -# To create a portable build system, it is best to not -# test for platforms, but to test for features. -# -# Instead of testing "if Windows then do this", test for -# "if the -Wno-invalid-offsetof flag works then use it". -# You can do that with the CheckCCompilerFlag module, -# for example: - -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) - -# -# this functions loops through the list to add the flags -# supported by the current compiler -function(test_cc_flags c_flag_var flag_list) - set(local_c_flags "") - foreach(flag IN LISTS ${flag_list}) - string(REPLACE "=" "_" flag_var ${flag} ) - check_c_compiler_flag(${flag} C_HAS${flag_var}) - if(${C_HAS${flag_var}}) - set(local_c_flags "${local_c_flags} ${flag}") - endif() - endforeach(flag) - set(${c_flag_var} "${local_c_flags}" PARENT_SCOPE) -endfunction(test_cc_flags) - -# -# this functions loops through the list to add the flags -# supported by the current compiler -function(test_cxx_flags cxx_flag_var flag_list) - set(local_cxx_flags "") - foreach(flag IN LISTS ${flag_list}) - string(REPLACE "=" "_" flag_var ${flag} ) - check_cxx_compiler_flag(${flag} CXX_HAS${flag_var}) - if(${CXX_HAS${flag_var}}) - set(local_cxx_flags "${local_cxx_flags} ${flag}") - endif() - endforeach(flag) - set(${cxx_flag_var} "${local_cxx_flags}" PARENT_SCOPE) -endfunction(test_cxx_flags) - - -# On windows, the most verbose compiler options -# is reporting 1000's of wanings in windows -# header files, for now, limit the number of -# warnings to level 3 -if( WIN32 ) - set(VerboseWarningsFlag -W3 ) - # A better solution would be to use -Wall, - # and then disable warnings one by one - # set(VerboseWarningsFlag -Wall -wd4820 -wd4682 ) -else() - set(VerboseWarningsFlag -Wall ) -endif() - -set(warning_flags_to_test - ${VerboseWarningsFlag} - -Wno-long-double # needed on APPLE - -Wno-long-long # needed on gcc 4.5.2 - -Wno-unused-local-typedefs # needed with gcc 4.8 - -Wno-strict-overflow # needed with gcc 4.8 - -Wextra - -Wformat=2 - -Wno-format-nonliteral - -Wunused - -Wpointer-arith - -Winvalid-pch - -Wcast-align - -Wdisabled-optimization - -Woverloaded-virtual - -Wshadow - -Wwrite-strings - -Wstrict-null-sentinel -) - -# add C++ only flag -set(cxx_flags_to_test ${warning_flags_to_test} -Wno-invalid-offsetof ) - -test_cxx_flags(CXX_ADDITIONAL_WARNING_FLAGS cxx_flags_to_test) - diff --git a/utilities/SimpleRTK/CMake/srtkConfigureFileBuildtime.cmake b/utilities/SimpleRTK/CMake/srtkConfigureFileBuildtime.cmake deleted file mode 100644 index 6f42c7eec..000000000 --- a/utilities/SimpleRTK/CMake/srtkConfigureFileBuildtime.cmake +++ /dev/null @@ -1,61 +0,0 @@ - -include(VariableList) - -function( configure_file_buildtime filename out_filename ) - - -set( regex_1 "^[^@]*(@[^@]+@[^@]*)+[^@]*$") - -file ( STRINGS "${filename}" results REGEX "${regex_1}" ) -set( vars "" ) - -foreach( line ${results}) - - set( regex_2 "^[^@]*@([^@]+)@(.*)$" ) - - string( REGEX MATCH "${regex_2}" line_match "${line}" ) - list( APPEND vars ${CMAKE_MATCH_1} ) - while( CMAKE_MATCH_1 ) - string( REGEX MATCH "${regex_2}" line_match "${CMAKE_MATCH_2}" ) - list( APPEND vars ${CMAKE_MATCH_1} ) - endwhile() - - list( SORT vars ) - list( REMOVE_DUPLICATES vars ) - - - - -endforeach() - -set( CONFIGUREBUILDTIME_filename ${filename} ) -set( CONFIGUREBUILDTIME_out_filename ${out_filename} ) - -list( APPEND vars CONFIGUREBUILDTIME_filename CONFIGUREBUILDTIME_out_filename ) - -VariableListToArgs( vars configure_vars ) - -file( WRITE "${CMAKE_BINARY_DIR}/CMake/configure_file_buildtime.cmake" - "configure_file( \"\${CONFIGUREBUILDTIME_filename}\" \"\${CONFIGUREBUILDTIME_out_filename}\" )" ) - -set( cmd ${CMAKE_COMMAND} "${configure_vars}" -P "${CMAKE_BINARY_DIR}/CMake/configure_file_buildtime.cmake") - -if( TARGET ConfigureFileBuildtime ) - add_custom_command( TARGET ConfigureFileBuildtime - PRE_BUILD - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "BuildTime Configuration of ${filename} to ${out_filename}" - COMMAND ${cmd} - ) -else() - add_custom_command( - OUTPUT "${out_filename}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - DEPENDS "${filename}" - COMMENT "BuildTime Configuration of ${filename} to ${out_filename}" - COMMAND ${cmd} - ) - add_custom_target(ConfigureFileBuildtime ALL DEPENDS "${out_filename}" ) -endif() - -endfunction() diff --git a/utilities/SimpleRTK/CMake/srtkExternalData.cmake b/utilities/SimpleRTK/CMake/srtkExternalData.cmake deleted file mode 100644 index 22b6591df..000000000 --- a/utilities/SimpleRTK/CMake/srtkExternalData.cmake +++ /dev/null @@ -1,52 +0,0 @@ -get_filename_component(_SimpleRTKExternalData_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -# Fetch testing data. -# 2.8.11 required for ExternalData.cmake. -if( CMAKE_VERSION VERSION_LESS 2.8.11 ) - message( FATAL_ERROR "BUILD_TESTING ON requires CMake 2.8.11 or newer." ) -endif() - -include(ExternalData) - -if(NOT ExternalData_OBJECT_STORES) - # Use ExternalData_OBJECT_STORES from environment as default. - set(ExternalData_OBJECT_STORES_DEFAULT "") - if(DEFINED "ENV{ExternalData_OBJECT_STORES}") - file(TO_CMAKE_PATH "$ENV{ExternalData_OBJECT_STORES}" ExternalData_OBJECT_STORES_DEFAULT) - endif() -endif() - -set(ExternalData_OBJECT_STORES "${ExternalData_OBJECT_STORES_DEFAULT}" CACHE STRING - "Semicolon-separated list of local directories holding data objects in the layout %(algo)/%(hash).") -mark_as_advanced(ExternalData_OBJECT_STORES) -if(NOT ExternalData_OBJECT_STORES) - set(ExternalData_OBJECT_STORES "${CMAKE_BINARY_DIR}/ExternalData/Objects") - file(MAKE_DIRECTORY "${ExternalData_OBJECT_STORES}") -endif() -list(APPEND ExternalData_OBJECT_STORES - # Local data store populated by the ITK pre-commit hook - "${CMAKE_SOURCE_DIR}/.ExternalData" - ) - -set(ExternalData_BINARY_ROOT ${CMAKE_BINARY_DIR}/ExternalData) - -set(ExternalData_URL_TEMPLATES "" CACHE STRING - "Additional URL templates for the ExternalData CMake script to look for testing data. E.g. -file:///var/bigharddrive/%(algo)/%(hash)") -mark_as_advanced(ExternalData_URL_TEMPLATES) -if(NOT SRTK_FORBID_DOWNLOADS) - list(APPEND ExternalData_URL_TEMPLATES - # Data published by MIDAS - "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" - "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" - - # Data published by developers using git-gerrit-push. - "https://itk.org/files/ExternalData/%(algo)/%(hash)" - ) -endif() -# Tell ExternalData commands not to transform raw files to content links. -#set(ExternalData_LINK_CONTENT MD5) - -# Match series of the form ., .. such that may -# end in a (test) number that is not part of any series numbering. -set(ExternalData_SERIES_PARSE "()(\\.[^./]*)$") -set(ExternalData_SERIES_MATCH "(\\.[0-9]+)?") diff --git a/utilities/SimpleRTK/CMake/srtkForbidDownloadsOption.cmake b/utilities/SimpleRTK/CMake/srtkForbidDownloadsOption.cmake deleted file mode 100644 index 840a794ad..000000000 --- a/utilities/SimpleRTK/CMake/srtkForbidDownloadsOption.cmake +++ /dev/null @@ -1,12 +0,0 @@ - -#----------------------------------------------------------------------------- -# Forbid downloading resources from the network during a build. This helps -# when building on systems without network connectivity to determine which -# resources much be obtained manually and made available to the build. -option(SRTK_FORBID_DOWNLOADS "Do not download source code or data from the network" OFF) -mark_as_advanced(SRTK_FORBID_DOWNLOADS) -macro(srtk_enforce_forbid_downloads _name) - if(SRTK_FORBID_DOWNLOADS) - message(SEND_ERROR "Attempted to download ${_name} when SRTK_FORBID_DOWNLOADS is ON") - endif() -endmacro() diff --git a/utilities/SimpleRTK/CMake/srtkGenerateFilterSource.cmake b/utilities/SimpleRTK/CMake/srtkGenerateFilterSource.cmake deleted file mode 100644 index 941e501cb..000000000 --- a/utilities/SimpleRTK/CMake/srtkGenerateFilterSource.cmake +++ /dev/null @@ -1,267 +0,0 @@ - -# Find a Lua executable -# -if ( NOT SRTK_LUA_EXECUTABLE ) - set ( SAVE_LUA_EXECUTABLE ${LUA_EXECUTABLE} ) - get_property( SAVE_LUA_EXECUTABLE_TYPE CACHE LUA_EXECUTABLE PROPERTY TYPE ) - get_property( SAVE_LUA_EXECUTABLE_DOCSTRING CACHE LUA_EXECUTABLE PROPERTY HELPSTRING ) - - find_package( LuaInterp REQUIRED 5.1 ) - set( SRTK_LUA_EXECUTABLE ${LUA_EXECUTABLE} CACHE PATH "Lua executable used for code generation." ) - - if (DEFINED SAVE_LUA_EXECUTABLE) - set( LUA_EXECUTABLE ${SAVE_LUA_EXECUTABLE} - CACHE - ${SAVE_LUA_EXECUTABLE_TYPE} - ${SAVE_LUA_EXECUTABLE_DOCSTRING} - FORCED - ) - else() - unset( LUA_EXECUTABLE CACHE ) - endif() -endif() - -# Get the Lua version -# -execute_process( - COMMAND ${SRTK_LUA_EXECUTABLE} -v - OUTPUT_VARIABLE - SRTK_LUA_EXECUTABLE_VERSION_STRING - ERROR_VARIABLE - SRTK_LUA_EXECUTABLE_VERSION_STRING - RESULT_VARIABLE - SRTK_LUA_VERSION_RESULT_VARIABLE - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - -# Check that the Lua version is acceptable -# -if( NOT SRTK_LUA_VERSION_RESULT_VARIABLE ) - string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" - SRTK_LUA_EXECUTABLE_VERSION - ${SRTK_LUA_EXECUTABLE_VERSION_STRING} ) -endif() - -if( SRTK_LUA_VERSION_RESULT_VARIABLE - OR - NOT ${SRTK_LUA_EXECUTABLE_VERSION} VERSION_GREATER "5.1" - OR - NOT ${SRTK_LUA_EXECUTABLE_VERSION} VERSION_LESS "5.2" ) - message(SEND_ERROR "Lua version 5.1 is required for SRTK_LUA_EXECUTABLE_VERSION.") -endif() - - -############################################################################### -# This macro returns the list of template components used by a specific -# template file -# -macro( get_dependent_template_components out_var_name json_file input_dir ) - - set(${out_var_name}) - - ###### - # Figure out which template file gets used - ###### - - # Get the line from the json file that indicates the correct template - file(STRINGS ${json_file} template_line REGEX ".*template_code_filename.*") - - # strip down to what in between the "" after the : - string(REGEX MATCH ":.*\"([^\"]+)\"" _out "${template_line}") - set(template_name "${CMAKE_MATCH_1}" ) - - if(_out) - - set(template_file_h "${input_dir}/templates/srtk${template_name}Template.h.in") - set(template_file_cxx "${input_dir}/templates/srtk${template_name}Template.cxx.in") - - ###### - # Get dependencies template files - ###### - - set(cache_var "_${template_file_h}_${template_file_cxx}_components_cache") - if ( NOT ${cache_var} ) - - # Get the contents of the file - file(READ ${template_file_h} h_contents) - file(READ ${template_file_cxx} cxx_contents) - - # For each component, see if it appears in the body of the template file - foreach(component ${template_components}) - - # Get the filename without the path - get_filename_component( filename ${component} NAME ) - - if("${h_contents}" MATCHES ".*${filename}.*" OR - "${cxx_contents}" MATCHES ".*${filename}.*") - set(${cache_var} ${${cache_var}} ${component}) - endif() - - endforeach(component) - endif() - set (${out_var_name} ${${cache_var}} ) - - else() - message(WARNING "No template name found for ${json_file}") - - endif() - -endmacro() - - -############################################################################### -# This macro expands the .h and .cxx files for a given input template -# -macro( expand_template FILENAME input_dir output_dir library_name ) - - # Set common variables - set ( expand_template_script ${SimpleRTK_SOURCE_DIR}/Utilities/ExpandTemplate.lua ) - set ( template_include_dir ${SimpleRTK_SOURCE_DIR}/TemplateComponents ) - set ( output_h "${output_dir}/include/srtk${FILENAME}.h" ) - set ( output_cxx "${output_dir}/src/srtk${FILENAME}.cxx" ) - - set ( input_json_file ${input_dir}/json/${FILENAME}.json ) - set ( template_file_h ${input_dir}/templates/srtkImageFilterTemplate.h.in ) - set ( template_file_cxx ${input_dir}/templates/srtkImageFilterTemplate.cxx.in ) - - # Get the list of template component files for this template - get_dependent_template_components(template_deps ${input_json_file} ${input_dir}) - - # Make a global list of ImageFilter template filters - set ( IMAGE_FILTER_LIST ${IMAGE_FILTER_LIST} ${FILENAME} CACHE INTERNAL "" ) - - # validate json files if python is available - if ( PYTHON_EXECUTABLE AND NOT PYTHON_VERSION_STRING VERSION_LESS 2.6 ) - set ( JSON_VALIDATE_COMMAND COMMAND "${PYTHON_EXECUTABLE}" "${SimpleRTK_SOURCE_DIR}/Utilities/JSONValidate.py" "${input_json_file}" ) - endif () - - # header - add_custom_command ( - OUTPUT "${output_h}" - ${JSON_VALIDATE_COMMAND} - COMMAND ${CMAKE_COMMAND} -E remove -f ${output_h} - COMMAND ${SRTK_LUA_EXECUTABLE} ${expand_template_script} code ${input_json_file} ${input_dir}/templates/srtk ${template_include_dir} Template.h.in ${output_h} - DEPENDS ${input_json_file} ${template_deps} ${template_file_h} - ) - # impl - add_custom_command ( - OUTPUT "${output_cxx}" - COMMAND ${CMAKE_COMMAND} -E remove -f ${output_cxx} - COMMAND ${SRTK_LUA_EXECUTABLE} ${expand_template_script} code ${input_json_file} ${input_dir}/templates/srtk ${template_include_dir} Template.cxx.in ${output_cxx} - DEPENDS ${input_json_file} ${template_deps} ${template_file_cxx} - ) - - set ( ${library_name}GeneratedHeader ${${library_name}GeneratedHeader} - "${output_h}" CACHE INTERNAL "" ) - - set ( ${library_name}GeneratedSource ${${library_name}GeneratedSource} - "${output_cxx}" CACHE INTERNAL "" ) - - set_source_files_properties ( ${${library_name}GeneratedSource} PROPERTIES GENERATED 1 ) - set_source_files_properties ( ${${library_name}GeneratedHeader} PROPERTIES GENERATED 1 ) - - # Make the list visible at the global scope - set ( GENERATED_FILTER_LIST ${GENERATED_FILTER_LIST} ${FILENAME} CACHE INTERNAL "" ) -endmacro() - - - -############################################################################### -# Macro to do all code generation for a given directory -# -macro(generate_filter_source) - - # Get the name of the current directory - get_filename_component(directory_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) - - # Clear out the GeneratedSource list in the cache - set (SimpleRTK${directory_name}GeneratedSource "" CACHE INTERNAL "") - set (SimpleRTK${directory_name}GeneratedHeader "" CACHE INTERNAL "") - - ###### - # Perform template expansion - ###### - - # Set input and output directories corresponding to this Code directory - set(generated_code_input_path ${CMAKE_CURRENT_SOURCE_DIR}) - set(generated_code_output_path ${SimpleRTK_BINARY_DIR}/Code/${directory_name}) - - # Make sure include and src directories exist - if (NOT EXISTS ${generated_code_output_path}/include) - file(MAKE_DIRECTORY ${generated_code_output_path}/include) - endif() - if (NOT EXISTS ${generated_code_output_path}/src) - file(MAKE_DIRECTORY ${generated_code_output_path}/src) - endif() - - - message( STATUS "Processing json files..." ) - - # Glob all json files in the current directory - file ( GLOB json_config_files ${generated_code_input_path}/json/[a-zA-Z]*.json) - - # Loop through json files and expand each one - foreach ( f ${json_config_files} ) - get_filename_component ( class ${f} NAME_WE ) - - string(FIND ${class} "Cuda" position) - if(${position} EQUAL -1 OR RTK_USE_CUDA) - expand_template ( ${class} - ${generated_code_input_path} - ${generated_code_output_path} - SimpleRTK${directory_name} ) - endif() - - - endforeach() - - message( STATUS "Processing json files...done" ) - - ###### - # Make target for generated source and headers - ###### - add_custom_target(${directory_name}SourceCode ALL DEPENDS - ${SimpleRTK${directory_name}GeneratedHeader} - ${SimpleRTK${directory_name}GeneratedSource} ) - if (BUILD_DOXYGEN) - add_dependencies(Documentation ${directory_name}SourceCode) - endif (BUILD_DOXYGEN) - - - - - ###### - # Create list of generated headers - ###### - - set(generated_headers_h ${generated_code_output_path}/include/SimpleRTK${directory_name}GeneratedHeaders.h) - set(generated_headers_i ${generated_code_output_path}/include/SimpleRTK${directory_name}GeneratedHeaders.i) - set(tmp_generated_headers_h ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/SimpleRTK${directory_name}GeneratedHeaders.h) - set(tmp_generated_headers_i ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/include/SimpleRTK${directory_name}GeneratedHeaders.i) - - file ( WRITE ${generated_headers_i} "") - - # Add ifndefs - file ( WRITE "${tmp_generated_headers_h}" "#ifndef __SimpleRTK${directory_name}GeneratedHeaders_h\n") - file ( APPEND "${tmp_generated_headers_h}" "#define __SimpleRTK${directory_name}GeneratedHeaders_h\n") - - foreach ( filter ${GENERATED_FILTER_LIST} ) - file ( APPEND "${tmp_generated_headers_h}" "#include \"srtk${filter}.h\"\n" ) - file ( APPEND "${tmp_generated_headers_i}" "%include \"srtk${filter}.h\"\n" ) - endforeach() - - file ( APPEND "${tmp_generated_headers_h}" "#endif\n") - - configure_file( "${tmp_generated_headers_h}" "${generated_headers_h}" COPYONLY ) - configure_file( "${tmp_generated_headers_i}" "${generated_headers_i}" COPYONLY ) - - install(FILES - ${SimpleRTK${directory_name}GeneratedHeader} - ${generated_headers_h} - ${generated_headers_i} - DESTINATION ${SimpleRTK_INSTALL_INCLUDE_DIR} - COMPONENT Development) - - -endmacro() diff --git a/utilities/SimpleRTK/CMake/srtkLanguageOptions.cmake b/utilities/SimpleRTK/CMake/srtkLanguageOptions.cmake deleted file mode 100644 index 4d4b7d14b..000000000 --- a/utilities/SimpleRTK/CMake/srtkLanguageOptions.cmake +++ /dev/null @@ -1,216 +0,0 @@ -# -# - This module finds the languages supported by SimpleRTK, and -#present the option to enable support -# - -# -# Currently this will search for Python, Java, TCL, Ruby, C#, R -# Additionally it give the option to wrap LUA. -# - -include(srtkTargetLinkLibrariesWithDynamicLookup) - -# -# Macro to set "_QUIET" and "_QUIET_LIBRARY" based on the first -# argument being defined and true, to either REQUIRED or QUIET. -# -macro(set_QUIET var) - if ( DEFINED ${var} AND ${var} ) - set( _QUIET "REQUIRED" ) - else() - set( _QUIET "QUIET" ) - endif() - if ( SRTK_UNDEFINED_SYMBOLS_ALLOWED ) - set( _QUIET_LIBRARY "QUIET" ) - else() - set( _QUIET_LIBRARY ${_QUIET} ) - endif() -endmacro() - -# -# Setup the option for each language -# -set_QUIET( WRAP_LUA ) -if (CMAKE_VERSION VERSION_LESS "3") - find_package ( Lua51 ${_QUIET} ) - if ( NOT LUA_FOUND ) - find_package ( Lua50 ${_QUIET} ) - endif() -else() - find_package ( Lua ${_QUIET} ) -endif() -set( WRAP_LUA_DEFAULT OFF ) - -set( LUA_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional libraries which may be needed for lua such as readline.") -mark_as_advanced( LUA_ADDITIONAL_LIBRARIES ) - -option ( WRAP_LUA "Wrap Lua" ${WRAP_LUA_DEFAULT} ) - -if ( WRAP_LUA ) - find_package( LuaInterp REQUIRED ) - list( APPEND SRTK_LANGUAGES_VARS - LUA_EXECUTABLE - LUA_LIBRARIES - LUA_INCLUDE_DIR - LUA_VERSION_STRING - LUA_MATH_LIBRARY - LUA_ADDITIONAL_LIBRARIES - ) -endif() - - - -# If you're not using python or it's the first time, be quiet - -set_QUIET( WRAP_PYTHON ) -find_package ( PythonInterp ${_QUIET}) -find_package ( PythonLibs ${PYTHON_VERSION_STRING} EXACT ${_QUIET_LIBRARY} ) - -if (PYTHON_VERSION_STRING VERSION_LESS 2.6) - message( WARNING "Python version less that 2.6: \"${PYTHON_VERSION_STRING}\"." ) -endif() - -if ( PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND - AND (PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING) ) - set( WRAP_PYTHON_DEFAULT ON ) -else() - set( WRAP_PYTHON_DEFAULT OFF ) -endif() - -option( WRAP_PYTHON "Wrap Python" ${WRAP_PYTHON_DEFAULT} ) - -if ( WRAP_PYTHON ) - list( APPEND SRTK_LANGUAGES_VARS - PYTHON_DEBUG_LIBRARY - PYTHON_EXECUTABLE - PYTHON_LIBRARY - PYTHON_INCLUDE_DIR - # PYTHON_INCLUDE_PATH ( deprecated ) - ) -# Debian "jessie" has this additional variable required to match -# python versions. - if(PYTHON_INCLUDE_DIR2) - list( APPEND SRTK_LANGUAGES_VARS - PYTHON_INCLUDE_DIR2 - ) - endif() -endif () - - - -set_QUIET( WRAP_JAVA ) -find_package ( Java COMPONENTS Development Runtime ${_QUIET} ) -find_package ( JNI ${_QUIET} ) -set( WRAP_JAVA_DEFAULT OFF ) - -option ( WRAP_JAVA "Wrap Java" ${WRAP_JAVA_DEFAULT} ) - -if ( WRAP_JAVA ) - list( APPEND SRTK_LANGUAGES_VARS - Java_JAVA_EXECUTABLE - Java_JAVAC_EXECUTABLE - Java_JAR_EXECUTABLE - Java_JAVADOC_EXECUTABLE - Java_JAVAH_EXECUTABLE - Java_VERSION_STRING - Java_VERSION_MAJOR - Java_VERSION_MINOR - Java_VERSION_PATCH - Java_VERSION_TWEAK - Java_VERSION - Java_INCLUDE_DIRS - Java_LIBRARIES - JNI_INCLUDE_DIRS - JNI_LIBRARIES - JAVA_AWT_LIBRARY - JAVA_JVM_LIBRARY - JAVA_INCLUDE_PATH - JAVA_INCLUDE_PATH2 - JAVA_AWT_INCLUDE_PATH - ) -endif() - - -set_QUIET(WRAP_TCL) - -find_package ( TCL ${_QUIET} ) - -set ( WRAP_TCL_DEFAULT OFF ) - -option ( WRAP_TCL "Wrap Tcl" ${WRAP_TCL_DEFAULT} ) - -if ( WRAP_TCL ) - list( APPEND SRTK_LANGUAGES_VARS - TCL_LIBRARY - TCL_INCLUDE_PATH - TCL_TCLSH - TK_LIBRARY - TK_INCLUDE_PATH - TK_WISH - ) -endif() - - -set_QUIET( WRAP_RUBY ) - -find_package ( Ruby ${_QUIET} ) -set ( WRAP_RUBY_DEFAULT OFF ) - -option ( WRAP_RUBY "Wrap Ruby" ${WRAP_RUBY_DEFAULT} ) - -if ( WRAP_RUBY ) - list( APPEND SRTK_LANGUAGES_VARS - RUBY_EXECUTABLE - RUBY_INCLUDE_DIRS - RUBY_LIBRARY - RUBY_VERSION - RUBY_FOUND - RUBY_INCLUDE_PATH - ) -endif() - - -if (DEFINED WRAP_CSHARP AND WRAP_CSHARP) - set(_QUIET "REQUIRED") -else() - set(_QUIET "QUIET") -endif() - -find_package( CSharp ${_QUIET} ) -set ( WRAP_CSHARP_DEFAULT OFF ) - -option ( WRAP_CSHARP "Wrap C#" ${WRAP_CSHARP_DEFAULT} ) - -if ( WRAP_CSHARP ) - list( APPEND SRTK_LANGUAGES_VARS - CSHARP_COMPILER - CSHARP_INTERPRETER - CSHARP_PLATFORM - ) -endif() - - -set_QUIET( WRAP_R ) - -find_package(R ${_QUIET}) -set ( WRAP_R_DEFAULT OFF ) - -option ( WRAP_R "Wrap R" ${WRAP_R_DEFAULT} ) - -if ( WRAP_R ) - list( APPEND SRTK_LANGUAGES_VARS - R_INCLUDE_DIR - R_LIBRARIES - R_LIBRARY_BASE - R_COMMAND - RSCRIPT_EXECUTABLE ) -endif() - - -if( WIN32 ) - mark_as_advanced( WRAP_R ) -endif() - -# -# Below here are the 2nd tier languages they are not enabled automatically if detected -# diff --git a/utilities/SimpleRTK/CMake/srtkPreventInBuildInstalls.cmake b/utilities/SimpleRTK/CMake/srtkPreventInBuildInstalls.cmake deleted file mode 100644 index 11d1ace55..000000000 --- a/utilities/SimpleRTK/CMake/srtkPreventInBuildInstalls.cmake +++ /dev/null @@ -1,9 +0,0 @@ -string(TOLOWER "${CMAKE_INSTALL_PREFIX}" _PREFIX) -string(TOLOWER "${RTK_BINARY_DIR}" _BUILD) -if("${_PREFIX}" STREQUAL "${_BUILD}") - message(FATAL_ERROR - "The current CMAKE_INSTALL_PREFIX points at the build tree:\n" - " ${CMAKE_INSTALL_PREFIX}\n" - "This is not supported." - ) -endif() diff --git a/utilities/SimpleRTK/CMake/srtkPreventInSourceBuilds.cmake b/utilities/SimpleRTK/CMake/srtkPreventInSourceBuilds.cmake deleted file mode 100644 index 123ad52d9..000000000 --- a/utilities/SimpleRTK/CMake/srtkPreventInSourceBuilds.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# -# This function will prevent in-source builds -function(AssureOutOfSourceBuilds) - # make sure the user doesn't play dirty with symlinks - get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) - get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) - - # disallow in-source builds - if("${srcdir}" STREQUAL "${bindir}") - message("######################################################") - message("# SimpleRTK should not be configured & built in the SimpleRTK source directory") - message("# You must run cmake in a build directory.") - message("######################################################") - message(FATAL_ERROR "Quitting configuration") - endif() -endfunction() - -AssureOutOfSourceBuilds() diff --git a/utilities/SimpleRTK/CMake/srtkProjectLanguageCommon.cmake b/utilities/SimpleRTK/CMake/srtkProjectLanguageCommon.cmake deleted file mode 100644 index aad19fd6a..000000000 --- a/utilities/SimpleRTK/CMake/srtkProjectLanguageCommon.cmake +++ /dev/null @@ -1,111 +0,0 @@ - -foreach(p - CMP0042 # CMake 3.0 - CMP0063 # CMake 3.3.2 - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - - -# -# Project setup -# - -if (NOT CMAKE_PROJECT_NAME STREQUAL "SimpleRTK" ) - - set( SimpleRTK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." ) - list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}") - - find_package(SimpleRTK REQUIRED) - include(${SimpleRTK_USE_FILE}) - - # Add compiler flags needed to use SimpleRTK. - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SimpleRTK_REQUIRED_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimpleRTK_REQUIRED_CXX_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") - -endif() - - -# Setup build locations to the wrapping language sub directories -if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleRTK" ) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -endif() -if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleRTK" ) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() -if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleRTK" ) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() - - -# Since most language libraries are not installed with CMake, the -# RPATH does not get fixed up during installation. So skip the RPATH -if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH) - set(CMAKE_SKIP_BUILD_RPATH 1) -endif() - -if(NOT TARGET dist) - add_custom_target( dist cmake -E echo "Finished generating wrapped packages for distribution..." ) -endif() - -# TODO these should be moved into UseSimpleRTK -if(NOT SimpleRTK_DOC_FILES) - set ( SimpleRTK_DOC_FILES - "${SimpleRTK_SOURCE_SOURCE_DIR}/LICENSE" - "${SimpleRTK_SOURCE_SOURCE_DIR}/NOTICE" - "${SimpleRTK_SOURCE_SOURCE_DIR}/Readme.md" - ) -endif() - -# -# General SWIG configuration -# - -find_package ( SWIG 2 REQUIRED ) - -include (srtkUseSWIG) - -set(SimpleRTK_WRAPPING_COMMON_DIR - ${SimpleRTK_SOURCE_DIR}/Wrapping/Common) - -if ( CMAKE_PROJECT_NAME STREQUAL "SimpleRTK" ) - file(GLOB SWIG_EXTRA_DEPS - "${SimpleRTK_SOURCE_DIR}/Code/Common/include/*.h" - "${SimpleRTK_SOURCE_DIR}/Code/Registration/include/*.h" - "${SimpleRTK_SOURCE_DIR}/Code/IO/include/*.h") - list( APPEND SWIG_EXTRA_DEPS - "${SimpleRTK_BINARY_DIR}/Code/BasicFilters/include/SimpleRTKBasicFiltersGeneratedHeaders.h" - ${SimpleRTKBasicFiltersGeneratedHeader} ) -else() - find_file( _file - NAMES SimpleRTKBasicFiltersGeneratedHeaders.h - PATHS ${SimpleRTK_INCLUDE_DIRS} - NO_DEFAULT_PATH ) - list( APPEND SWIG_EXTRA_DEPS ${_file} ) -endif() - -# make a manual list of dependencies for the Swig.i files -list( APPEND SWIG_EXTRA_DEPS - "${SimpleRTK_WRAPPING_COMMON_DIR}/SimpleRTK_Common.i" - ) - -# check if uint64_t is the same as unsigned long -try_compile(SRTK_ULONG_SAME_AS_UINT64 - ${PROJECT_BINARY_DIR}/CMakeTmp - ${SimpleRTK_SOURCE_DIR}/CMake/same_uint64_ulong.cxx ) - -# when "-DSWIGWORDSIZE64" is defined SWIG used unsigned long for uint64_t types -if(${SRTK_ULONG_SAME_AS_UINT64} ) - set ( CMAKE_SWIG_GLOBAL_FLAGS "-DSWIGWORDSIZE64" ) -endif() - -set ( CMAKE_SWIG_GLOBAL_FLAGS -I${SimpleRTK_WRAPPING_COMMON_DIR} ${CMAKE_SWIG_GLOBAL_FLAGS} ) - -include(srtkTargetLinkLibrariesWithDynamicLookup) -include(srtkStripOption) -include(srtkForbidDownloadsOption) diff --git a/utilities/SimpleRTK/CMake/srtkSourceVersion.cmake b/utilities/SimpleRTK/CMake/srtkSourceVersion.cmake deleted file mode 100644 index b963c9a77..000000000 --- a/utilities/SimpleRTK/CMake/srtkSourceVersion.cmake +++ /dev/null @@ -1,117 +0,0 @@ -# -# This CMake code extracts the information from the git repository, -# and automatically causes a reconfigure if the git HEAD changes. The -# following variable may be defined after execution: -# -# _GIT_VERSION_HASH - the SHA1 hash of the current HEAD -# -# Based on the most recent tag starting with the letter "v" for -# version, which is expected to be of the form -# vN.N[.N[.N][(a|b|c|rc[N])] the following is extracted or undefined: -# -# _GIT_VERSION_MAJOR -# _GIT_VERSION_MINOR -# _GIT_VERSION_PATCH -# _GIT_VERSION_TWEAK -# _GIT_VERSION_RC -# -# If the current project's version ( defiend by -# ${CMAKE_PROJECT_NAME}_VERSION_MAJOR and MINOR and PATCH and TWEAK -# match that of the tag, then it'll be considered that the project is -# in post release mode otherwise it's considered underdevelopment. -# -# Only one of the following variables will be defined. -# _GIT_VERSION_DEV is defined as number of commits -# since the projects Version.cmake file has been modified. While -# _GIT_VERSION_POST is defined as the number of commits since the tag. -# - - -include(GetGitRevisionDescription) - -get_git_head_revision(GIT_REFVAR _GIT_VERSION_HASH) - -# if there is not git directory we should be in a distributed package -# which should contain this additional cmake file with the -# _GIT_VERSION variables -if(_GIT_VERSION_HASH STREQUAL "GITDIR-NOTFOUND") - include( "${CMAKE_CURRENT_LIST_DIR}/srtkSourceVersionVars.cmake" ) - return() -endif() - -if(_GIT_VERSION_HASH MATCHES "[a-fA-F0-9]+") - string(SUBSTRING "${_GIT_VERSION_HASH}" 0 5 _GIT_VERSION_HASH) -endif() - -# find the closest anotated tag with the v prefix for version -git_describe(_GIT_TAG "--match=v*") - -git_commits_since("${PROJECT_SOURCE_DIR}/Version.cmake" _GIT_VERSION_COUNT) - -set(VERSION_REGEX "^v([0-9]+)\\.([0-9]+)+(\\.([0-9]+))?(\\.([0-9]+))?((a|b|c|rc)[0-9]*)?(-[0-9]+)?") - -string(REGEX MATCH "${VERSION_REGEX}" _out "${_GIT_TAG}") - -if("${_out}" STREQUAL "") - message(WARNING "git tag: \"${_GIT_TAG}\" does not match expected version format!") - return() -endif() - -set(_GIT_VERSION_MAJOR "${CMAKE_MATCH_1}") -set(_GIT_VERSION_MINOR "${CMAKE_MATCH_2}") -if(NOT "${CMAKE_MATCH_4}" STREQUAL "") - set(_GIT_VERSION_PATCH "${CMAKE_MATCH_4}") -endif() -if(NOT "${CMAKE_MATCH_6}" STREQUAL "") - set(_GIT_VERSION_TWEAK "${CMAKE_MATCH_6}") -endif() -if(NOT "${CMAKE_MATCH_7}" STREQUAL "") - set(_GIT_VERSION_RC "${CMAKE_MATCH_7}" ) # a,b,rc01 etc -endif() - -if(NOT "${CMAKE_MATCH_9}" STREQUAL "") - #trim leading '-' - string(SUBSTRING "${CMAKE_MATCH_9}" 1 -1 CMAKE_MATCH_9) - - set(_GIT_TAG_COUNT "${CMAKE_MATCH_9}") -endif() - - -set(_GIT_VERSION "${_GIT_VERSION_MAJOR}.${_GIT_VERSION_MINOR}") -if(DEFINED _GIT_VERSION_PATCH) - set(_GIT_VERSION "${_GIT_VERSION}.${_GIT_VERSION_PATCH}") - if(DEFINED _GIT_VERSION_TWEAK) - set(_GIT_VERSION "${_GIT_VERSION}.${_GIT_VERSION_TWEAK}") - elseif(DEFINED ${CMAKE_PROJECT_NAME}_VERSION_TWEAK) - set(_GIT_VERSION "${_GIT_VERSION}.0") - endif() -elseif(DEFINED ${CMAKE_PROJECT_NAME}_VERSION_PATCH) - set(_GIT_VERSION "${_GIT_VERSION}.0") - if(DEFINED ${CMAKE_PROJECT_NAME}_VERSION_TWEAK) - set(_GIT_VERSION "${_GIT_VERSION}.0") - endif() -endif() - -set(_${CMAKE_PROJECT_NAME}_VERSION "${${CMAKE_PROJECT_NAME}_VERSION_MAJOR}.${${CMAKE_PROJECT_NAME}_VERSION_MINOR}") -if(DEFINED ${CMAKE_PROJECT_NAME}_VERSION_PATCH) - set(_${CMAKE_PROJECT_NAME}_VERSION "${_${CMAKE_PROJECT_NAME}_VERSION}.${${CMAKE_PROJECT_NAME}_VERSION_PATCH}") - if(DEFINED ${CMAKE_PROJECT_NAME}_VERSION_TWEAK) - set(_${CMAKE_PROJECT_NAME}_VERSION "${_${CMAKE_PROJECT_NAME}_VERSION}.${${CMAKE_PROJECT_NAME}_VERSION_TWEAK}") - endif() -endif() - - -if(_GIT_VERSION VERSION_EQUAL _${CMAKE_PROJECT_NAME}_VERSION) - if(_GIT_TAG_COUNT) #ignore if 0 - set(_GIT_VERSION_POST "${_GIT_TAG_COUNT}") - endif() -else() - # The first commit after a tag should increase the project version - # number in Version.cmake and be "dev1" - MATH(EXPR _GIT_VERSION_COUNT "${_GIT_VERSION_COUNT}+1") - set(_GIT_VERSION_DEV "${_GIT_VERSION_COUNT}") -endif() - -# save variable in a configuration file in case we have no git directory -configure_file("${CMAKE_CURRENT_LIST_DIR}/srtkSourceVersionVars.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/srtkSourceVersionVars.cmake" @ONLY) diff --git a/utilities/SimpleRTK/CMake/srtkSourceVersionVars.cmake.in b/utilities/SimpleRTK/CMake/srtkSourceVersionVars.cmake.in deleted file mode 100644 index 8f331e19f..000000000 --- a/utilities/SimpleRTK/CMake/srtkSourceVersionVars.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -macro( _set_if_not_empty var value ) - if( NOT "${value}" STREQUAL "" ) - set( ${var} "${value}" ) - endif() -endmacro() - -set( _GIT_VERSION_MAJOR "@_GIT_VERSION_MAJOR@" ) -set( _GIT_VERSION_MINOR "@_GIT_VERSION_MINOR@" ) -_set_if_not_empty( _GIT_VERSION_PATCH "@_GIT_VERSION_PATCH@" ) -_set_if_not_empty( _GIT_VERSION_TWEAK "@_GIT_VERSION_TWEAK@" ) -_set_if_not_empty( _GIT_VERSION_RC "@_GIT_VERSION_RC@" ) -_set_if_not_empty( _GIT_VERSION_POST "@_GIT_VERSION_POST@" ) -_set_if_not_empty( _GIT_VERSION_DEV "@_GIT_VERSION_DEV@" ) -_set_if_not_empty( _GIT_VERSION_HASH "@_GIT_VERSION_HASH@" ) diff --git a/utilities/SimpleRTK/CMake/srtkStripOption.cmake b/utilities/SimpleRTK/CMake/srtkStripOption.cmake deleted file mode 100644 index f3fa9921f..000000000 --- a/utilities/SimpleRTK/CMake/srtkStripOption.cmake +++ /dev/null @@ -1,30 +0,0 @@ - -#------------------------------------------------------------------------------ -# Strip Option - -# Add option to strip wrapping libraries. -# Since the wrapping libraries don't get installed by the normal cmake -# installation process, this option enables stripping of the libraries -# as part of the build process. It should be used on the laguage -# targets and the the SimpleRTK iterface, as those can be installed -# into the system. -option(SimpleRTK_BUILD_STRIP "Strip executables and libraries after building." OFF) -mark_as_advanced(SimpleRTK_BUILD_STRIP) -set(CMAKE_STRIP_FLAGS "-x" CACHE STRING "Flags used by strip in the post_build.") -mark_as_advanced(CMAKE_STRIP_FLAGS) -separate_arguments(CMAKE_STRIP_FLAGS) - -function(srtk_strip_target tgt) - if(NOT SimpleRTK_BUILD_STRIP) - return() - endif() - get_property(type TARGET ${tgt} PROPERTY TYPE) - if(NOT type STREQUAL STATIC_LIBRARY) - add_custom_command( - TARGET ${tgt} - POST_BUILD - COMMAND ${CMAKE_STRIP} ${CMAKE_STRIP_FLAGS} "$" - ) - endif() - -endfunction() diff --git a/utilities/SimpleRTK/CMake/srtkTargetLinkLibrariesWithDynamicLookup.cmake b/utilities/SimpleRTK/CMake/srtkTargetLinkLibrariesWithDynamicLookup.cmake deleted file mode 100644 index efe747123..000000000 --- a/utilities/SimpleRTK/CMake/srtkTargetLinkLibrariesWithDynamicLookup.cmake +++ /dev/null @@ -1,89 +0,0 @@ -# -# - This module provides the function -# srtk_target_link_libraries_with_dynamic_lookup which can be used to -# "weakly" link loadable module. -# -# Link a library to a target such that the symbols are resolved at -# run-time not link-time. This should be used when compiling a -# loadable module when the symbols should be resolve from the run-time -# environment where the module is loaded, and not a specific system -# library. -# -# Specifically, for OSX it uses undefined dynamic_lookup. This is -# simular to using "-shared" on Linux where undefined symbols are -# ignored. -# -# Additionally, the linker is checked to see if it supports undefined -# symbols when linking a shared library. If it does then the library -# is not linked when specified with this function. -# -# http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/ -# - -# Function: _srtkCheckUndefinedSymbolsAllowed -# -# Check if the linker allows undefined symbols for shared libraries. -# -# SRTK_UNDEFINED_SYMBOLS_ALLOWED - true if the linker will allow -# undefined symbols for shared libraries -# - -function(_srtkCheckUndefinedSymbolsAllowed) - - set(VARIABLE "SRTK_UNDEFINED_SYMBOLS_ALLOWED") - - # hash the CMAKE_FLAGS passed and check cache to know if we need to rerun - string(MD5 cmake_flags_hash "${CMAKE_SHARED_LINKER_FLAGS}") - set(cache_var "${VARIABLE}_${cmake_flags_hash}") - - if(DEFINED "${cache_var}") - set(${VARIABLE} "${${cache_var}}" CACHE INTERNAL "Using hash (${cmake_flags_hash}) value from TRY_COMPILE") - else() - set(test_project_dir "${PROJECT_BINARY_DIR}/CMakeTmp/${VARIABLE}") - - file(WRITE "${test_project_dir}/CMakeLists.txt" -" -project(undefined C) -set( CMAKE_MACOSX_RPATH 1) -add_library(foo SHARED \"foo.c\") -") - - file(WRITE "${test_project_dir}/foo.c" -" -extern int bar(void); -int foo(void) {return bar()+1;} -") - - try_compile(${VARIABLE} - "${test_project_dir}" - "${test_project_dir}" - undefined - CMAKE_FLAGS - "-DCMAKE_SHARED_LINKER_FLAGS='${CMAKE_SHARED_LINKER_FLAGS}'" - "-DCMAKE_MACOSX_RPATH=OFF" - OUTPUT_VARIABLE output) - - set(${cache_var} ${${VARIABLE}} CACHE INTERNAL "hashed flags with try_compile results") - - if(${VARIABLE}) - message(STATUS "Performing Test ${VARIABLE} - Success") - else() - message(STATUS "Performing Test ${VARIABLE} - Failed") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing Test ${VARIABLE} failed with the following output:\n" - "${OUTPUT}\n") - endif() - endif() -endfunction() - -_srtkCheckUndefinedSymbolsAllowed() - -macro( srtk_target_link_libraries_with_dynamic_lookup target ) - if ( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) - set_target_properties( ${target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" ) - elseif(SRTK_UNDEFINED_SYMBOLS_ALLOWED) - # linker allows undefined symbols, let's just not link - else() - target_link_libraries ( ${target} ${ARGN} ) - endif() -endmacro() diff --git a/utilities/SimpleRTK/CMake/srtkUseSWIG.cmake b/utilities/SimpleRTK/CMake/srtkUseSWIG.cmake deleted file mode 100644 index ac2ea9828..000000000 --- a/utilities/SimpleRTK/CMake/srtkUseSWIG.cmake +++ /dev/null @@ -1,274 +0,0 @@ -# - SWIG module for CMake -# Defines the following macros: -# SWIG_ADD_MODULE(name language [ files ]) -# - Define swig module with given name and specified language -# SWIG_LINK_LIBRARIES(name [ libraries ]) -# - Link libraries to swig module -# All other macros are for internal use only. -# To get the actual target name of the swig moduel, -# use: ${SWIG_MODULE_${name}_TARGET_NAME}. -# The target name can be used to set dependecies between targets. -# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify -# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add -# special flags to all swig calls. -# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify -# where to write all the swig generated module (swig -outdir option) -# The name-specific variable SWIG_MODULE__EXTRA_DEPS may be used -# to specify extra dependencies for the generated modules. -# If the source file generated by swig need some special flag you can use -# SET_SOURCE_FILES_PROPERTIES( ${swig_generated_file_fullname} -# PROPERTIES COMPILE_FLAGS "-bla") - - -#============================================================================= -# Copyright 2004-2009 Kitware, Inc. -# Copyright 2009 Mathieu Malaterre -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) - -SET(SWIG_CXX_EXTENSION "cxx") -SET(SWIG_EXTRA_LIBRARIES "") - -SET(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") - -# -# For given swig module initialize variables associated with it -# -MACRO(SWIG_MODULE_INITIALIZE name language) - STRING(TOUPPER "${language}" swig_uppercase_language) - STRING(TOLOWER "${language}" swig_lowercase_language) - SET(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") - SET(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") - - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xRUBYx$") - STRING(TOLOWER "${name}" ruby_module_name) - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xRUBYx$") - - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") - SET(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") - - SET( SWIG_MODULE_${name}_TARGET_NAME "${name}_${SWIG_MODULE_${name}_LANGUAGE}" ) - -ENDMACRO(SWIG_MODULE_INITIALIZE) - -# -# For a given language, input file, and output file, determine extra files that -# will be generated. This is internal swig macro. -# - -MACRO(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) - GET_SOURCE_FILE_PROPERTY(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename - ${infile} SWIG_MODULE_NAME) - IF(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - GET_FILENAME_COMPONENT(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) - ENDIF(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - SET(${outfiles}) - FOREACH(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) - SET(${outfiles} ${${outfiles}} - "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") - ENDFOREACH(it) -ENDMACRO(SWIG_GET_EXTRA_OUTPUT_FILES) - -# -# Take swig (*.i) file and add proper custom commands for it -# -MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) - SET(swig_full_infile ${infile}) - GET_FILENAME_COMPONENT(swig_source_file_path "${infile}" PATH) - GET_FILENAME_COMPONENT(swig_source_file_name_we "${infile}" NAME_WE) - GET_SOURCE_FILE_PROPERTY(swig_source_file_generated ${infile} GENERATED) - GET_SOURCE_FILE_PROPERTY(swig_source_file_cplusplus ${infile} CPLUSPLUS) - GET_SOURCE_FILE_PROPERTY(swig_source_file_flags ${infile} SWIG_FLAGS) - IF("${swig_source_file_flags}" STREQUAL "NOTFOUND") - SET(swig_source_file_flags "") - ENDIF("${swig_source_file_flags}" STREQUAL "NOTFOUND") - SET(swig_source_file_fullname "${infile}") - IF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - STRING(REGEX REPLACE - "^${CMAKE_CURRENT_SOURCE_DIR}" "" - swig_source_file_relative_path - "${swig_source_file_path}") - ELSE(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - IF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - STRING(REGEX REPLACE - "^${CMAKE_CURRENT_BINARY_DIR}" "" - swig_source_file_relative_path - "${swig_source_file_path}") - SET(swig_source_file_generated 1) - ELSE(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - SET(swig_source_file_relative_path "${swig_source_file_path}") - IF(swig_source_file_generated) - SET(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}") - ELSE(swig_source_file_generated) - SET(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") - ENDIF(swig_source_file_generated) - ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - - SET(swig_generated_file_fullname - "${CMAKE_CURRENT_BINARY_DIR}") - IF(swig_source_file_relative_path) - SET(swig_generated_file_fullname - "${swig_generated_file_fullname}/${swig_source_file_relative_path}") - ENDIF(swig_source_file_relative_path) - # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir - IF(CMAKE_SWIG_OUTDIR) - SET(swig_outdir ${CMAKE_SWIG_OUTDIR}) - # it may not exist, so create it: - file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}) - ELSE(CMAKE_SWIG_OUTDIR) - SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF(CMAKE_SWIG_OUTDIR) - SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} - swig_extra_generated_files - "${swig_outdir}" - "${infile}") - SET(swig_generated_file_fullname - "${swig_generated_file_fullname}/${swig_source_file_name_we}") - # add the language into the name of the file (i.e. TCL_wrap) - # this allows for the same .i file to be wrapped into different languages - SET(swig_generated_file_fullname - "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap") - - IF(swig_source_file_cplusplus) - SET(swig_generated_file_fullname - "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") - ELSE(swig_source_file_cplusplus) - SET(swig_generated_file_fullname - "${swig_generated_file_fullname}.c") - ENDIF(swig_source_file_cplusplus) - - #MESSAGE("Full path to source file: ${swig_source_file_fullname}") - #MESSAGE("Full path to the output file: ${swig_generated_file_fullname}") - GET_DIRECTORY_PROPERTY(cmake_include_directories INCLUDE_DIRECTORIES) - SET(swig_include_dirs) - FOREACH(it ${cmake_include_directories}) - SET(swig_include_dirs ${swig_include_dirs} "-I${it}") - ENDFOREACH(it) - - SET(swig_special_flags) - # default is c, so add c++ flag if it is c++ - IF(swig_source_file_cplusplus) - SET(swig_special_flags ${swig_special_flags} "-c++") - ENDIF(swig_source_file_cplusplus) - SET(swig_extra_flags) - IF(SWIG_MODULE_${name}_EXTRA_FLAGS) - SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) - ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS) - ADD_CUSTOM_COMMAND( - OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} - COMMAND "${SWIG_EXECUTABLE}" - ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" - ${swig_source_file_flags} - ${CMAKE_SWIG_FLAGS} - -outdir ${swig_outdir} - ${swig_special_flags} - ${swig_extra_flags} - ${swig_include_dirs} - -o "${swig_generated_file_fullname}" - "${swig_source_file_fullname}" - MAIN_DEPENDENCY "${swig_source_file_fullname}" - DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} - COMMENT "Swig source to generate ${SWIG_MODULE_${name}_LANGUAGE} wrapping") - SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" ${swig_extra_generated_files} - PROPERTIES GENERATED 1) - SET(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) -ENDMACRO(SWIG_ADD_SOURCE_TO_MODULE) - -# -# Create Swig module -# -MACRO(SWIG_ADD_MODULE name language) - SWIG_MODULE_INITIALIZE(${name} ${language}) - SET(swig_dot_i_sources) - SET(swig_other_sources) - FOREACH(it ${ARGN}) - IF(${it} MATCHES ".*\\.i$") - SET(swig_dot_i_sources ${swig_dot_i_sources} "${it}") - ELSE(${it} MATCHES ".*\\.i$") - SET(swig_other_sources ${swig_other_sources} "${it}") - ENDIF(${it} MATCHES ".*\\.i$") - ENDFOREACH(it) - - SET(swig_generated_sources) - FOREACH(it ${swig_dot_i_sources}) - SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it}) - SET(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") - ENDFOREACH(it) - GET_DIRECTORY_PROPERTY(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) - SET_DIRECTORY_PROPERTIES(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}") - ADD_LIBRARY( ${SWIG_MODULE_${name}_TARGET_NAME} - MODULE - ${swig_generated_sources} - ${swig_other_sources}) - SET_TARGET_PROPERTIES( ${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES OUTPUT_NAME "${name}" ) - STRING(TOLOWER "${language}" swig_lowercase_language) - IF ("${swig_lowercase_language}" STREQUAL "java") - IF (APPLE) - # In java you want: - # System.loadLibrary("LIBRARY"); - # then JNI will look for a library whose name is platform dependent, namely - # MacOS : libLIBRARY.jnilib - # Windows: LIBRARY.dll - # Linux : libLIBRARY.so - SET_TARGET_PROPERTIES (${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES SUFFIX ".jnilib") - ENDIF (APPLE) - ENDIF ("${swig_lowercase_language}" STREQUAL "java") - IF ("${swig_lowercase_language}" STREQUAL "python") - - # when swig is used without the -interface it will produce in the module.py - # a 'import _modulename' statement, which implies having a corresponding - # _modulename.so (*NIX), _modulename.pyd (Win32). - SET_TARGET_PROPERTIES( ${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES OUTPUT_NAME "_${name}" ) - - # this is only needed for the python case where a _modulename.so is generated - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES PREFIX "") - - # Python extension modules on Windows must have the extension ".pyd" - # instead of ".dll" as of Python 2.5. Older python versions do support - # this suffix. - # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000 - # - # Windows: .dll is no longer supported as a filename extension for extension modules. - # .pyd is now the only filename extension that will be searched for. - # - IF(WIN32 AND NOT CYGWIN) - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES SUFFIX ".pyd") - ENDIF(WIN32 AND NOT CYGWIN) - ENDIF ("${swig_lowercase_language}" STREQUAL "python") - IF ("${swig_lowercase_language}" STREQUAL "ruby") - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES PREFIX "") - IF(APPLE) - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES SUFFIX ".bundle") - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES COMPILE_FLAGS "-bundle") - ENDIF(APPLE) - ENDIF ("${swig_lowercase_language}" STREQUAL "ruby") - IF ("${swig_lowercase_language}" STREQUAL "r") - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_TARGET_NAME} PROPERTIES PREFIX "") - ENDIF () -ENDMACRO(SWIG_ADD_MODULE) - -# -# Like TARGET_LINK_LIBRARIES but for swig modules -# -MACRO(SWIG_LINK_LIBRARIES name) - IF(SWIG_MODULE_${name}_TARGET_NAME) - TARGET_LINK_LIBRARIES(${SWIG_MODULE_${name}_TARGET_NAME} ${ARGN}) - ELSE(SWIG_MODULE_${name}_TARGET_NAME) - MESSAGE(SEND_ERROR "Cannot find Swig library \"${name}\".") - ENDIF(SWIG_MODULE_${name}_TARGET_NAME) -ENDMACRO(SWIG_LINK_LIBRARIES name) diff --git a/utilities/SimpleRTK/CMake/srtk_check_cxx11.cxx b/utilities/SimpleRTK/CMake/srtk_check_cxx11.cxx deleted file mode 100644 index 211c87a8d..000000000 --- a/utilities/SimpleRTK/CMake/srtk_check_cxx11.cxx +++ /dev/null @@ -1,194 +0,0 @@ - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_STATIC_ASSERT - -int main(void) -{ - static_assert( true, "this should compile with C++0x static_assert keyword support"); - return 0; -} - -#endif - - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_NULLPTR - -struct C { - void func(); -}; - -int main(void) -{ - int *x = nullptr; - char *c = nullptr; - void (C::*pmf)() = nullptr; - if (nullptr==c) {} - if (nullptr==pmf) {} - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_FUNCTIONAL - -#include - -void f(int,int) {} - -int main(void) -{ -std::function g(f); -using namespace std::placeholders; -std::function h = std::bind(g,0,_1); -return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_ALIAS_TEMPLATE - -template -using ptr = T*; - -int main(void) -{ -ptr x; -return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_UNIQUE_PTR - -#include - -int main(void) { - std::unique_ptr p1(new int); - return 0; -} - -#endif - - - -//------------------------------------- - -#ifdef SRTK_HAS_TR1_FUNCTIONAL - -#ifdef HAS_TR1_SUB_INCLUDE -#include -#else -#include -#endif - -void f(int,int) {} - -int main(void) -{ - std::tr1::function g(f); - using namespace std::tr1::placeholders; - std::tr1::function h = std::tr1::bind(g,0,_1); - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_TYPE_TRAITS - -#include - -int main(void) -{ - std::integral_constant a; - std::true_type b; - std::false_type c; - std::is_same::type d; - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_TR1_TYPE_TRAITS - -#ifdef HAS_TR1_SUB_INCLUDE -#include -#else -#include -#endif - -int main(void) -{ - std::tr1::integral_constant a; - std::tr1::true_type b; - std::tr1::false_type c; - std::tr1::is_same::type d; - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_CXX11_UNORDERED_MAP - -#include - -int main(void) -{ - // On OSX with gcc 4.0, there is an internal const correctness issue - // in the following. - std::unordered_map s; - const std::unordered_map &c_ref = s; - c_ref.find(1); // Problem is here. - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_TR1_UNORDERED_MAP - - -#ifdef HAS_TR1_SUB_INCLUDE -#include -#else -#include -#endif - -int main(void) -{ - // On OSX with gcc 4.0, there is an internal const correctness issue - // in the following. - std::tr1::unordered_map s; - const std::tr1::unordered_map &c_ref = s; - c_ref.find(1); // Problem is here. - return 0; -} - -#endif - -//------------------------------------- - -#ifdef SRTK_HAS_TR1_SUB_INCLUDE - -#include -#include -#include - -int main(void) { return 0; } - -#endif diff --git a/utilities/SimpleRTK/CMake/srtk_check_cxx11_required.cxx b/utilities/SimpleRTK/CMake/srtk_check_cxx11_required.cxx deleted file mode 100644 index 7727d827e..000000000 --- a/utilities/SimpleRTK/CMake/srtk_check_cxx11_required.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include -#if __cplusplus >= 201103L -#else -#if defined _LIBCPP_VERSION -#error "libc++ is not supported without C++11" -#endif -#endif - - -int main(void) -{ -std::cout << "__cplusplus:" << __cplusplus << std::endl; -return 0; -} diff --git a/utilities/SimpleRTK/CMakeLists.txt b/utilities/SimpleRTK/CMakeLists.txt deleted file mode 100644 index 19d4f7480..000000000 --- a/utilities/SimpleRTK/CMakeLists.txt +++ /dev/null @@ -1,524 +0,0 @@ -cmake_minimum_required (VERSION 3.0 FATAL_ERROR ) - -# Explicitly add INCREMENTAL linking option to command lines. -# http://www.cmake.org/pipermail/cmake/2010-February/035174.html -set(MSVC_INCREMENTAL_DEFAULT ON) - -project ( SimpleRTK ) - -cmake_policy( VERSION 3.0 ) - -foreach(p - CMP0042 # CMake 3.0 - CMP0063 # CMake 3.3.2 - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - -# Include extra CMake files -list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/CMake") - -#----------------------------------------------------------------------------- -# Version information -include(Version.cmake) - -set(SimpleRTK_VERSION "${SimpleRTK_VERSION_MAJOR}.${SimpleRTK_VERSION_MINOR}") -if(DEFINED SimpleRTK_VERSION_PATCH) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}.${SimpleRTK_VERSION_PATCH}") - if(DEFINED SimpleRTK_VERSION_TWEAK) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}.${SimpleRTK_VERSION_TWEAK}") - endif() -endif() - -if(DEFINED SimpleRTK_VERSION_RC) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}${SimpleRTK_VERSION_RC}") -endif() -if(DEFINED SimpleRTK_VERSION_POST) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}.post${SimpleRTK_VERSION_POST}") -elseif(DEFINED SimpleRTK_VERSION_DEV) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}.dev${SimpleRTK_VERSION_DEV}") -endif() - -option( SimpleRTK_BUILD_DISTRIBUTE "Remove '-g#####' from version. ( for official distribution only )" OFF ) -mark_as_advanced( SimpleRTK_BUILD_DISTRIBUTE ) -if( NOT SimpleRTK_BUILD_DISTRIBUTE ) - set(SimpleRTK_VERSION "${SimpleRTK_VERSION}-g${SimpleRTK_VERSION_HASH}") -endif() - -message(STATUS "Building SimpleRTK version \"${SimpleRTK_VERSION}\"") - -#----------------------------------------------------------- -# Check and set required flags for compilation -# This must be done before any other try compiles based tests are -# done. -include(srtkCheckRequiredFlags) - -find_package(ITK REQUIRED ) # the modules needed can be listed here as required components -if(ITK_FOUND) - # NOTE: We are purposely not calling UseITK yet. However, we must make - # sure the required compilation and linker flags are set. Since, we - # are trying to encapsulate ITK, we need to very carefully control - # in access to the headers and libraries, hence each SimpleRTK - # library will call UseITK. - - # Add compiler flags needed to use ITK. - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ITK_REQUIRED_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ITK_REQUIRED_CXX_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") - - link_directories( "${ITK_LIBRARY_DIRS}") -endif() - -find_package(RTK REQUIRED ) # the modules needed can be listed here as required components -if(RTK_FOUND) - include(${RTK_USE_FILE}) - link_directories( "${RTK_LIBRARY_DIRS}") -endif() - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SimpleRTK_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimpleRTK_REQUIRED_CXX_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") - - -if( NOT ITK_USE_REVIEW ) -# TODO need to check ITK configuration to verify that it has the needed modules -# message(FATAL_ERROR "Please reconfigure ITK by turning ITK_USE_REVIEW ON") -endif() - -# Setup build locations. -if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -endif() -if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() -if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() - -set ( SimpleRTK_INCLUDE_DIRS - ${CMAKE_SOURCE_DIR}/Code/Common/include - ${CMAKE_SOURCE_DIR}/Code/Registration - ${CMAKE_SOURCE_DIR}/Code/BasicFilters/include - ${CMAKE_SOURCE_DIR}/Code/IO/include - ${CMAKE_BINARY_DIR}/Code/BasicFilters/include - ${CMAKE_BINARY_DIR}/Code/Common/include - ) - -set ( SimpleRTK_LIBRARIES SimpleRTKCommon SimpleRTKIO CACHE INTERNAL "" ) - -# Be sure to clear these each time -set ( GENERATED_TEST_LIST "" CACHE INTERNAL "" ) -set ( GENERATED_FILTER_LIST "" CACHE INTERNAL "" ) -set ( GENERATED_TEST_SOURCE_LIST "" CACHE INTERNAL "" ) - -#---------------------------------------------------------- -# Place all options to go into srtkConfigure.h here - -set( SITK_INT64_PIXELIDS_DEFAULT ON ) -if( MSVC ) - # See http://www.cmake.org/cmake/help/v2.8.10/cmake.html#variable:MSVC_VERSION - # and https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Version_history - # 1500 = VS 9.0 (Visual Studio 2008) - # 1600 = VS 10.0 (Visual Studio 2010) - # 1700 = VS 11.0 (Visual Studio 2012) - if(MSVC_VERSION VERSION_LESS 1600) - # with this option on the linker runs out of memory - set( SITK_INT64_PIXELIDS_DEFAULT OFF ) - endif() -endif() -option( SITK_INT64_PIXELIDS "Instantiate 64-bit integer pixels, including unsigned, vector and label maps." ${SITK_INT64_PIXELIDS_DEFAULT} ) -# Setting this option will shorten compile times by reducing the -# amount of pixel types and generated code. -# NB: this option should _NOT_ be used for releases! -option ( SITK_EXPRESS_INSTANTIATEDPIXELS "Instantiate very few pixel types ( for use for development only )" OFF ) -mark_as_advanced ( SITK_EXPRESS_INSTANTIATEDPIXELS ) - -option( SRTK_4D_IMAGES "Add Image and I/O support for four spatial dimensions." OFF ) -mark_as_advanced( SRTK_4D_IMAGES ) - -#----------------------------------------------------------------------------- -# SimpleRTK build configuration options. -option(BUILD_SHARED_LIBS "Build SimpleRTK ITK with shared libraries. This does not effect wrapped languages." OFF) -set(SRTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) - -set(JAR_FILE "simplertk-${SimpleRTK_VERSION}.jar") -set(JAVADOC_FILE "simplertk-javadoc-${SimpleRTK_VERSION}.jar") -set(JAVA_SOURCE_FILE "simplertk-source-${SimpleRTK_VERSION}.jar") - - -# Create cached list of all template components -file( GLOB template_components - ${SimpleRTK_SOURCE_DIR}/TemplateComponents/*.h.in - ${SimpleRTK_SOURCE_DIR}/TemplateComponents/*.cxx.in - ) -set ( template_components ${template_components} CACHE INTERNAL "" ) - - -#------------------------------------------------------------------------------ -# Variables for use in install rules: - -if(NOT SimpleRTK_INSTALL_RUNTIME_DIR) - set(SimpleRTK_INSTALL_RUNTIME_DIR "bin") -endif() -if(NOT SimpleRTK_INSTALL_LIBRARY_DIR) - set(SimpleRTK_INSTALL_LIBRARY_DIR "lib") -endif() -if(NOT SimpleRTK_INSTALL_ARCHIVE_DIR) - set(SimpleRTK_INSTALL_ARCHIVE_DIR "lib") -endif() -if(NOT SimpleRTK_INSTALL_INCLUDE_DIR) - set(SimpleRTK_INSTALL_INCLUDE_DIR "include/SimpleRTK-${SimpleRTK_VERSION_MAJOR}.${SimpleRTK_VERSION_MINOR}") -endif() -if(NOT SimpleRTK_INSTALL_DOC_DIR) - set(SimpleRTK_INSTALL_DOC_DIR share/doc/SimpleRTK-${SimpleRTK_VERSION_MAJOR}.${SimpleRTK_VERSION_MINOR}) -endif() -if(NOT SimpleRTK_INSTALL_PACKAGE_DIR) - set(SimpleRTK_INSTALL_PACKAGE_DIR "lib/cmake/SimpleRTK-${SimpleRTK_VERSION_MAJOR}.${SimpleRTK_VERSION_MINOR}") -endif() - -function(srtk_install_exported_target tgt) - # Remove the build tree's SimpleRTKTargets file if this is the first call: - get_property(first_time GLOBAL PROPERTY SimpleRTK_FIRST_EXPORTED_TARGET) - if(NOT first_time) - file(REMOVE ${CMAKE_BINARY_DIR}/SimpleRTKTargets.cmake) - set_property(GLOBAL PROPERTY SimpleRTK_FIRST_EXPORTED_TARGET 1) - endif() - - set_property(TARGET ${tgt} PROPERTY VERSION 1) - set_property(TARGET ${tgt} PROPERTY SOVERSION 1) - set_property(TARGET ${tgt} PROPERTY - OUTPUT_NAME ${tgt}-${SimpleRTK_VERSION_MAJOR}.${SimpleRTK_VERSION_MINOR}) - - export(TARGETS ${tgt} - APPEND FILE "${CMAKE_BINARY_DIR}/SimpleRTKTargets.cmake" - ) - - install(TARGETS ${tgt} - EXPORT SimpleRTKTargets - RUNTIME DESTINATION ${SimpleRTK_INSTALL_RUNTIME_DIR} - LIBRARY DESTINATION ${SimpleRTK_INSTALL_LIBRARY_DIR} - ARCHIVE DESTINATION ${SimpleRTK_INSTALL_ARCHIVE_DIR} - ) -endfunction() - -#------------------------------------------------------------------------------ -# Strip Option - -# Add option to strip wrapping libraries. -# Since the wrapping libraries don't get installed by the normal cmake -# installation process, this option enables stripping of the libraries -# as part of the build process. It should be used on the laguage -# targets and the the SimpleRTK iterface, as those can be installed -# into the system. -option(SimpleRTK_BUILD_STRIP "Strip executables and libraries after building." OFF) -mark_as_advanced(SimpleRTK_BUILD_STRIP) -set(CMAKE_STRIP_FLAGS "-x" CACHE STRING "Flags used by strip in the post_build.") -mark_as_advanced(CMAKE_STRIP_FLAGS) -separate_arguments(CMAKE_STRIP_FLAGS) - -function(srtk_strip_target tgt) - if(NOT SimpleRTK_BUILD_STRIP) - return() - endif() - get_property(type TARGET ${tgt} PROPERTY TYPE) - if(NOT type STREQUAL STATIC_LIBRARY) - add_custom_command( - TARGET ${tgt} - POST_BUILD - COMMAND ${CMAKE_STRIP} ${CMAKE_STRIP_FLAGS} "$" - ) - endif() - -endfunction() - -#------------------------------------------------------------------------------ -# These are some system specific compiler options needed to build SimpleRTK - -if(MSVC) - # /bigobj is required for windows builds because of the size of - # some object files (CastImage for instance) - # Also supress the pesky warning about std::vector not being marked - # for export in the dll - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251" ) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) - - # Avoid some warnings - add_definitions ( -D_SCL_SECURE_NO_WARNINGS ) - - - # force debug linking not to be incremental - foreach( _varName - CMAKE_EXE_LINKER_FLAGS_DEBUG - CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_MODULE_LINKER_FLAGS_DEBUG - CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_SHARED_LINKER_FLAGS_DEBUG - CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ) - string(REGEX REPLACE "INCREMENTAL(:[a-zA-Z]+)?" "INCREMENTAL:NO" ${_varName} ${${_varName}}) - endforeach() - -endif() - - -include(CheckCXXCompilerFlag) - -# The fPIC flags is used to create position independent code. It is -# required on some systems to produce shared libraries. On Apple -# systems the flag has no effect as it is the default. On other -# platforms, this flag may enable libraries to be better shared -# between processes. Therefore, if the compiler supports it, we will -# use it. -check_cxx_compiler_flag( "-fPIC" CXX_HAS_fPIC ) -if( CXX_HAS_fPIC ) - if(NOT "${CMAKE_CXX_FLAGS}" MATCHES "-fPIC") - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" ) - endif() -endif() - - - -#----------------------------------------------------------- -# Place all checks and try compile variable for srtkConfigure.h here - -include(srtkCheckCXX11) - - -include(CheckIncludeFileCXX) - - -# check for stdint -# This generates a configuration error if the compiler is not supported -check_include_file_cxx( stdint.h SITK_HAS_STDINT_H ) - -if(NOT STDINT_HAVE_STDINT_H) - if( WIN32 ) - if(MSVC) - list(APPEND SimpleRTK_INCLUDE_DIRS - "${SimpleRTK_SOURCE_DIR}/Utilities/C99") - add_subdirectory("${SimpleRTK_SOURCE_DIR}/Utilities/C99") - endif() - endif() -endif() - -include_directories( ${SimpleRTK_INCLUDE_DIRS} ) - - -#------------------------------------------------------------------------------ -# assemble a list of important documentation from Simple ITK and ITK - -set ( SimpleRTK_DOC_FILES - # "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT" - ) - -# add important files from ITK - -# if using from build tree then ITK_USE_FILE will be -# ITK_SOURCE_DIR/CMake/UseITK.cmake. The needed docs should be in the -# root of the source tree -get_filename_component( _itk_root "${ITK_USE_FILE}" PATH ) -get_filename_component( _itk_root "${_itk_root}" PATH ) -set( _itk_source_path "${_itk_root}" ) - -get_filename_component( _itk_root "${_itk_root}" PATH ) -get_filename_component( _itk_root "${_itk_root}" PATH ) -set( _itk_doc_path "${_itk_root}/share/doc/ITK-${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" ) - -if( EXISTS "${_itk_source_path}/NOTICE" ) - set( ITK_DOC_FILES - # "${_itk_source_path}/LICENSE" SimpleRTK has same license file - "${_itk_source_path}/NOTICE" - "${_itk_source_path}/README.txt" - ) -elseif( EXISTS "${_itk_doc_path}/NOTICE" ) - set( ITK_DOC_FILES - # "${_itk_doc_path}/LICENSE" SimpleRTK has same license file - "${_itk_doc_path}/NOTICE" - "${_itk_doc_path}/README.txt" - ) -else() - message( "doc_path: ${_itk_doc_path}" ) - message( WARNING "Unable to file ITK's NOTICE File!\n This file will not be included in SimpleRTK packaging!" ) -endif() - - -foreach(_f IN LISTS ITK_DOC_FILES) - get_filename_component( _name "${_f}" NAME ) - set( _o "${CMAKE_CURRENT_BINARY_DIR}/ITK-${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}-${_name}" ) - configure_file( "${_f}" "${_o}" ) - list( APPEND SimpleRTK_DOC_FILES "${_o}" ) -endforeach() - - -#------------------------------------------------------------------------------ -# Set up Documentation -include(${SimpleRTK_SOURCE_DIR}/Utilities/Doxygen/Doxygen.cmake) - -#------------------------------------------------------------------------------ -# Set up wrapping. -# -# Use CMake file which present options for wrapped languages, and finds languages as needed -# -include(srtkLanguageOptions) - -#------------------------------------------------------------------------------ -# Ensure that development strips have been setup -include(srtkCheckSourceTree) - -#------------------------------------------------------------------------------ -# set things up for testing, this configuration needs to occour before -# we enter the sub-directories -include(CTest) - - -#------------------------------------------------------------------------------ -# Go to subdirectories -add_subdirectory ( Utilities ) -add_subdirectory ( Code ) -add_subdirectory ( Wrapping ) - -# optional examples directory -option(BUILD_EXAMPLES "Build the Examples directory." ON) - -if(BUILD_EXAMPLES) - add_subdirectory ( Examples ) -endif() - -#------------------------------------------------------------------------------ -# set things up for testing, if enabled - -if ( BUILD_TESTING ) - - # Fetch testing data. - # 2.8.11 required for ExternalData.cmake. - if( CMAKE_VERSION VERSION_LESS 2.8.11 ) - message( FATAL_ERROR "BUILD_TESTING ON requires CMake 2.8.11 or newer." ) - endif() - - # include( SimpleRTKExternalData ) - # file( GLOB_RECURSE content_links - # RELATIVE "${SimpleRTK_SOURCE_DIR}" "Testing/Data/*.md5" ) - # foreach(link ${content_links}) - # string( REGEX REPLACE "\\.md5$" "" link ${link} ) - # ExternalData_Expand_Arguments( SimpleRTKData - # link_location - # DATA{${link}} - # ) - # endforeach() - # ExternalData_Add_Target( SimpleRTKData ) - - enable_testing() - add_subdirectory ( Testing ) - option ( RUN_LONG_TESTS "Run long tests. Some tests have been identified as long running, should these be run?" OFF ) - mark_as_advanced(RUN_LONG_TESTS) - set(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard") - configure_file(CMake/CTestCustom.cmake.in CTestCustom.cmake) -endif() - -#------------------------------------------------------------------------------ -# Options for documentation -option ( BUILD_DOCUMENTS "Build the Documentation subdirectory" OFF ) - -if ( BUILD_DOCUMENTS ) - add_subdirectory ( Documentation ) -endif() - - -#------------------------------------------------------------------------------ -# Configure SimpleRTKConfig.cmake for the build tree. -set(SimpleRTKConfig_TREE "build") -set(SimpleRTKConfig_CODE "") -set(SimpleRTKConfig_INCLUDE_DIRS ${SimpleRTK_INCLUDE_DIRS}) - -configure_file(SimpleRTKConfig.cmake.in - SimpleRTKConfig.cmake @ONLY IMMEDIATE) - -#------------------------------------------------------------------------------ -# Configure SimpleRTKConfig.cmake for the install tree. -set(SimpleRTKConfig_TREE "install") - -set(SimpleRTKConfig_CODE "set(SimpleRTK_INSTALL_PREFIX \"\${_SimpleRTKConfig_DIR}\")") -# Construct the proper number of get_filename_component(... PATH) -# calls to compute the installation prefix. -string(REGEX REPLACE "/" ";" _count "${SimpleRTK_INSTALL_PACKAGE_DIR}") -foreach(p ${_count}) - set(SimpleRTKConfig_CODE "${SimpleRTKConfig_CODE} -get_filename_component(SimpleRTK_INSTALL_PREFIX \"\${SimpleRTK_INSTALL_PREFIX}\" PATH)") -endforeach() -set(SimpleRTKConfig_CODE "${SimpleRTKConfig_CODE}\n") - -set(SimpleRTKConfig_INCLUDE_DIRS - "\${SimpleRTK_INSTALL_PREFIX}/${SimpleRTK_INSTALL_INCLUDE_DIR}") - -configure_file(SimpleRTKConfig.cmake.in - CMakeFiles/SimpleRTKConfig.cmake @ONLY IMMEDIATE) - -#------------------------------------------------------------------------------ -# Help other projects use SimpleRTK -configure_file(UseSimpleRTK.cmake.in - UseSimpleRTK.cmake COPYONLY IMMEDIATE) - -configure_file(SimpleRTKConfigVersion.cmake.in - SimpleRTKConfigVersion.cmake @ONLY IMMEDIATE) - - -#------------------------------------------------------------------------------ -# INSTALLATION - -install(FILES ${SimpleRTK_BINARY_DIR}/CMakeFiles/SimpleRTKConfig.cmake - ${SimpleRTK_BINARY_DIR}/SimpleRTKConfigVersion.cmake - ${SimpleRTK_BINARY_DIR}/UseSimpleRTK.cmake - DESTINATION ${SimpleRTK_INSTALL_PACKAGE_DIR} - COMPONENT Development) - -install(EXPORT SimpleRTKTargets - DESTINATION ${SimpleRTK_INSTALL_PACKAGE_DIR} - COMPONENT Development) - -file( GLOB __files - ${CMAKE_SOURCE_DIR}/Code/BasicFilters/include/*.h - ${CMAKE_SOURCE_DIR}/Code/BasicFilters/include/*.hxx - ${CMAKE_SOURCE_DIR}/Code/Common/include/*.h - ${CMAKE_SOURCE_DIR}/Code/Common/include/*.hxx - ${CMAKE_SOURCE_DIR}/Code/IO/include/*.h - ${CMAKE_SOURCE_DIR}/Code/IO/include/*.hxx - ${CMAKE_SOURCE_DIR}/Code/Registration/include/*.h - ${CMAKE_SOURCE_DIR}/Code/Registration/include/*.hxx - ) - -set(__files ${__files} - ${SimpleRTKBasicFiltersGeneratedHeader} - ) - -install(FILES ${__files} - DESTINATION ${SimpleRTK_INSTALL_INCLUDE_DIR} - COMPONENT Development) - -install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/Code/Common/include/Ancillary - ${CMAKE_SOURCE_DIR}/Code/Common/include/nsstd - DESTINATION - ${SimpleRTK_INSTALL_INCLUDE_DIR}/ - FILES_MATCHING PATTERN "*.h" -) - -install(FILES ${SimpleRTK_DOC_FILES} DESTINATION "${SimpleRTK_INSTALL_DOC_DIR}" COMPONENT Runtime) - - -#------------------------------------------------------------------------------ -# CPack - -set(CPACK_SOURCE_IGNORE_FILES "${ITK_MODULES_DISABLED_CPACK};/\\\\.git") -set(CPACK_PACKAGE_VERSION_MAJOR "${SimpleRTK_Major}") -set(CPACK_PACKAGE_VERSION_MINOR "${SimpleRTK_Minor}") -set(CPACK_PACKAGE_VERSION_PATCH "${SimpleRTK_Patch}") - - -include( CPack ) diff --git a/utilities/SimpleRTK/Code/BasicFilters/CMakeLists.txt b/utilities/SimpleRTK/Code/BasicFilters/CMakeLists.txt deleted file mode 100644 index a0575532e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ - -# Set up code generation -include(srtkGenerateFilterSource) -generate_filter_source() - -add_subdirectory( src ) - diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.h deleted file mode 100644 index 0300bb70c..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.h +++ /dev/null @@ -1,123 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __itkHashImageFilter_h -#define __itkHashImageFilter_h - - -#include "rtkConfiguration.h" - -#include "itkSimpleDataObjectDecorator.h" -#include "itkImageLinearConstIteratorWithIndex.h" -#include "itkCastImageFilter.h" -#include "itkByteSwapper.h" - - -#include "Ancillary/hl_md5.h" -#include "Ancillary/hl_sha1.h" - -namespace itk { - -/** \class CastImageFilter - * \brief Generates a hash string from an image. - * - * \note This class utlizes low level buffer pointer access, to work - * with itk::Image and itk::VectorImage. It is modeled after the access - * an ImageFileWriter provides to an ImageIO. - * - * \todo complete documentation - * \todo Update in-place on to default after fixing bug in InPlaceImageFilter - */ -template < class TImageType > -class HashImageFilter: - public CastImageFilter< TImageType, TImageType > -{ -public: - /** Standard Self typedef */ - typedef HashImageFilter Self; - typedef CastImageFilter< TImageType, TImageType > Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; - - typedef typename TImageType::RegionType RegionType; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(HashImageFilter, CastImageFilter); - - /** Smart Pointer type to a DataObject. */ - typedef typename DataObject::Pointer DataObjectPointer; - - /** Type of DataObjects used for scalar outputs */ - typedef SimpleDataObjectDecorator< std::string > HashObjectType; - - /** Get the computed Hash values */ - std::string GetHash() const - { return this->GetHashOutput()->Get(); } - HashObjectType* GetHashOutput() - { return static_cast< HashObjectType *>( this->ProcessObject::GetOutput(1) ); } - const HashObjectType* GetHashOutput() const - { return static_cast( this->ProcessObject::GetOutput(1) ); } - - enum HashFunction { SHA1, MD5 }; - - /** Set/Get hashing function as enumerated type */ - itkSetMacro( HashFunction, HashFunction ); - itkGetMacro( HashFunction, HashFunction ); - -/** Make a DataObject of the correct type to be used as the specified - * output. */ - typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; - using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; - -protected: - - HashImageFilter(); - - // virtual ~HashImageFilter(); // implementation not needed - - virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - - // See superclass for doxygen documentation - // - // This method is to do work after the superclass potential threaded - // copy. - void AfterThreadedGenerateData() ITK_OVERRIDE; - - // See superclass for doxygen documentation - // - // Override since the filter produces all of its output - void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE; - -private: - HashImageFilter(const Self &); //purposely not implemented - void operator=(const Self &); //purposely not implemented - - - HashFunction m_HashFunction; -}; - - -} // end namespace itk - - -#include "itkHashImageFilter.hxx" - -#endif // __itkHashImageFilter_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.hxx b/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.hxx deleted file mode 100644 index f7d2b32dc..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/itkHashImageFilter.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __itkHashImageFilter_hxx -#define __itkHashImageFilter_hxx - -#include "itkHashImageFilter.h" - -namespace itk { - -// -// Constructor -// -template -HashImageFilter::HashImageFilter() -{ - this->m_HashFunction = MD5; - - // create data object - this->ProcessObject::SetNthOutput( 1, this->MakeOutput(1).GetPointer() ); - - // NOTE: Turning this on causes a crash due to a bug is InPlaceImageFilter - this->InPlaceOff(); -} - -// -// MakeOutput -// -template -typename HashImageFilter::DataObjectPointer -HashImageFilter::MakeOutput(DataObjectPointerArraySizeType idx) -{ - if ( idx == 1 ) - { - return static_cast< DataObject * >( HashObjectType::New().GetPointer() ); - } - return Superclass::MakeOutput(idx); -} - -// -// AfterThreadedGenerateData -// -template -void -HashImageFilter::AfterThreadedGenerateData() -{ - // NOTE: We have choose our super class to be the - // CastImageFilter. The filter is derived from the - // InPlaceFilter. The CastImageFilter will copy its input, in the - // best fashion based on the InPlace setting. We want the - // behavior. This methods is called after the caster has done it's - // work. - - Superclass::AfterThreadedGenerateData(); - - typedef TImageType ImageType; - typedef typename ImageType::PixelType PixelType; - typedef typename NumericTraits::ValueType ValueType; - typedef itk::ByteSwapper Swapper; - - ::MD5 md5; - ::HL_MD5_CTX md5Context; - md5.MD5Init ( &md5Context ); - ::SHA1 sha1; - ::HL_SHA1_CTX sha1Context; - sha1.SHA1Reset ( &sha1Context ); - - typename ImageType::ConstPointer input = this->GetInput(); - - - // make a good guess about the number of components in each pixel - size_t numberOfComponent = sizeof(PixelType) / sizeof(ValueType ); - - if ( strcmp(input->GetNameOfClass(), "VectorImage") == 0 ) - { - // spacial case for VectorImages - numberOfComponent = ImageType::AccessorFunctorType::GetVectorLength(input); - } - else if ( sizeof(PixelType) % sizeof(ValueType) != 0 ) - { - itkExceptionMacro("Unsupported data type for hashing!"); - } - - // we feel bad about accessing the data this way - ValueType *buffer = static_cast( (void *)input->GetBufferPointer() ); - - typename ImageType::RegionType largestRegion = input->GetBufferedRegion(); - const size_t numberOfValues = largestRegion.GetNumberOfPixels()*numberOfComponent; - - - // Possibly byte swap so we always calculate on little endian data - Swapper::SwapRangeFromSystemToLittleEndian ( buffer, numberOfValues ); - - // Update the hash - switch ( this->m_HashFunction ) - { - case SHA1: - sha1.SHA1Input ( &sha1Context, (unsigned char*)buffer, numberOfValues*sizeof(ValueType) ); - break; - case MD5: - md5.MD5Update ( &md5Context, (unsigned char*)buffer, numberOfValues*sizeof(ValueType) ); - break; - } - - // Calculate and return the hash value - std::string hash; - int HashSize = SHA1HashSize; - unsigned char Digest[1024]; - switch ( this->m_HashFunction ) - { - case SHA1: - { - HashSize = SHA1HashSize; - sha1.SHA1Result ( &sha1Context, Digest ); - break; - } - case MD5: - { - HashSize = 16; - md5.MD5Final ( Digest, &md5Context ); - break; - } - } - - // Should we really covert the binary representation to a hex ASCII here - // - // Print to a string - std::ostringstream os; - for(int i=0; i(Digest[i]); - } - - this->GetHashOutput()->Set( os.str() ); -} - - -// -// EnlargeOutputRequestedRegion -// -template -void -HashImageFilter::EnlargeOutputRequestedRegion(DataObject *data) -{ - Superclass::EnlargeOutputRequestedRegion(data); - - // set the output region to the largest and let the pipeline - // propagate the requested region to the input - data->SetRequestedRegionToLargestPossibleRegion(); -} - - -// -// PrintSelf -// -template -void -HashImageFilter::PrintSelf(std::ostream & os, Indent indent) const -{ - Superclass::PrintSelf(os, indent); - - os << indent << "HashFunction: " << m_HashFunction << std::endl; -} - - -} // end namespace itk - -#endif // __itkHashImageFilter_hxx diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.h deleted file mode 100644 index 76f4f62af..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.h +++ /dev/null @@ -1,166 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __itkSliceImageFilter_h -#define __itkSliceImageFilter_h - -#include "itkImageToImageFilter.h" - -namespace itk -{ -/** \class SliceImageFilter - * \brief Slices an image based on a starting index and a stopping - * index, and a step size. - * - * This class is designed to facilitate the implementation of extended - * sliced based indexing into images. - * - * The input and output image must be of the same dimension. - * - * The input parameters are a starting and stopping index as well as a - * stepping size. The staring index indicates the first pixels to - * used and for each dimension the index is incremented by the step - * until the index is equal to or "beyond" the stopping index. If the - * step is negative then the image will be revered in the dimension, - * and the stopping index is expected to be less then the starting - * index. If the stopping index is already beyond the starting then a - * image of zero size will be returned. - * - * The output image's starting index is always zero. The origin is the - * physical location of the starting index. The output directions - * cosine matrix is that of the input but with sign changes matching - * that of the step's sign. - * - * \note In certain combination such as with start=1, and step>1 while - * the physical location of the center of the pixel remains the same, - * the extent (edge to edge space) of the pixel will beyond the extent - * of the original image. - * - * \ingroup GeometricTransform Streamed - */ -template< class TInputImage, class TOutputImage > -class ITK_EXPORT SliceImageFilter: - public ImageToImageFilter< TInputImage, TOutputImage > -{ -public: - /** Standard class typedefs. */ - typedef SliceImageFilter Self; - typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(SliceImageFilter, ImageToImageFilter); - - /** Typedef to images */ - typedef TOutputImage OutputImageType; - typedef TInputImage InputImageType; - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef typename InputImageType::Pointer InputImagePointer; - typedef typename InputImageType::ConstPointer InputImageConstPointer; - - typedef typename TOutputImage::IndexType OutputIndexType; - typedef typename TInputImage::IndexType InputIndexType; - typedef typename TOutputImage::OffsetType OutputOffsetType; - - /** Typedef to describe the output image region type. */ - typedef typename TOutputImage::RegionType OutputImageRegionType; - - /** ImageDimension enumeration. */ - itkStaticConstMacro(ImageDimension, unsigned int, - TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, - TOutputImage::ImageDimension); - - - typedef typename InputImageType::IndexType IndexType; - typedef typename InputIndexType::IndexValueType IndexValueType; - typedef FixedArray< int, ImageDimension > ArrayType; - - /** Set/Get the first index extracted from the input image */ - itkSetMacro(Start, IndexType); - itkGetConstReferenceMacro(Start, IndexType); - void SetStart(IndexValueType start); - - /** Set/Get the excluded end of the range */ - itkSetMacro(Stop, IndexType); - itkGetConstReferenceMacro(Stop, IndexType); - void SetStop(IndexValueType stop); - - /** Set/Get the stride of indexes extracted - * - * An exception will be generated if 0. - */ - itkSetMacro(Step, ArrayType); - itkGetConstReferenceMacro(Step, ArrayType); - void SetStep( int step); - - /** SliceImageFilter produces an image which is a different - * resolution and with a different pixel spacing than its input - * image. - * \sa ProcessObject::GenerateOutputInformaton() */ - virtual void GenerateOutputInformation() ITK_OVERRIDE; - - virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; - -#ifdef ITK_USE_CONCEPT_CHECKING - /** Begin concept checking */ - itkConceptMacro( InputConvertibleToOutputCheck, - ( Concept::Convertible< typename TInputImage::PixelType, typename TOutputImage::PixelType > ) ); - itkConceptMacro( SameDimensionCheck, - ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) ); - /** End concept checking */ -#endif - -protected: - SliceImageFilter(); - // ~SliceImageFilter() {} default ok - void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - - /** SliceImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() routine - * which is called for each processing thread. The output image data is - * allocated automatically by the superclass prior to calling - * ThreadedGenerateData(). ThreadedGenerateData can only write to the - * portion of the output image specified by the parameter - * "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId) ITK_OVERRIDE; - - void VerifyInputInformation() ITK_OVERRIDE; - -private: - SliceImageFilter(const Self &); //purposely not implemented - void operator=(const Self &); //purposely not implemented - - IndexType m_Start; - IndexType m_Stop; - ArrayType m_Step; -}; -} // end namespace itk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "itkSliceImageFilter.hxx" -#endif - -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.hxx b/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.hxx deleted file mode 100644 index 19739247a..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/itkSliceImageFilter.hxx +++ /dev/null @@ -1,363 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -/*========================================================================= - * - * Portions of this file are subject to the VTK Toolkit Version 3 copyright. - * - * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - * - * For complete copyright, license and disclaimer of warranty information - * please refer to the NOTICE file at the top of the ITK source tree. - * - *=========================================================================*/ -#ifndef __itkSliceImageFilter_hxx -#define __itkSliceImageFilter_hxx - -#include "itkSliceImageFilter.h" -#include "itkImageRegionIteratorWithIndex.h" -#include "itkContinuousIndex.h" -#include "itkObjectFactory.h" -#include "itkProgressReporter.h" - -namespace itk -{ -/** - * - */ -template< class TInputImage, class TOutputImage > -SliceImageFilter< TInputImage, TOutputImage > -::SliceImageFilter() -{ - m_Start.Fill(itk::NumericTraits::min()); - m_Stop.Fill(itk::NumericTraits::max()); - m_Step.Fill(1); -} - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::PrintSelf(std::ostream & os, Indent indent) const -{ - Superclass::PrintSelf(os, indent); - - os << indent << "Start: " << m_Start << std::endl; - os << indent << "Stop: " << m_Stop << std::endl; - os << indent << "Step: " << m_Step << std::endl; - -} - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::SetStart( typename TInputImage::IndexType::IndexValueType start) -{ - unsigned int j; - - for ( j = 0; j < ImageDimension; j++ ) - { - if ( start != m_Start[j] ) - { - this->Modified(); - m_Start.Fill( start ); - return; - } - } -} - - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::SetStop(typename TInputImage::IndexType::IndexValueType stop) -{ - unsigned int j; - - for ( j = 0; j < ImageDimension; j++ ) - { - if ( stop != m_Stop[j] ) - { - this->Modified(); - m_Stop.Fill( stop ); - return; - } - } -} - - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::SetStep(int step) -{ - unsigned int j; - - for ( j = 0; j < ImageDimension; j++ ) - { - if ( step != m_Step[j] ) - { - this->Modified(); - m_Step.Fill( step ); - return; - } - } - -} - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId) -{ - // Get the input and output pointers - InputImageConstPointer inputPtr = this->GetInput(); - OutputImagePointer outputPtr = this->GetOutput(); - - // Support progress methods/callbacks - ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); - - const typename TInputImage::SizeType &inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - const typename TInputImage::IndexType &inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); - - // clamp start - InputIndexType start; - for ( unsigned int i = 0; i < TOutputImage::ImageDimension; i++ ) - { - start[i] = std::max( m_Start[i], inputIndex[i] ); - start[i] = std::min( start[i], static_cast(inputIndex[i] + inputSize[i]-1) ); - } - - // Define/declare an iterator that will walk the output region for this - // thread. - typedef ImageRegionIteratorWithIndex< TOutputImage > OutputIterator; - OutputIterator outIt(outputPtr, outputRegionForThread); - - OutputIndexType destIndex; - InputIndexType srcIndex; - - while ( !outIt.IsAtEnd() ) - { - // Determine the index and physical location of the output pixel - destIndex = outIt.GetIndex(); - - - for( unsigned int i = 0; i < TOutputImage::ImageDimension; ++i ) - { - srcIndex[i] = destIndex[i]*m_Step[i] + start[i]; - } - - // Copy the input pixel to the output - outIt.Set( inputPtr->GetPixel(srcIndex) ); - ++outIt; - - progress.CompletedPixel(); - } -} - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::GenerateInputRequestedRegion() -{ - - - // Get pointers to the input and output - InputImagePointer inputPtr = const_cast< TInputImage * >( this->GetInput() ); - OutputImagePointer outputPtr = this->GetOutput(); - - const typename TOutputImage::SizeType & outputRequestedRegionSize = outputPtr->GetRequestedRegion().GetSize(); - const typename TOutputImage::IndexType & outputRequestedRegionStartIndex = outputPtr->GetRequestedRegion().GetIndex(); - - const typename TInputImage::SizeType &inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - const typename TInputImage::IndexType &inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); - - // clamp start - InputIndexType start; - for ( unsigned int i = 0; i < TOutputImage::ImageDimension; i++ ) - { - // clamp to valid index range and don't include one past end, so - // that a zero size RR would be valid - start[i] = std::max( m_Start[i], inputIndex[i] ); - start[i] = std::min( start[i], static_cast(inputIndex[i] + inputSize[i] -1) ); - } - - - typename TInputImage::SizeType inputRequestedRegionSize; - inputRequestedRegionSize.Fill(0); - for ( unsigned int i=0; i < TInputImage::ImageDimension; ++i ) - { - if ( outputRequestedRegionSize[i] > 0 ) - { - inputRequestedRegionSize[i] = (outputRequestedRegionSize[i] - 1 ) * vnl_math_abs(m_Step[i]) + 1; - } - } - - InputIndexType inputRequestedRegionIndex; - for ( unsigned int i=0; i < TOutputImage::ImageDimension; ++i ) - { - inputRequestedRegionIndex[i] = outputRequestedRegionStartIndex[i] * m_Step[i] + start[i]; - - // if reversing, go to the lower ending index - 1 - if (m_Step[i] < 0) - { - inputRequestedRegionIndex[i] -= inputRequestedRegionSize[i] - 1; - } - } - - - typename TInputImage::RegionType inputRequestedRegion; - inputRequestedRegion.SetIndex(inputRequestedRegionIndex); - inputRequestedRegion.SetSize(inputRequestedRegionSize); - - // test if input RR is completely inside input largest region - if ( inputRequestedRegion.GetNumberOfPixels() > 0 && - !inputPtr->GetLargestPossibleRegion().IsInside( inputRequestedRegion ) ) - { - itkExceptionMacro( "Logic Error: incorrect computation of RequestedRegion" ); - } - - inputPtr->SetRequestedRegion(inputRequestedRegion); - return; - -} - -/** - * - */ -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::GenerateOutputInformation() -{ - // Call the superclass' implementation of this method - Superclass::GenerateOutputInformation(); - - // Get pointers to the input and output - InputImageConstPointer inputPtr = this->GetInput(); - OutputImagePointer outputPtr = this->GetOutput(); - - // Compute the output spacing, the output image size, and the - // output image start index - const typename TInputImage::SpacingType &inputSpacing = inputPtr->GetSpacing(); - const typename TInputImage::SizeType &inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - const typename TInputImage::IndexType &inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); - typename TInputImage::IndexType inputStartIndex; - - typename TOutputImage::SpacingType outputSpacing; - typename TOutputImage::SizeType outputSize; - - typename TOutputImage::IndexType outputStartIndex; - outputStartIndex.Fill(0); - - for ( unsigned int i = 0; i < TOutputImage::ImageDimension; i++ ) - { - outputSpacing[i] = inputSpacing[i] * vnl_math_abs(m_Step[i]); - - // clamp start - // Based on the sign of the step include 1 after the end. - IndexValueType start = std::max( m_Start[i], inputIndex[i] - int(m_Step[i]<0)); - start = std::min( start, static_cast(inputIndex[i] + inputSize[i]) - int(m_Step[i]<0) ); - - // clamp stop - // Based on the sign of the step include 1 after the end. - IndexValueType stop = std::max( m_Stop[i], inputIndex[i] - int(m_Step[i]<0) ); - stop = std::min( stop, static_cast(inputIndex[i] + inputSize[i]) - int(m_Step[i]<0)); - - // If both the numerator and the denominator have the same sign, - // then the range is a valid and non-zero sized. Truncation is the - // correct rounding for these positive values. - if ( (m_Step[i] > 0 && stop > start) || - ( m_Step[i] < 0 && stop < start ) ) - { - outputSize[i] = (stop-start)/m_Step[i]; - } - else - { - outputSize[i] = 0u; - } - - // If the step is negative, then the start is still the index of - // the output origin - inputStartIndex[i] = start; - - } - - const typename TInputImage::DirectionType & inputDirection = inputPtr->GetDirection(); - typename TInputImage::DirectionType flipMatrix; - - // Need a matrix to model the reversing of directions, this should - // maintain the physical location of the pixels - for ( unsigned int j = 0; j < ImageDimension; j++ ) - { - flipMatrix[j][j] = (m_Step[j]>0) ? 1.0 : -1.0; - } - - outputPtr->SetDirection(inputDirection * flipMatrix); - outputPtr->SetSpacing(outputSpacing); - - typename TOutputImage::PointType outputOrigin; - inputPtr->TransformIndexToPhysicalPoint(inputStartIndex, outputOrigin); - outputPtr->SetOrigin(outputOrigin); - - // Set region - typename TOutputImage::RegionType outputLargestPossibleRegion; - outputLargestPossibleRegion.SetSize(outputSize); - outputLargestPossibleRegion.SetIndex(outputStartIndex); - - outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); -} - -template< class TInputImage, class TOutputImage > -void -SliceImageFilter< TInputImage, TOutputImage > -::VerifyInputInformation() -{ - - Superclass::VerifyInputInformation(); - - for ( unsigned int i = 0; i < ImageDimension; ++i ) - { - if ( m_Step[i] == 0 ) - { - itkExceptionMacro( "Step size is zero " << m_Step << "!" ); - } - } - -} - -} // end namespace itk - -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/itkUnaryMinusImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/itkUnaryMinusImageFilter.h deleted file mode 100644 index b0fc4db63..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/itkUnaryMinusImageFilter.h +++ /dev/null @@ -1,52 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __itkUnaryMinusFunctor_h -#define __itkUnaryMinusFunctor_h - -namespace itk -{ -namespace Functor -{ -/** - * \class UnaryMinus - * \brief - * \ingroup ITKImageIntensity - */ -template< class TInput1, class TOutput = TInput1 > -class UnaryMinus -{ -public: - UnaryMinus() {} - ~UnaryMinus() {} - bool operator!=(const UnaryMinus &) const - { - return false; - } - - bool operator==(const UnaryMinus & other) const - { - return !( *this != other ); - } - - inline TOutput operator()(const TInput1 & A ) const - { return (TOutput)( -A ); } -}; -} -} - -#endif // __itkUnaryMinusFunctor_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkAdditionalProcedures.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkAdditionalProcedures.h deleted file mode 100644 index a15a34521..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkAdditionalProcedures.h +++ /dev/null @@ -1,102 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkAdditionalProcedures_h -#define __srtkAdditionalProcedures_h - -#include "srtkBasicFilters.h" -#include "srtkImage.h" -#include "srtkTransform.h" -#include "srtkInterpolator.h" -#include "srtkPatchBasedDenoisingImageFilter.h" - -namespace rtk { -namespace simple { - -/** - * \brief rtk::simple::ResampleImageFilter Procedural Interface - * - * These functions call the execute method of ResampleImageFilter - * in order to support a procedual API. - * - * There three very by how the output image's domain parameters are - * specified. The first method used the input image, the second uses - * a reference image, while the last procedure has them manually - * specified. - * - * \sa rtk::simple::ResampleImageFilter for the object oriented interface -* @{ - */ -SRTKBasicFilters_EXPORT Image Resample ( const Image& image1, - Transform transform = rtk::simple::Transform(), - InterpolatorEnum interpolator = rtk::simple::srtkLinear, - double defaultPixelValue = 0.0, - PixelIDValueEnum outputPixelType = srtkUnknown ); - -SRTKBasicFilters_EXPORT Image Resample ( const Image& image1, - const Image& referenceImage, - Transform transform = rtk::simple::Transform(), - InterpolatorEnum interpolator = rtk::simple::srtkLinear, - double defaultPixelValue = 0.0, - PixelIDValueEnum outputPixelType = srtkUnknown ); - -SRTKBasicFilters_EXPORT Image Resample ( const Image& image1, - std::vector size, - Transform transform = rtk::simple::Transform(), - InterpolatorEnum interpolator = rtk::simple::srtkLinear, - std::vector outputOrigin = std::vector(3, 0.0), - std::vector outputSpacing = std::vector(3, 1.0), - std::vector outputDirection = std::vector(), - double defaultPixelValue = 0.0, - PixelIDValueEnum outputPixelType = srtkUnknown ); - /**@}*/ - - - -/** - * \brief rtk::simple::PatchBasedDenoisingImageFilter Procedural Interface - * - * This function directly calls the execute method of PatchBasedDenoisingImageFilter - * in order to support a procedural API - * - * \sa rtk::simple::PatchBasedDenoisingImageFilter for the object oriented interface - */ -SRTKBasicFilters_EXPORT Image PatchBasedDenoising (const Image& image1, - rtk::simple::PatchBasedDenoisingImageFilter::NoiseModelType noiseModel, - double kernelBandwidthSigma = 400.0, - uint32_t patchRadius = 4u, - uint32_t numberOfIterations = 1u, - uint32_t numberOfSamplePatches = 200u, - double sampleVariance = 400.0, - double noiseSigma = 0.0, - double noiseModelFidelityWeight = 0.0 ); - -// Disable for certain wrapped languages due to overload shadowing -#if !defined(SWIGLUA) - -SRTKBasicFilters_EXPORT Image PatchBasedDenoising (const Image& image1, - double kernelBandwidthSigma = 400.0, - uint32_t patchRadius = 4u, - uint32_t numberOfIterations = 1u, - uint32_t numberOfSamplePatches = 200u, - double sampleVariance = 400.0); -#endif - - -} -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkBasicFilters.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkBasicFilters.h deleted file mode 100644 index 0729752d7..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkBasicFilters.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkBasicFilters_h -#define __srtkBasicFilters_h - -#include "srtkMacro.h" -#include "srtkInterpolator.h" - -// todo this should be moved to a more local place -#include "nsstd/auto_ptr.h" -#include "srtkTransform.h" -#include "srtkThreeDCircularProjectionGeometry.h" - -#if defined( SRTKDLL ) - #ifdef SimpleRTKBasicFilters0_EXPORTS - #define SRTKBasicFilters0_EXPORT SRTK_ABI_EXPORT - #else - #define SRTKBasicFilters0_EXPORT SRTK_ABI_IMPORT - #endif /* SimpleRTKBasicFilters0_EXPORTS */ -#else - // Don't hide symbols in the static SimpleRTKBasicFilters library in case - // -fvisibility=hidden is used - #define SRTKBasicFilters0_EXPORT -#endif - -#if defined( SRTKDLL ) -#ifdef SimpleRTKBasicFilters1_EXPORTS -#define SRTKBasicFilters1_EXPORT SRTK_ABI_EXPORT -#else -#define SRTKBasicFilters1_EXPORT SRTK_ABI_IMPORT -#endif /* SimpleRTKBasicFilters1_EXPORTS */ -#else -// Don't hide symbols in the static SimpleRTKBasicFilters library in case -// -fvisibility=hidden is used -#define SRTKBasicFilters1_EXPORT -#endif - -#if defined( SRTKDLL ) - #ifdef SimpleRTKBasicFilters_EXPORTS - #define SRTKBasicFilters_EXPORT SRTK_ABI_EXPORT - #else - #define SRTKBasicFilters_EXPORT SRTK_ABI_IMPORT - #endif /* SimpleRTKBasicFilters_EXPORTS */ -#else - // Don't hide symbols in the static SimpleRTKBasicFilters library in case - // -fvisibility=hidden is used - #define SRTKBasicFilters_EXPORT -#endif - -#define SRTKBasicFilters0_HIDDEN SRTK_ABI_HIDDEN -#define SRTKBasicFilters_HIDDEN SRTK_ABI_HIDDEN - -#endif // __srtkBasicFilters_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkCastImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkCastImageFilter.h deleted file mode 100644 index 72518cd83..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkCastImageFilter.h +++ /dev/null @@ -1,180 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkCastImageFilter_h -#define __srtkCastImageFilter_h - -#include "srtkImageFilter.h" -#include "srtkPixelIDTokens.h" -#include "srtkDualMemberFunctionFactory.h" - -#include - -namespace rtk -{ -namespace simple -{ - -/** \class CastImageFilter - * \brief A hybrid cast image filter to convert images to other types - * of images. - * - * Several different ITK classes are implemented under the hood, to - * convert between different image types. - * - * \sa rtk::simple::Cast for the procedural interface - */ -class SRTKBasicFilters_EXPORT CastImageFilter - : public ImageFilter<1> -{ -public: - typedef CastImageFilter Self; - - /** Set/Get the output pixel type */ - SRTK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueEnum pixelID ); - SRTK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueType pixelID ); - PixelIDValueEnum GetOutputPixelType( void ) const; - - /** - * Default Constructor that takes no arguments and initializes - * default parameters - */ - CastImageFilter(); - - /** Name of this class */ - std::string GetName() const { return std::string ("CastImageFilter"); } - - // See super class for doxygen - std::string ToString() const; - - // See super class for doxygen - Image Execute ( const Image & ); - -private: - - PixelIDValueEnum m_OutputPixelType; - - /** Methods to actually implement conversion from one image type - * to another. - * - * These methods implement CastImageFilter, - * ComposeImageFilter, and LabelImageToLabelMapImageFilter - * respectively. - * - * @{ - */ - template - Image ExecuteInternalCast( const Image& inImage ); - - template - Image ExecuteInternalToVector( const Image& inImage ); - - template - Image ExecuteInternalToLabel( const Image& inImage ); - - template - Image ExecuteInternalLabelToImage( const Image& inImage ); - /** @} */ - -// SWIG does not appear to process private classes correctly -#ifndef SWIG - - /** An addressor of ExecuteInternalCast to be utilized with - * registering member functions with the factory. - */ - template < class TMemberFunctionPointer > - struct CastAddressor - { - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalCast< TImageType1, TImageType2 >; - } - }; - - /** An addressor of ExecuteInternalToVector to be utilized with - * registering member functions with the factory. - */ - template < class TMemberFunctionPointer > - struct ToVectorAddressor - { - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalToVector< TImageType1, TImageType2 >; - } - }; - - /** An addressor of ExecuteInternalToLabel to be utilized with - * registering member functions with the factory. - */ - template < class TMemberFunctionPointer > - struct ToLabelAddressor - { - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalToLabel< TImageType1, TImageType2 >; - } - }; - - /** An addressor of ExecuteInternalToLabel to be utilized with - * registering member functions with the factory. - */ - template < class TMemberFunctionPointer > - struct LabelToAddressor - { - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalLabelToImage< TImageType1, TImageType2 >; - } - }; -#endif - - /** - * These methods are used to instantiate and register member functions - * with the factory. Each function is split into a separate file to - * make the compilation units smaller, and take less time to compile. - * @{ - */ - void RegisterMemberFactory2(); - void RegisterMemberFactory2v(); - void RegisterMemberFactory2l(); - void RegisterMemberFactory3(); - void RegisterMemberFactory3v(); - void RegisterMemberFactory3l(); - /** @} */ - - typedef Image (Self::*MemberFunctionType)( const Image& ); - nsstd::auto_ptr > m_DualMemberFactory; - -}; - - SRTKBasicFilters_EXPORT Image Cast ( const Image& image, PixelIDValueEnum pixelID ); - -} -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkHashImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkHashImageFilter.h deleted file mode 100644 index 3ce6298d0..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkHashImageFilter.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkHashImageFilter_h -#define __srtkHashImageFilter_h - -#include "srtkMacro.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkImage.h" -#include "srtkBasicFilters.h" -#include "srtkImageFilter.h" -#include "srtkProcessObject.h" - -namespace rtk { - namespace simple { - - /** \class HashImageFilter - * \brief Compute the sha1 or md5 hash of an image - * - * \sa rtk::simple::Hash for the procedural interface - */ - class SRTKBasicFilters_EXPORT HashImageFilter - : public ProcessObject { - public: - typedef HashImageFilter Self; - - // function pointer type - typedef std::string (Self::*MemberFunctionType)( const Image& ); - - // this filter works with all itk::Image and itk::VectorImage types. - typedef typelist::Append< - typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList>::Type, - VectorPixelIDTypeList >::Type PixelIDTypeList; - - HashImageFilter(); - - enum HashFunction { SHA1, MD5 }; - SRTK_RETURN_SELF_TYPE_HEADER SetHashFunction ( HashFunction hashFunction ); - HashFunction GetHashFunction () const; - - /** Name of this class */ - std::string GetName() const { return std::string ( "Hash"); } - - // Print ourselves out - std::string ToString() const; - - std::string Execute ( const Image& ); - - - private: - HashFunction m_HashFunction; - - template std::string ExecuteInternal ( const Image& image ); - template std::string ExecuteInternalLabelImage ( const Image& image ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - friend struct detail::ExecuteInternalLabelImageAddressor; - - nsstd::auto_ptr > m_MemberFactory; - }; - - SRTKBasicFilters_EXPORT std::string Hash ( const Image& image, HashImageFilter::HashFunction function = HashImageFilter::SHA1 ); - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageFilter.h deleted file mode 100644 index 8d79892b9..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageFilter.h +++ /dev/null @@ -1,113 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageFilter_h -#define __srtkImageFilter_h - -#include "srtkMacro.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkBasicFilters.h" -#include "srtkProcessObject.h" - -namespace rtk { - - namespace simple { - - /** \class ImageFilter - * \brief The base interface for SimpleRTK filters that take one input image - * - * All SimpleRTK filters which take one input image should inherit from this - * class - */ - template < unsigned int N> - class SRTKBasicFilters0_EXPORT ImageFilter: - public ProcessObject - { - public: - typedef ImageFilter Self; - - // - // Type List Setup - // - - // - // Filter Setup - // - - /** - * Default Constructor that takes no arguments and initializes - * default parameters - */ - ImageFilter(); - - /** - * Default Destructor - */ - virtual ~ImageFilter() = 0; - - protected: - - template< class TImageType > - static typename TImageType::ConstPointer CastImageToITK( const Image &img ) - { - typename TImageType::ConstPointer itkImage = - dynamic_cast < const TImageType* > ( img.GetITKBase() ); - - if ( itkImage.IsNull() ) - { - srtkExceptionMacro( "Unexpected template dispatch error!" ); - } - return itkImage; - } - - // Simple ITK must use a zero based index - template< class TImageType> - static void FixNonZeroIndex( TImageType * img ) - { - assert( img != NULL ); - - typename TImageType::RegionType r = img->GetLargestPossibleRegion(); - typename TImageType::IndexType idx = r.GetIndex(); - - for( unsigned int i = 0; i < TImageType::ImageDimension; ++i ) - { - - if ( idx[i] != 0 ) - { - // if any of the indcies are non-zero, then just fix it - typename TImageType::PointType o; - img->TransformIndexToPhysicalPoint( idx, o ); - img->SetOrigin( o ); - - idx.Fill( 0 ); - r.SetIndex( idx ); - - // Need to set the buffered region to match largest - img->SetRegions( r ); - - return; - } - } - - } - - }; - - - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageOperators.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageOperators.h deleted file mode 100644 index 644a70290..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkImageOperators.h +++ /dev/null @@ -1,99 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageOperators_h -#define __srtkImageOperators_h - -#include "srtkAddImageFilter.h" -#include "srtkSubtractImageFilter.h" -#include "srtkMultiplyImageFilter.h" -#include "srtkDivideImageFilter.h" -#include "srtkModulusImageFilter.h" -#include "srtkUnaryMinusImageFilter.h" -#include "srtkBitwiseNotImageFilter.h" -#include "srtkAndImageFilter.h" -#include "srtkOrImageFilter.h" -#include "srtkXorImageFilter.h" - -namespace rtk { -namespace simple { - -/** -* \brief Performs the operator on a per pixel basis. -* -* All overloaded simpleRTK operators are performed on a per-pixel -* basis, and implemented with the coresponding image filters. These -* operators gernerally don't work with label images, and the logical -* operators don't work with images of real components or vector images. -* @{ -*/ -inline Image operator+( const Image &img1, const Image &img2 ) { return Add(img1, img2 ); } -inline Image operator+( const Image &img, double s ) { return Add(img, s ); } -inline Image operator+( double s, const Image &img ) { return Add(s, img ); } -inline Image operator-( const Image &img1, const Image &img2 ) { return Subtract(img1, img2 ); } -inline Image operator-( const Image &img, double s ) { return Subtract(img, s ); } -inline Image operator-(double s, const Image &img ) { return Subtract(s, img ); } -inline Image operator*( const Image &img1, const Image &img2 ) { return Multiply(img1, img2 ); } -inline Image operator*( const Image &img, double s ) { return Multiply(img, s ); } -inline Image operator*( double s, const Image &img ) { return Multiply(s, img ); } -inline Image operator/( const Image &img1, const Image &img2 ) { return Divide(img1, img2 ); } -inline Image operator/( const Image &img, double s ) { return Divide(img, s ); } -inline Image operator/( double s, const Image &img ) { return Divide(s, img ); } -inline Image operator%( const Image &img1, const Image &img2 ) { return Modulus(img1, img2 ); } -inline Image operator%( const Image &img, uint32_t s ) { return Modulus(img, s ); } -inline Image operator%( uint32_t s, const Image &img ) { return Modulus(s, img ); } - - -// Modoulo does not appear to be defined? -// Image operator%( Image &img1, Image &img2 ) -// Image &operator%=( Image &img1, double s ) - -inline Image operator-( const Image &img ) { return UnaryMinus( img ); } - -inline Image operator~( const Image &img ) { return BitwiseNot( img ); } -inline Image operator&( const Image &img1, const Image &img2 ) { return And(img1, img2 ); } -inline Image operator&( const Image &img, int s ) { return And(img, s ); } -inline Image operator&( int s, const Image &img ) { return And(s, img ); } -inline Image operator|( const Image &img1, const Image &img2 ) { return Or(img1, img2 ); } -inline Image operator|( const Image &img, int s ) { return Or(img, s ); } -inline Image operator|( int s, const Image &img ) { return Or(s, img ); } -inline Image operator^( const Image &img1, const Image &img2 ) { return Xor(img1, img2 ); } -inline Image operator^( const Image &img, int s ) { return Xor(img, s ); } -inline Image operator^( int s, const Image &img ) { return Xor(s, img ); } - -/** \todo these operators should some how be done "in-place" */ -inline Image operator+=( Image &img1, const Image &img2 ) { return img1 = Add(img1, img2 ); } -inline Image operator+=( Image &img1, double s ) { return img1 = Add(img1, s ); } -inline Image operator-=( Image &img1, const Image &img2 ) { return img1 = Subtract(img1, img2 ); } -inline Image operator-=( Image &img1, double s ) { return img1 = Subtract(img1, s ); } -inline Image operator*=( Image &img1, const Image &img2 ) { return img1 = Multiply(img1, img2 ); } -inline Image operator*=( Image &img1, double s ) { return img1 = Multiply(img1, s ); } -inline Image operator/=( Image &img1, const Image &img2 ) { return img1 = Divide(img1, img2 ); } -inline Image operator/=( Image &img1, double s ) { return img1 = Divide(img1, s ); } -inline Image operator%=( Image &img1, const Image &img2 ) { return img1 = Modulus(img1, img2 ); } -inline Image operator%=( Image &img1, uint32_t s ) { return img1 = Modulus(img1, s ); } -inline Image operator&=( Image &img1, const Image &img2 ) { return img1 = And(img1, img2 ); } -inline Image operator&=( Image &img1, int s ) { return img1 = And(img1, s ); } -inline Image operator|=( Image &img1, const Image &img2 ) { return img1 = Or(img1, img2 ); } -inline Image operator|=( Image &img1, int s ) { return img1 = Or(img1, s ); } -inline Image operator^=( Image &img1, const Image &img2 ) { return img1 = Xor(img1, img2 ); } -inline Image operator^=( Image &img1, int s ) { return img1 = Xor(img1, s ); } -/**@} */ -} -} - -#endif // __srtkImageOperators_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkLabelStatisticsImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkLabelStatisticsImageFilter.h deleted file mode 100644 index 1390fc9cc..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkLabelStatisticsImageFilter.h +++ /dev/null @@ -1,146 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkLabelStatisticsImageFilter_h -#define __srtkLabelStatisticsImageFilter_h - -#include "srtkImageFilter.h" -#include "srtkDualMemberFunctionFactory.h" -#include "srtkMeasurementMap.h" - -namespace rtk { - namespace simple { - - /** \class LabelStatisticsImageFilter - * \brief Given an intensity image and a label map, compute min, - * max, variance and mean of the pixels associated with each label - * or segment. - * - * LabelStatisticsImageFilter computes the minimum, maximum, sum, - * mean, median, variance and sigma of regions of an intensity image, where - * the regions are defined via a label map (a second input). The - * label image should be integral type. The filter needs all of its - * input image. - * - * \sa rtk::simple::LabelStatistics for the procedural interface - */ - class SRTKBasicFilters_EXPORT LabelStatisticsImageFilter - : public ImageFilter<2> { - public: - typedef LabelStatisticsImageFilter Self; - - /** - * Default Constructor that takes no arguments and initializes - * default parameters - */ - LabelStatisticsImageFilter(); - - ///Label type used is int because it is wrapped naturally by swig. - typedef unsigned int LabelIdentifierType; - - ///List of labels is an std::vector because it seems to be most widely supported for wrapping. - typedef std::vector LabelListingType; - - ///The type used to catalog all named values - typedef std::map LabelStatisticsMap; - - typedef BasicPixelIDTypeList PixelIDTypeList; - typedef IntegerPixelIDTypeList MapPixelIDTypeList; - - /** Name of this class */ - std::string GetName() const { return std::string ("LabelStatisticsImageFilter" ); } - - // Print ourselves out - std::string ToString() const; - - /** \brief Compute histogram with statistics - * - * Enable the computation of the approximate median value, at - * the cost of additional computation. - */ - bool GetUseHistograms() const {return this->m_UseHistograms;} - void SetUseHistograms(bool v) {this->m_UseHistograms=v;} - void UseHistogramsOn() {this->SetUseHistograms(true);} - void UseHistogramsOff() {this->SetUseHistograms(false);} - - Image Execute ( const Image & image1, const Image & labelImage ); - - Image Execute ( const Image & image1, const Image & labelImage, bool useHistograms ); - - double GetMinimum ( const LabelIdentifierType labelCode ) const; - double GetMaximum ( const LabelIdentifierType labelCode ) const; - double GetMean ( const LabelIdentifierType labelCode ) const; - double GetMedian ( const LabelIdentifierType labelCode ) const; - double GetSigma ( const LabelIdentifierType labelCode ) const; - double GetVariance( const LabelIdentifierType labelCode ) const; - double GetSum ( const LabelIdentifierType labelCode ) const; - double GetCount ( const LabelIdentifierType labelCode ) const; - - /** - * \brief Get the bounding box of a label. - * - * Defined by the closed interval of indexes, with a - * lower index followed by the upper for each dimension. - * i.e. [0,255,0,255]. The bounding box always has a positive - * size. - */ - std::vector GetBoundingBox( const LabelIdentifierType labelCode ) const; - - //Return the MeasuremetMap for the given labelCode - MeasurementMap GetMeasurementMap ( const LabelIdentifierType labelCode ) const; - - bool HasLabel ( const LabelIdentifierType labelCode ) const; - - /** A convenience function to return a dense list of valid labels found in the label image */ - LabelListingType GetValidLabels () const; - - /** - * Return the entire statistics map - */ - LabelStatisticsMap GetLabelStatisticsMap( ) const; - private: - - /** - * These methods are used to instantiate and register member functions - * with the factory. Each function is split into a separate file to - * make the compilation units smaller, and take less time to compile. - * @{ - */ - void RegisterMemberFactory2(); - void RegisterMemberFactory3(); - /** @} */ - - typedef Image (Self::*MemberFunctionType)( const Image&, const Image& ); - template Image DualExecuteInternal ( const Image& image, const Image& labels ); - - friend struct detail::DualExecuteInternalAddressor; - std::auto_ptr > m_DualMemberFactory; - - bool m_UseHistograms; - - LabelStatisticsMap m_LabelMeasurementMap; - - std::map > m_BoundingBoxMeasurementMap; - - //A helper to get values out of the m_LabelMeasurementMap; - double QueryValue(const LabelIdentifierType, const std::string) const; - }; - - SRTKBasicFilters_EXPORT LabelStatisticsImageFilter::LabelStatisticsMap LabelStatistics ( const Image& image1, const Image& labelImage, bool useHistograms = true ); - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkMeasurementMap.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkMeasurementMap.h deleted file mode 100644 index 445108f63..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkMeasurementMap.h +++ /dev/null @@ -1,61 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkMeasurementMap_h -#define __srtkMeasurementMap_h - -#include -#include -#include - -#include "srtkBasicFilters.h" - -namespace rtk { -namespace simple { - -typedef std::map BasicMeasurementMap; - -/** \class MeasurementMap - * \brief A generic class that simply holds key value pairs - * intended primarily for holding measurements - * It is a thin wrapper around an std::map - * that adds some convenience functions. - */ -class SRTKBasicFilters1_EXPORT MeasurementMap: public BasicMeasurementMap -{ -public: - MeasurementMap(); - - typedef std::vector LabelListType; - //Return a vector of measurement names - LabelListType GetVectorOfMeasurementNames( ) const; - - typedef std::vector ValueListType; - //Return a vector of values for the measurements - ValueListType GetVectorOfMeasurementValues( ) const; - - BasicMeasurementMap GetBasicMeasurementMap( ) const; - - // Format a string in csv format that can be easily pasted to a spreadsheet. - std::string ToString( ) const; - // Helper to write to a stream - void ToStream ( std::ostream& ) const; - -}; -} -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/include/srtkStatisticsImageFilter.h b/utilities/SimpleRTK/Code/BasicFilters/include/srtkStatisticsImageFilter.h deleted file mode 100644 index 34436ed3f..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/include/srtkStatisticsImageFilter.h +++ /dev/null @@ -1,78 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkStatisticsImageFilter_h -#define __srtkStatisticsImageFilter_h - -#include "srtkImageFilter.h" -#include "srtkMeasurementMap.h" - -namespace rtk { - namespace simple { - - /** \class StatisticsImageFilter - * \brief Compute min, max, variance, and mean of an image - * - * \sa rtk::simple::Statistics for the procedural interface - */ - class SRTKBasicFilters_EXPORT StatisticsImageFilter : public ImageFilter<1> { - public: - typedef StatisticsImageFilter Self; - - /** - * Default Constructor that takes no arguments and initializes - * default parameters - */ - StatisticsImageFilter(); - - typedef BasicPixelIDTypeList PixelIDTypeList; - - /** Name of this class */ - std::string GetName() const { return std::string ("StatisticsImageFilter"); } - - // Print ourselves out - std::string ToString() const; - - Image Execute ( const Image & ); - - double GetMinimum ( ) const; - double GetMaximum ( ) const; - double GetMean ( ) const; - double GetSigma ( ) const; - double GetVariance( ) const; - double GetSum ( ) const; - - //Return the MeasuremetMap for the given labelCode - rtk::simple::MeasurementMap GetMeasurementMap ( ) const; - private: - - typedef Image (Self::*MemberFunctionType)( const Image& ); - template Image ExecuteInternal ( const Image& image ); - - friend struct detail::MemberFunctionAddressor; - std::auto_ptr > m_MemberFactory; - - MeasurementMap m_MeasurementMap; - - //A helper to get values out of the m_LabelStatisticsMap; - double QueryValue( const std::string) const; - }; - - SRTKBasicFilters_EXPORT rtk::simple::MeasurementMap Statistics ( const Image& ); - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/AddImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/AddImageFilter.json deleted file mode 100644 index f24fd03a8..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/AddImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "AddImageFilter", - "itk_name" : "AddImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "NonLabelPixelIDTypeList", - "members" : [], - "briefdescription" : "Pixel-wise addition of two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nThe pixel type of the input 1 image must have a valid definition of the operator+ with a pixel type of the image 2. This condition is required because internally this filter will perform the operation\n\n\\code\n*pixel_from_image_1+pixel_from_image_2\n*\n\\endcode\n\n\nAdditionally the type resulting from the sum, will be cast to the pixel type of the output image.\n\nThe total operation over one pixel will be\\code\n*output_pixel=static_cast(input1_pixel+input2_pixel)\n*\n\\endcode\n\n\nFor example, this filter could be used directly for adding images whose pixels are vectors of the same dimension, and to store the resulting vector in an output image of vector pixels.\n\nThe images to be added are set using the methods:\\code\n* SetInput1(image1);\n* SetInput2(image2);\n*\n\\endcode\n\n\nAdditionally, this filter can be used to add a constant to every pixel of an image by using\\code\n* SetInput1(image1);\n* SetConstant2(constant);\n*\n\\endcode\n\n\n\\warning No numeric overflow checking is performed in this filter.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Add two images together\n\n\\li Add a constant to every pixel in an image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/AndImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/AndImageFilter.json deleted file mode 100644 index c292995f9..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/AndImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "AndImageFilter", - "itk_name" : "AndImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "int", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "members" : [], - "briefdescription" : "Implements the AND bitwise operator pixel-wise between two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nSince the bitwise AND operation is only defined in C++ for integer types, the images passed to this filter must comply with the requirement of using integer pixel type.\n\nThe total operation over one pixel will be\\code\n*output_pixel=static_cast(input1_pixel&input2_pixel)\n*\n\\endcode\nWhere \"&\" is the bitwise AND operator in C++.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Binary AND two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/BackProjectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/BackProjectionImageFilter.json deleted file mode 100644 index c8cea3643..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/BackProjectionImageFilter.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name" : "BackProjectionImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::BackProjectionImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->GetGeometry()->GetRTKBase())) );" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/BinaryNotImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/BinaryNotImageFilter.json deleted file mode 100644 index 9797a1ea3..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/BinaryNotImageFilter.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name" : "BinaryNotImageFilter", - "itk_name" : "BinaryNotImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "filter_type" : "itk::BinaryNotImageFilter< InputImageType >", - "members" : [ - { - "name" : "ForegroundValue", - "type" : "double", - "default" : "1.0", - "pixeltype" : "Input", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value in the image considered as \"foreground\". Defaults to maximum value of PixelType.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value in the image considered as \"foreground\". Defaults to maximum value of PixelType." - }, - { - "name" : "BackgroundValue", - "type" : "double", - "default" : "0.0", - "pixeltype" : "Input", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the value used as \"background\". Defaults to NumericTraits::NonpositiveMin().", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the value used as \"background\". Defaults to NumericTraits::NonpositiveMin()." - } - ], - "tests" : [ - { - "tag" : "defaults", - "description" : "Simply run with default settings", - "settings" : [], - "md5hash" : "ae5c932ab2e19291dd20c2c4ac382428", - "inputs" : [ - "Input/2th_cthead1.png" - ] - }, - { - "tag" : "withFG", - "description" : "with foreground value", - "settings" : [ - { - "parameter" : "ForegroundValue", - "value" : "100.0" - } - ], - "md5hash" : "0cea51dbae361d6727688d79f33c27d0", - "inputs" : [ - "Input/2th_cthead1.png" - ] - } - ], - "briefdescription" : "Implements the BinaryNot logical operator pixel-wise between two images.", - "detaileddescription" : "This class is parametrized over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nThe total operation over one pixel will be\n\noutput_pixel = static_cast( input1_pixel != input2_pixel )\n\nWhere \"!=\" is the equality operator in C++.\n\n\\author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.\n\nThis implementation was taken from the Insight Journal paper:http://hdl.handle.net/1926/584orhttp://www.insight-journal.org/browse/publication/176\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Invert an image using the Binary Not operation" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/BitwiseNotImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/BitwiseNotImageFilter.json deleted file mode 100644 index 70cd699c3..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/BitwiseNotImageFilter.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "BitwiseNotImageFilter", - "itk_name" : "UnaryFunctorImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "include_files" : [ - "itkBitwiseNotFunctor.h" - ], - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "filter_type" : "itk::UnaryFunctorImageFilter< InputImageType, InputImageType, itk::Functor::BitwiseNot< typename InputImageType::PixelType,typename OutputImageType::PixelType> >", - "members" : [], - "briefdescription" : "Implements pixel-wise generic operation on one image.", - "detaileddescription" : "This class is parameterized over the type of the input image and the type of the output image. It is also parameterized by the operation to be applied, using a Functorstyle.\n\n UnaryFunctorImageFilterallows the output dimension of the filter to be larger than the input dimension. Thus subclasses of the UnaryFunctorImageFilter(like the CastImageFilter) can be used to promote a 2D image to a 3D image, etc.\n\n\\see BinaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a custom operation to each pixel in an image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToImaginaryImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToImaginaryImageFilter.json deleted file mode 100644 index e0cc640a1..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToImaginaryImageFilter.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name" : "ComplexToImaginaryImageFilter", - "itk_name" : "ComplexToImaginaryImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "ComplexPixelIDTypeList", - "include_files" : [ - "itkComplexToImaginaryImageFilter.h" - ], - "output_pixel_type" : "typename InputImageType::PixelType::value_type", - "members" : [], - "briefdescription" : "Computes pixel-wise the imaginary part of a complex image.", - "detaileddescription" : "" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToRealImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToRealImageFilter.json deleted file mode 100644 index ca61fd7bf..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ComplexToRealImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "ComplexToRealImageFilter", - "itk_name" : "ComplexToRealImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "ComplexPixelIDTypeList", - "output_pixel_type" : "typename InputImageType::PixelType::value_type", - "members" : [], - "briefdescription" : "Computes pixel-wise the real(x) part of a complex image.", - "detaileddescription" : "" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ConjugateGradientConeBeamReconstructionFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ConjugateGradientConeBeamReconstructionFilter.json deleted file mode 100644 index 957105b22..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ConjugateGradientConeBeamReconstructionFilter.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name" : "ConjugateGradientConeBeamReconstructionFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 3, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "typelist::MakeTypeList< BasicPixelID >::Type", - "filter_type" : "rtk::ConjugateGradientConeBeamReconstructionFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "ThreeDCircularProjectionGeometry", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->m_Geometry->GetRTKBase())) );\n" - }, - { - "name" : "NumberOfIterations", - "type" : "int", - "default" : "5" - }, - { - "name" : "ForwardProjectionFilter", - "type" : "int", - "default" : "0" - }, - { - "name" : "BackProjectionFilter", - "type" : "int", - "default" : "0" - }, - { - "name" : "Regularized", - "type" : "bool", - "default" : "0" - }, - { - "name" : "Gamma", - "type" : "float", - "default" : "0" - }, - { - "name" : "CudaConjugateGradient", - "type" : "bool", - "default" : "0" - }, - { - "name" : "IterationCosts", - "type" : "bool", - "default" : "0" - }, - { - "name" : "SupportMask", - "type" : "Image", - "default" : "Image()", - "custom_itk_cast" : "if(dynamic_cast < const TImageType* > ( this->m_SupportMask.GetITKBase() )) filter->SetSupportMask(const_cast( this->CastImageToITK(this->m_SupportMask).GetPointer() ));", - "no_print" : true - } - ], - "measurements" : [ - { - "name" : "ResidualCosts", - "type" : "std::vector", - "default" : "std::vector()", - "custom_itk_cast" : "this->m_ResidualCosts = std::vector( filter->GetResidualCosts().begin(), filter->GetResidualCosts().end() );" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ConstantImageSource.json b/utilities/SimpleRTK/Code/BasicFilters/json/ConstantImageSource.json deleted file mode 100644 index 48ffbb778..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ConstantImageSource.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name" : "ConstantImageSource", - "template_code_filename" : "ImageSource", - "template_test_filename" : "ImageFilter", - "doc" : "", - "number_of_inputs" : 0, - "pixel_types" : "BasicPixelIDTypeList", - "output_image_type" : "TImageType", - "filter_type" : "rtk::ConstantImageSource", - "include_files" : [ - "srtkDirectionConvert.hxx" - ], - "members" : [ - { - "name" : "OutputPixelType", - "type" : "PixelIDValueEnum", - "default" : "rtk::simple::srtkFloat32", - "custom_itk_cast" : "" - }, - { - "name" : "Size", - "type" : "unsigned int", - "dim_vec" : 1, - "default" : "std::vector(3, 64)", - "itk_type" : "typename FilterType::SizeType" - }, - { - "name" : "Constant", - "type" : "double", - "default" : "0.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the pixel value of the output.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the pixel value of the output." - }, - { - "name" : "Origin", - "type" : "double", - "dim_vec" : 1, - "default" : "std::vector(3, 0.0)", - "itk_type" : "typename FilterType::PointType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the origin value of the output image.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the origin value of the output image." - }, - { - "name" : "Spacing", - "type" : "double", - "dim_vec" : 1, - "default" : "std::vector(3, 1.0)", - "itk_type" : "typename FilterType::SpacingType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the spacing value of the output image.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the spacing value of the output image." - }, - { - "name" : "Direction", - "type" : "std::vector", - "default" : "std::vector()", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the direction of the output image.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the direction of the output image.", - "custom_itk_cast" : "filter->SetDirection( VectorToITKDirection( this->m_Direction ) );" - } - ], - "briefdescription" : "Generate an n-dimensional image with constant pixel values.", - "detaileddescription" : "Generates an image with constant value. The filter is useful to allow streaming of large images with a constant source, e.g., a tomography reconstructed with a filtered backprojection algorithm." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/CudaFDKConeBeamReconstructionFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/CudaFDKConeBeamReconstructionFilter.json deleted file mode 100644 index f8167952e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/CudaFDKConeBeamReconstructionFilter.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name" : "CudaFDKConeBeamReconstructionFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "typelist::MakeTypeList< BasicPixelID >::Type", - "filter_type" : "rtk::CudaFDKConeBeamReconstructionFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "ThreeDCircularProjectionGeometry", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->m_Geometry->GetRTKBase())) );\n", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the object pointer to projection geometry.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the object pointer to projection geometry." - }, - { - "name" : "TruncationCorrection", - "type" : "double", - "default" : "0.0", - "custom_itk_cast" : "filter->GetRampFilter()->SetTruncationCorrection( this->m_TruncationCorrection );\n", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the percentage of the image widthfeathered with data to correct for truncation.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get he percentage of the image widthfeathered with data to correct for truncation." - }, - { - "name" : "HannCutFrequency", - "type" : "double", - "default" : "0.0", - "custom_itk_cast" : "filter->GetRampFilter()->SetHannCutFrequency( this->m_HannCutFrequency );\n", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the Hann window frequency.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the Hann window frequency." - } - ], - "briefdescription" : "Implements Feldkamp, David and Kress cone-beam reconstruction.", - "detaileddescription" : "CudaFDKConeBeamReconstructionFilter is a mini-pipeline filter which combines the different steps of the FDK cone-beam reconstruction filter: \n\n - rtk::FDKWeightProjectionFilter for 2D weighting of the projections, \n\n - rtk::FFTRampImageFilter for ramp filtering, \n\n - rtk::FDKBackProjectionImageFilter for backprojection.\n\n The input stack of projections is processed piece by piece (the size is controlled with ProjectionSubsetSize) via the use of itk::ExtractImageFilter to extract sub-stacks." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/CudaForwardProjectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/CudaForwardProjectionImageFilter.json deleted file mode 100644 index 0a6ca02a8..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/CudaForwardProjectionImageFilter.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name" : "CudaForwardProjectionImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "typelist::MakeTypeList< BasicPixelID >::Type", - "filter_type" : "rtk::CudaForwardProjectionImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->GetGeometry()->GetRTKBase())) );\n" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/DisplacedDetectorForOffsetFieldOfViewImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/DisplacedDetectorForOffsetFieldOfViewImageFilter.json deleted file mode 100644 index eee08fcc0..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/DisplacedDetectorForOffsetFieldOfViewImageFilter.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name" : "DisplacedDetectorForOffsetFieldOfViewImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::DisplacedDetectorForOffsetFieldOfViewImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "ThreeDimCircularProjectionGeometry", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->GetGeometry()->GetRTKBase())) );\n" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/DivideImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/DivideImageFilter.json deleted file mode 100644 index 053816c67..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/DivideImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "DivideImageFilter", - "itk_name" : "DivideImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "typelist::Append::Type", - "members" : [], - "briefdescription" : "Pixel-wise division of two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. When the divisor is zero, the division result is set to the maximum number that can be represented by default to avoid exception. Numeric conversions (castings) are done by the C++ defaults.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Pixel-wise division of two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/DrawCylinderImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/DrawCylinderImageFilter.json deleted file mode 100644 index 32cec318d..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/DrawCylinderImageFilter.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "DrawCylinderImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::DrawCylinderImageFilter", - "members" : [ - { - "name" : "Density", - "type" : "double", - "default" : "1." - }, - { - "name" : "Angle", - "type" : "double", - "default" : "0." - }, - { - "name" : "Axis", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "Center", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/DrawEllipsoidImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/DrawEllipsoidImageFilter.json deleted file mode 100644 index d9f7aaada..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/DrawEllipsoidImageFilter.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "DrawEllipsoidImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::DrawEllipsoidImageFilter", - "members" : [ - { - "name" : "Density", - "type" : "double", - "default" : "1." - }, - { - "name" : "Angle", - "type" : "double", - "default" : "0." - }, - { - "name" : "Axis", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "Center", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/DrawSheppLoganFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/DrawSheppLoganFilter.json deleted file mode 100644 index ed2d0ca8f..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/DrawSheppLoganFilter.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name" : "DrawSheppLoganFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::DrawSheppLoganFilter", - "members" : [ - { - "name" : "OriginOffset", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "PhantomScale", - "type" : "double", - "default" : "128." - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ElektaSynergyRawLookupTableImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ElektaSynergyRawLookupTableImageFilter.json deleted file mode 100644 index 1ec0e2e16..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ElektaSynergyRawLookupTableImageFilter.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name" : "ElektaSynergyRawLookupTableImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "Filter", - "number_of_inputs" : 1, - "number_of_outputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "typelist::MakeTypeList< BasicPixelID >::Type", - "filter_type" : "rtk::ElektaSynergyRawLookupTableImageFilter", - "members" : [] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ExtractImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ExtractImageFilter.json deleted file mode 100644 index 8838a45d0..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ExtractImageFilter.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name" : "ExtractImageFilter", - "itk_name" : "ExtractImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Extract image filter extracts a 2D image from a 2D or 3D image. If the same dimension output is required then the RegionOfInterestFilter should be used.", - "pixel_types" : "NonLabelPixelIDTypeList", - "filter_type" : "itk::ExtractImageFilter::Type >", - "members" : [ - { - "name" : "Size", - "type" : "unsigned int", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename InputImageType::SizeType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "", - "custom_itk_cast" : "" - }, - { - "name" : "Index", - "type" : "int", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename InputImageType::IndexType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "\todo the internal setting of the method needs work!!!", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "", - "custom_itk_cast" : " typename InputImageType::RegionType itkRegion;\n for( unsigned int i = 0; i < inImage1.GetDimension(); ++i )\n {\n itkRegion.SetIndex( i, m_Index[i] );\n itkRegion.SetSize( i, m_Size[i] );\n }\n filter->SetExtractionRegion( itkRegion );" - }, - { - "name" : "DirectionCollapseToStrategy", - "enum" : [ - "DIRECTIONCOLLAPSETOUNKOWN", - "DIRECTIONCOLLAPSETOIDENTITY", - "DIRECTIONCOLLAPSETOSUBMATRIX", - "DIRECTIONCOLLAPSETOGUESS" - ], - "default" : "rtk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS", - "itk_type" : "typename FilterType::DirectionCollapseStrategyEnum", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the strategy to be used to collapse pysical space dimensions.\n\nitk::itkExtractImageFilter::DIRECTIONCOLLAPSETOIDENTITY Set the strategy so that all collapsed images have an identity direction. Use this strategy when you know that retention of the physical space orientation of the collapsed image is not important.\n\nitk::itkExtractImageFilter::DIRECTIONCOLLAPSETOGUESS Set the strategy so that all collapsed images where output direction is the sub-matrix it it is positive definite, else return identity. This is backwards compatible with ITKv3, but is highly discouraged because the results are difficult to anticipate under differing data scenerios.\n\nitk::itkExtractImageFilter::DIRECTIONCOLLAPSETOSUBMATRIX Set the strategy so that all collapsed images where output direction is the sub-matrix it it is positive definite, else throw an exception. Use this strategy when it is known that properly identified physical space sub-volumes can be reliably extracted from a higher dimensional space. For example when the application programmer knows that a 4D image is 3D+time, and that the 3D sub-space is properly defined.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "NOTE: The SetDirectionCollapseToUknown is explicitly not defined. It is a state that a filter can be in only when it is first instantiate prior to being initialized. Get the currently set strategy for collapsing directions of physical space." - } - ], - "briefdescription" : "Decrease the image size by cropping the image to the selected region bounds.", - "detaileddescription" : "ExtractImageFilterchanges the image boundary of an image by removing pixels outside the target region. The target region must be specified.\n\n ExtractImageFilteralso collapses dimensions so that the input image may have more dimensions than the output image (i.e. 4-D input image to a 3-D output image). To specify what dimensions to collapse, the ExtractionRegion must be specified. For any dimension dim where ExtractionRegion.Size[dim] = 0, that dimension is collapsed. The index to collapse on is specified by ExtractionRegion.Index[dim]. For example, we have a image 4D = a 4x4x4x4 image, and we want to get a 3D image, 3D = a 4x4x4 image, specified as [x,y,z,2] from 4D (i.e. the 3rd \"time\" slice from 4D). The ExtractionRegion.Size = [4,4,4,0] and ExtractionRegion.Index = [0,0,0,2].\n\nThe number of dimension in ExtractionRegion.Size and Indexmust = InputImageDimension. The number of non-zero dimensions in ExtractionRegion.Size must = OutputImageDimension.\n\nThe output image produced by this filter will have the same origin as the input image, while the ImageRegionof the output image will start at the starting index value provided in the ExtractRegion parameter. If you are looking for a filter that will re-compute the origin of the output image, and provide an output image region whose index is set to zeros, then you may want to use the RegionOfInterestImageFilter. The output spacing is is simply the collapsed version of the input spacing.\n\nDetermining the direction of the collapsed output image from an larger dimensional input space is an ill defined problem in general. It is required that the application developer select the desired transformation strategy for collapsing direction cosigns. It is REQUIRED that a strategy be explicitly requested (i.e. there is no working default). Direction Collapsing Strategies: 1) DirectionCollapseToUnknown(); This is the default and the filter can not run when this is set. The reason is to explicitly force the application developer to define their desired behavior. 1) DirectionCollapseToIdentity(); Output has identity direction no matter what 2) DirectionCollapseToSubmatrix(); Output direction is the sub-matrix if it is positive definite, else throw an exception.\n\nThis filter is implemented as a multithreaded filter. It provides a ThreadedGenerateData()method for its implementation.\n\n\\note This filter is derived from InPlaceImageFilter. When the input to this filter matched the output requirested region, like with streaming filter for input, then setting this filter to run in-place will result in no copying of the bulk pixel data.\n\n\\see CropImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Crop an image by specifying the region to keep" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/FDKBackProjectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/FDKBackProjectionImageFilter.json deleted file mode 100644 index 4896d559b..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/FDKBackProjectionImageFilter.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "FDKBackProjectionImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::FDKBackProjectionImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->GetGeometry()->GetRTKBase())) );" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/FDKConeBeamReconstructionFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/FDKConeBeamReconstructionFilter.json deleted file mode 100644 index f986e7c75..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/FDKConeBeamReconstructionFilter.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name" : "FDKConeBeamReconstructionFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::FDKConeBeamReconstructionFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "ThreeDCircularProjectionGeometry", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->m_Geometry->GetRTKBase())) );\n", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the object pointer to projection geometry.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the object pointer to projection geometry." - }, - { - "name" : "TruncationCorrection", - "type" : "double", - "default" : "0.0", - "custom_itk_cast" : "filter->GetRampFilter()->SetTruncationCorrection( this->m_TruncationCorrection );\n", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the percentage of the image widthfeathered with data to correct for truncation.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get he percentage of the image widthfeathered with data to correct for truncation." - }, - { - "name" : "HannCutFrequency", - "type" : "double", - "default" : "0.0", - "custom_itk_cast" : "filter->GetRampFilter()->SetHannCutFrequency( this->m_HannCutFrequency );\n", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the Hann window frequency.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the Hann window frequency." - } - ], - "briefdescription" : "Implements Feldkamp, David and Kress cone-beam reconstruction.", - "detaileddescription" : "FDKConeBeamReconstructionFilter is a mini-pipeline filter which combines the different steps of the FDK cone-beam reconstruction filter: \n\n - rtk::FDKWeightProjectionFilter for 2D weighting of the projections, \n\n - rtk::FFTRampImageFilter for ramp filtering, \n\n - rtk::FDKBackProjectionImageFilter for backprojection.\n\n The input stack of projections is processed piece by piece (the size is controlled with ProjectionSubsetSize) via the use of itk::ExtractImageFilter to extract sub-stacks." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/FDKWeightProjectionFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/FDKWeightProjectionFilter.json deleted file mode 100644 index cca8db37e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/FDKWeightProjectionFilter.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "FDKWeightProjectionFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "Filter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::FDKWeightProjectionFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "rtk::ThreeDCircularProjectionGeometry*", - "custom_itk_cast" : "filter->SetGeometry( (rtk::ThreeDCircularProjectionGeometry*) this->m_Geometry->GetRTKBase() );" -} - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/FFTRampImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/FFTRampImageFilter.json deleted file mode 100644 index acbce2fac..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/FFTRampImageFilter.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name" : "FFTRampImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "Filter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::FFTRampImageFilter", - "members" : [ - { - "name" : "HannCutFrequency", - "type" : "double", - "default" : "0." - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/FieldOfViewImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/FieldOfViewImageFilter.json deleted file mode 100644 index 6dc478fa1..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/FieldOfViewImageFilter.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name" : "FieldOfViewImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "Filter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::FieldOfViewImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "ProjectionsStack", - "type" : "Image", - "default" : "Image()", - "custom_itk_cast" : "filter->SetProjectionsStack(const_cast( this->CastImageToITK(this->m_ProjectionsStack).GetPointer() ) );", - "no_print" : true - }, - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "rtk::ThreeDCircularProjectionGeometry*", - "custom_itk_cast" : "filter->SetGeometry( (rtk::ThreeDCircularProjectionGeometry*) this->m_Geometry->GetRTKBase() );" - }, - { - "name" : "Mask", - "type" : "bool", - "default" : "false" - }, - { - "name" : "DisplacedDetector", - "type" : "bool", - "default" : "false" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/GreaterEqualImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/GreaterEqualImageFilter.json deleted file mode 100644 index 82a3f5fe2..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/GreaterEqualImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "GreaterEqualImageFilter", - "itk_name" : "BinaryFunctorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "output_pixel_type" : "uint8_t", - "filter_type" : "itk::BinaryFunctorImageFilter >", - "include_files" : [ - "itkLogicOpsFunctors.h" - ], - "members" : [ - { - "name" : "BackgroundValue", - "type" : "uint8_t", - "default" : "0u", - "custom_itk_cast" : "filter->GetFunctor().SetBackgroundValue( static_cast( this->m_BackgroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the false pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the false pixels of the operator.\n" - }, - { - "name" : "ForegroundValue", - "type" : "uint8_t", - "default" : "1u", - "custom_itk_cast" : "filter->GetFunctor().SetForegroundValue( static_cast( this->m_ForegroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the true pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the true pixels of the operator.\n" - } - ], - "briefdescription" : "Implements pixel-wise generic operation of two images, or of an image and a constant.", - "detaileddescription" : "This class is parameterized over the types of the two input images and the type of the output image. It is also parameterized by the operation to be applied. A Functorstyle is used.\n\nThe constant must be of the same type than the pixel type of the corresponding image. It is wrapped in a SimpleDataObjectDecoratorso it can be updated through the pipeline. The SetConstant()and GetConstant()methods are provided as shortcuts to set or get the constant value without manipulating the decorator.\n\n\\see UnaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a predefined operation to corresponding pixels in two images\n\n\\li Apply a custom operation to corresponding pixels in two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/GreaterImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/GreaterImageFilter.json deleted file mode 100644 index 572601c70..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/GreaterImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "GreaterImageFilter", - "itk_name" : "BinaryFunctorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "output_pixel_type" : "uint8_t", - "filter_type" : "itk::BinaryFunctorImageFilter >", - "include_files" : [ - "itkLogicOpsFunctors.h" - ], - "members" : [ - { - "name" : "BackgroundValue", - "type" : "uint8_t", - "default" : "0u", - "custom_itk_cast" : "filter->GetFunctor().SetBackgroundValue( static_cast( this->m_BackgroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the false pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the false pixels of the operator.\n" - }, - { - "name" : "ForegroundValue", - "type" : "uint8_t", - "default" : "1u", - "custom_itk_cast" : "filter->GetFunctor().SetForegroundValue( static_cast( this->m_ForegroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the true pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the true pixels of the operator.\n" - } - ], - "briefdescription" : "Implements pixel-wise generic operation of two images, or of an image and a constant.", - "detaileddescription" : "This class is parameterized over the types of the two input images and the type of the output image. It is also parameterized by the operation to be applied. A Functorstyle is used.\n\nThe constant must be of the same type than the pixel type of the corresponding image. It is wrapped in a SimpleDataObjectDecoratorso it can be updated through the pipeline. The SetConstant()and GetConstant()methods are provided as shortcuts to set or get the constant value without manipulating the decorator.\n\n\\see UnaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a predefined operation to corresponding pixels in two images\n\n\\li Apply a custom operation to corresponding pixels in two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/I0EstimationProjectionFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/I0EstimationProjectionFilter.json deleted file mode 100644 index d1a149532..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/I0EstimationProjectionFilter.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name" : "I0EstimationProjectionFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "typelist::MakeTypeList< BasicPixelID >::Type", - "filter_type" : "rtk::I0EstimationProjectionFilter", - "members" : [ - { - "name" : "Lambda", - "type" : "double", - "default" : 0.8 - } - ], - "measurements" : [ - { - "name" : "I0", - "type" : "unsigned short", - "default" : 0 - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/IntensityWindowingImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/IntensityWindowingImageFilter.json deleted file mode 100644 index e90c5918e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/IntensityWindowingImageFilter.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name" : "IntensityWindowingImageFilter", - "itk_name" : "IntensityWindowingImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "pixel_types" : "BasicPixelIDTypeList", - "doc" : "", - "members" : [ - { - "name" : "WindowMinimum", - "type" : "double", - "default" : "0.0", - "pixeltype" : "Input", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the values of the maximum and minimum intensities of the input intensity window", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the values of the maximum and minimum intensities of the input intensity window" - }, - { - "name" : "WindowMaximum", - "type" : "double", - "default" : 255.0, - "pixeltype" : "Input", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the values of the maximum and minimum intensities of the input intensity window", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the values of the maximum and minimum intensities of the input intensity window" - }, - { - "name" : "OutputMinimum", - "type" : "double", - "default" : 0.0, - "pixeltype" : "Output", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the values of the maximum and minimum intensities of the outputimage", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the values of the maximum and minimum intensities of the outputimage" - }, - { - "name" : "OutputMaximum", - "type" : "double", - "default" : 255.0, - "pixeltype" : "Output", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the values of the maximum and minimum intensities of the outputimage", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the values of the maximum and minimum intensities of the outputimage" - } - ], - "briefdescription" : "Applies a linear transformation to the intensity levels of the input Imagethat are inside a user-defined interval. Values below this interval are mapped to a constant. Values over the interval are mapped to another constant.", - "detaileddescription" : "IntensityWindowingImageFilterapplies pixel-wise a linear transformation to the intensity values of input image pixels. The linear transformation is defined by the user in terms of the minimum and maximum values that the output image should have and the lower and upper limits of the intensity window of the input image. This operation is very common in visualization, and can also be applied as a convenient preprocessing operation for image segmentation.\n\nAll computations are performed in the precison of the input pixel's RealType. Before assigning the computed value to the output pixel.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li IntensityWindowingImageFilter\n\n\n\n\\see RescaleIntensityImageFilter" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/JosephForwardProjectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/JosephForwardProjectionImageFilter.json deleted file mode 100644 index 0db0918a4..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/JosephForwardProjectionImageFilter.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name" : "JosephForwardProjectionImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::JosephForwardProjectionImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "filter->SetGeometry( const_cast(dynamic_cast(this->GetGeometry()->GetRTKBase())) );\n" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/LessEqualImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/LessEqualImageFilter.json deleted file mode 100644 index 4ce81c696..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/LessEqualImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "LessEqualImageFilter", - "itk_name" : "BinaryFunctorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "output_pixel_type" : "uint8_t", - "filter_type" : "itk::BinaryFunctorImageFilter >", - "include_files" : [ - "itkLogicOpsFunctors.h" - ], - "members" : [ - { - "name" : "BackgroundValue", - "type" : "uint8_t", - "default" : "0u", - "custom_itk_cast" : "filter->GetFunctor().SetBackgroundValue( static_cast( this->m_BackgroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the false pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the false pixels of the operator.\n" - }, - { - "name" : "ForegroundValue", - "type" : "uint8_t", - "default" : "1u", - "custom_itk_cast" : "filter->GetFunctor().SetForegroundValue( static_cast( this->m_ForegroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the true pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the true pixels of the operator.\n" - } - ], - "briefdescription" : "Implements pixel-wise generic operation of two images, or of an image and a constant.", - "detaileddescription" : "This class is parameterized over the types of the two input images and the type of the output image. It is also parameterized by the operation to be applied. A Functorstyle is used.\n\nThe constant must be of the same type than the pixel type of the corresponding image. It is wrapped in a SimpleDataObjectDecoratorso it can be updated through the pipeline. The SetConstant()and GetConstant()methods are provided as shortcuts to set or get the constant value without manipulating the decorator.\n\n\\see UnaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a predefined operation to corresponding pixels in two images\n\n\\li Apply a custom operation to corresponding pixels in two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/LessImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/LessImageFilter.json deleted file mode 100644 index d3b0b79ce..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/LessImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "LessImageFilter", - "itk_name" : "BinaryFunctorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "output_pixel_type" : "uint8_t", - "filter_type" : "itk::BinaryFunctorImageFilter >", - "include_files" : [ - "itkLogicOpsFunctors.h" - ], - "members" : [ - { - "name" : "BackgroundValue", - "type" : "uint8_t", - "default" : "0u", - "custom_itk_cast" : "filter->GetFunctor().SetBackgroundValue( static_cast( this->m_BackgroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the false pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the false pixels of the operator.\n" - }, - { - "name" : "ForegroundValue", - "type" : "uint8_t", - "default" : "1u", - "custom_itk_cast" : "filter->GetFunctor().SetForegroundValue( static_cast( this->m_ForegroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the true pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the true pixels of the operator.\n" - } - ], - "briefdescription" : "Implements pixel-wise generic operation of two images, or of an image and a constant.", - "detaileddescription" : "This class is parameterized over the types of the two input images and the type of the output image. It is also parameterized by the operation to be applied. A Functorstyle is used.\n\nThe constant must be of the same type than the pixel type of the corresponding image. It is wrapped in a SimpleDataObjectDecoratorso it can be updated through the pipeline. The SetConstant()and GetConstant()methods are provided as shortcuts to set or get the constant value without manipulating the decorator.\n\n\\see UnaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a predefined operation to corresponding pixels in two images\n\n\\li Apply a custom operation to corresponding pixels in two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ModulusImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ModulusImageFilter.json deleted file mode 100644 index 6d4818f72..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ModulusImageFilter.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name" : "ModulusImageFilter", - "itk_name" : "ModulusImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "uint32_t", - "number_of_inputs" : 2, - "pixel_types" : "IntegerPixelIDTypeList", - "members" : [], - "briefdescription" : "Computes the modulus (x % dividend) pixel-wise.", - "detaileddescription" : "The input pixel type must support the c++ modulus operator (%).\n\nIf the dividend is zero, the maximum value will be returned.\n\n\\author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/MultiplyImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/MultiplyImageFilter.json deleted file mode 100644 index 9b6e18962..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/MultiplyImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "MultiplyImageFilter", - "itk_name" : "MultiplyImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "typelist::Append::Type", - "members" : [], - "briefdescription" : "Pixel-wise multiplication of two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Multiply two images together\n\n\\li Multiply every pixel in an image by a constant" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/NotEqualImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/NotEqualImageFilter.json deleted file mode 100644 index 5f11de583..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/NotEqualImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "NotEqualImageFilter", - "itk_name" : "BinaryFunctorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "output_pixel_type" : "uint8_t", - "filter_type" : "itk::BinaryFunctorImageFilter >", - "include_files" : [ - "itkLogicOpsFunctors.h" - ], - "members" : [ - { - "name" : "BackgroundValue", - "type" : "uint8_t", - "default" : "0u", - "custom_itk_cast" : "filter->GetFunctor().SetBackgroundValue( static_cast( this->m_BackgroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the false pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the false pixels of the operator.\n" - }, - { - "name" : "ForegroundValue", - "type" : "uint8_t", - "default" : "1u", - "custom_itk_cast" : "filter->GetFunctor().SetForegroundValue( static_cast( this->m_ForegroundValue ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the value used to mark the true pixels of the operator.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the value used to mark the true pixels of the operator.\n" - } - ], - "briefdescription" : "Implements pixel-wise generic operation of two images, or of an image and a constant.", - "detaileddescription" : "This class is parameterized over the types of the two input images and the type of the output image. It is also parameterized by the operation to be applied. A Functorstyle is used.\n\nThe constant must be of the same type than the pixel type of the corresponding image. It is wrapped in a SimpleDataObjectDecoratorso it can be updated through the pipeline. The SetConstant()and GetConstant()methods are provided as shortcuts to set or get the constant value without manipulating the decorator.\n\n\\see UnaryFunctorImageFilter TernaryFunctorImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Apply a predefined operation to corresponding pixels in two images\n\n\\li Apply a custom operation to corresponding pixels in two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/NotImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/NotImageFilter.json deleted file mode 100644 index 3d21585d7..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/NotImageFilter.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name" : "NotImageFilter", - "itk_name" : "NotImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "members" : [], - "briefdescription" : "Implements the NOT logical operator pixel-wise on an image.", - "detaileddescription" : "This class is templated over the types of an input image and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nSince the logical NOT operation is operates only on boolean types, the input type must be implicitly convertible to bool, which is only defined in C++ for integer types, the images passed to this filter must comply with the requirement of using integer pixel type.\n\nThe total operation over one pixel will be\n\n\\code\n*output_pixel=static_cast(!input_pixel)\n*\n\\endcode\n\n\nWhere \"!\" is the unary Logical NOT operator in C++." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/OrImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/OrImageFilter.json deleted file mode 100644 index 6afa519f7..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/OrImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "OrImageFilter", - "itk_name" : "OrImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "int", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "members" : [], - "briefdescription" : "Implements the OR bitwise operator pixel-wise between two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nSince the bitwise OR operation is only defined in C++ for integer types, the images passed to this filter must comply with the requirement of using integer pixel type.\n\nThe total operation over one pixel will be\n\n\\code\n*output_pixel=static_cast(input1_pixel|input2_pixel)\n*\n\\endcode\n\n\nWhere \"|\" is the boolean OR operator in C++.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Binary OR two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json deleted file mode 100644 index 878230344..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name" : "PatchBasedDenoisingImageFilter", - "itk_name" : "PatchBasedDenoisingImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "no_procedure" : "1", - "doc" : "", - "pixel_types" : "BasicPixelIDTypeList", - "include_files" : [ - "itkGaussianRandomSpatialNeighborSubsampler.h" - ], - "custom_set_input" : "filter->SetInput( image1 );\n typedef itk::Statistics::GaussianRandomSpatialNeighborSubsampler< typename FilterType::PatchSampleType, typename InputImageType::RegionType> SamplerType;\n typename SamplerType::Pointer sampler = SamplerType::New();\n sampler->SetVariance(m_SampleVariance);\n sampler->SetRadius(itk::Math::Floor(std::sqrt(m_SampleVariance)*2.5));\n sampler->SetNumberOfResultsRequested(m_NumberOfSamplePatches);\n filter->SetSampler(sampler);", - "members" : [ - { - "name" : "KernelBandwidthSigma", - "type" : "double", - "default" : "400.0", - "doc" : "KernelBandwidthSigma", - "custom_itk_cast" : "typename FilterType::RealArrayType a(image1->GetNumberOfComponentsPerPixel());\n a.Fill(m_KernelBandwidthSigma);\n filter->SetKernelBandwidthSigma(a);", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get initial kernel bandwidth estimate. To prevent the class from automatically modifying this estimate, set KernelBandwidthEstimation to false in the base class.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get initial kernel bandwidth estimate. To prevent the class from automatically modifying this estimate, set KernelBandwidthEstimation to false in the base class." - }, - { - "name" : "PatchRadius", - "type" : "uint32_t", - "default" : "4u", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the patch radius specified in physical coordinates. Patch radius is preferably set to an even number. Currently, only isotropic patches in physical space are allowed; patches can be anisotropic in voxel space.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the patch radius specified in physical coordinates. Patch radius is preferably set to an even number. Currently, only isotropic patches in physical space are allowed; patches can be anisotropic in voxel space.\n" - }, - { - "name" : "NumberOfIterations", - "type" : "uint32_t", - "default" : "1u", - "doc" : "Number of iterations to run", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the number of denoising iterations to perform. Must be a positive integer. Defaults to 1.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the number of denoising iterations to perform. Must be a positive integer. Defaults to 1.\n" - }, - { - "name" : "NumberOfSamplePatches", - "type" : "uint32_t", - "default" : "200u", - "custom_itk_cast" : "", - "detaileddescriptionSet" : "Set/Get the number of patches to sample for each pixel.\n" - }, - { - "name" : "SampleVariance", - "type" : "double", - "default" : "400.0", - "custom_itk_cast" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the variance of the domain where patches are sampled.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the variance of the domain where patches are sampled.\n" - }, - { - "enum" : [ - "NOMODEL", - "GAUSSIAN", - "RICIAN", - "POISSON" - ], - "name" : "NoiseModel", - "default" : "rtk::simple::PatchBasedDenoisingImageFilter::NOMODEL", - "itk_type" : "typename FilterType::NoiseModelType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the noise model type. Defaults to GAUSSIAN. To use the noise model during denoising, FidelityWeight must be positive.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the noise model type. Defaults to GAUSSIAN. To use the noise model during denoising, FidelityWeight must be positive.\n" - }, - { - "name" : "NoiseSigma", - "type" : "double", - "default" : "0.0", - "custom_itk_cast" : "if (this->m_NoiseSigma != 0.0) filter->SetNoiseSigma(this->m_NoiseSigma);", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the noise sigma. Used by the noise model where appropriate, defaults to 5% of the image intensity range", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "" - }, - { - "name" : "NoiseModelFidelityWeight", - "type" : "double", - "default" : "0.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the weight on the fidelity term (penalizes deviations from the noisy data). This option is used when a noise model is specified. This weight controls the balance between the smoothing and the closeness to the noisy data.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the weight on the fidelity term (penalizes deviations from the noisy data). This option is used when a noise model is specified. This weight controls the balance between the smoothing and the closeness to the noisy data.\n" - }, - { - "name" : "AlwaysTreatComponentsAsEuclidean", - "type" : "bool", - "default" : "false", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get flag indicating whether all components should always be treated as if they are in euclidean space regardless of pixel type. Defaults to false.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get flag indicating whether all components should always be treated as if they are in euclidean space regardless of pixel type. Defaults to false.\n" - }, - { - "name" : "KernelBandwidthEstimation", - "type" : "bool", - "default" : "false", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get flag indicating whether kernel-bandwidth should be estimated automatically from the image data. Defaults to true.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get flag indicating whether kernel-bandwidth should be estimated automatically from the image data. Defaults to true.\n" - }, - { - "name" : "KernelBandwidthMultiplicationFactor", - "type" : "double", - "default" : "1.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the kernel bandwidth sigma multiplication factor used to modify the automatically-estimated kernel bandwidth sigma. At times, it may be desirable to modify the value of the automatically-estimated sigma. Typically, this number isn't very far from 1. Note: This is used only when KernelBandwidthEstimation is True/On.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the kernel bandwidth sigma multiplication factor used to modify the automatically-estimated kernel bandwidth sigma. At times, it may be desirable to modify the value of the automatically-estimated sigma. Typically, this number isn't very far from 1. Note: This is used only when KernelBandwidthEstimation is True/On." - }, - { - "name" : "KernelBandwidthUpdateFrequency", - "type" : "uint32_t", - "default" : "3u", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the update frequency for the kernel bandwidth estimation. An optimal bandwidth will be re-estimated based on the denoised image after every 'n' iterations. Must be a positive integer. Defaults to 3, i.e. bandwidth updated after every 3 denoising iteration.\n", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the update frequency for the kernel bandwidth estimation. An optimal bandwidth will be re-estimated based on the denoised image after every 'n' iterations. Must be a positive integer. Defaults to 3, i.e. bandwidth updated after every 3 denoising iteration.\n" - }, - { - "name" : "KernelBandwidthFractionPixelsForEstimation", - "type" : "double", - "default" : "0.2", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set/Get the fraction of the image to use for kernel bandwidth sigma estimation. To reduce the computational burden for computing sigma, a small random fraction of the image pixels can be used.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set/Get the fraction of the image to use for kernel bandwidth sigma estimation. To reduce the computational burden for computing sigma, a small random fraction of the image pixels can be used." - } - ], - "tests" : [ - { - "tag" : "default", - "description" : "Simply run with default settings", - "settings" : [], - "tolerance" : 0.9, - "inputs" : [ - "Input/cthead1.png" - ] - } - ], - "briefdescription" : "Derived class implementing a specific patch-based denoising algorithm, as detailed below.", - "detaileddescription" : "This class is derived from the base class PatchBasedDenoisingBaseImageFilter ; please refer to the documentation of the base class first. This class implements a denoising filter that uses iterative non-local, or semi-local, weighted averaging of image patches for image denoising. The intensity at each pixel 'p' gets updated as a weighted average of intensities of a chosen subset of pixels from the image.\n\nThis class implements the denoising algorithm using a Gaussian kernel function for nonparametric density estimation. The class implements a scheme to automatically estimated the kernel bandwidth parameter (namely, sigma) using leave-one-out cross validation. It implements schemes for random sampling of patches non-locally (from the entire image) as well as semi-locally (from the spatial proximity of the pixel being denoised at the specific point in time). It implements a specific scheme for defining patch weights (mask) as described in Awate and Whitaker 2005 IEEE CVPR and 2006 IEEE TPAMI.\n\n\\see PatchBasedDenoisingBaseImageFilter" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/PowImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/PowImageFilter.json deleted file mode 100644 index 1caf84a49..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/PowImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "PowImageFilter", - "itk_name" : "PowImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "typelist::Append::Type", - "members" : [], - "briefdescription" : "Computes the powers of 2 images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nThe output of the pow function will be cast to the pixel type of the output image.\n\nThe total operation over one pixel will be\\code\n*output_pixel=static_cast(vcl_pow(static_cast(A),static_cast(B)));\n*\n\\endcode\n\n\nThe pow function can be applied to two images with the following:\\code\n* SetInput1(image1);\n* SetInput2(image2);\n*\n\\endcode\n\n\nAdditionally, this filter can be used to raise every pixel of an image to a power of a constant by using\\code\n* SetInput1(image1);\n* SetConstant2(constant);\n*\n\\endcode" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ProjectGeometricPhantomImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ProjectGeometricPhantomImageFilter.json deleted file mode 100644 index 16918fbaa..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ProjectGeometricPhantomImageFilter.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name" : "ProjectGeometricPhantomImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::ProjectGeometricPhantomImageFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "typename FilterType::GeometryType* itkTx;\n if ( !(itkTx = dynamic_cast(this->m_Geometry->GetRTKBase() )) ) {\n srtkExceptionMacro( \"Unexpected error converting geometry\" );\n }\n else { filter->SetGeometry( itkTx ); }" - }, - { - "name" : "OriginOffset", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "PhantomScale", - "type" : "double", - "default" : "128." - }, - { - "name" : "ConfigFile", - "type" : "std::string", - "default" : "\"\"" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/RayBoxIntersectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/RayBoxIntersectionImageFilter.json deleted file mode 100644 index ae7531af7..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/RayBoxIntersectionImageFilter.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name" : "RayBoxIntersectionImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "typename FilterType::GeometryType* itkTx;\n if ( !(itkTx = dynamic_cast(this->m_Geometry->GetRTKBase() )) ) {\n srtkExceptionMacro( \"Unexpected error converting geometry\" );\n }\n else { filter->SetGeometry( itkTx ); }", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the geometry input.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the geometry input." - }, - { - "name" : "BoxMin", - "type" : "double", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "BoxMax", - "type" : "double", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "Density", - "type" : "double", - "default" : "0.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the multiplicative constant of the volume.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the multiplicative constant of the volume." - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/RayEllipsoidIntersectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/RayEllipsoidIntersectionImageFilter.json deleted file mode 100644 index 229e58200..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/RayEllipsoidIntersectionImageFilter.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name" : "RayEllipsoidIntersectionImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "typename FilterType::GeometryType* itkTx;\n if ( !(itkTx = dynamic_cast(this->m_Geometry->GetRTKBase() )) ) {\n srtkExceptionMacro( \"Unexpected error converting geometry\" );\n }\n else { filter->SetGeometry( itkTx ); }", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the geometry input.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the geometry input." - }, - { - "name" : "Axis", - "type" : "double", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the axis of the ellipsoid.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the axis of the ellipsoid." - }, - { - "name" : "Center", - "type" : "double", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the center of the ellipsoid.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the center of the ellipsoid." - }, - { - "name" : "Angle", - "type" : "double", - "default" : "0.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the angle of the ellipsoid.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the angle of the ellipsoid." - }, - { - "name" : "Density", - "type" : "double", - "default" : "0.0", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the multiplicative constant of the volume.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the multiplicative constant of the volume." - } - ], - "briefdescription" : "Computes intersection of projection rays with ellipsoids.", - "detaileddescription" : "Computes intersection of projection rays with ellipsoids." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/RealAndImaginaryToComplexImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/RealAndImaginaryToComplexImageFilter.json deleted file mode 100644 index ea777a18e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/RealAndImaginaryToComplexImageFilter.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name" : "RealAndImaginaryToComplexImageFilter", - "itk_name" : "ComposeImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "itk::ComposeImageFilter", - "output_pixel_type" : "std::complex", - "members" : [], - "briefdescription" : "ComposeImageFiltercombine several scalar images into a multicomponent image.", - "detaileddescription" : "ComposeImageFiltercombine several scalar images into an itk::Imageof vector pixel ( itk::Vector, itk::RGBPixel, ...), of std::complex pixel, or in an itk::VectorImage.\n\n\\par Inputs and Usage\n\\code\n*filter->SetInput(0,image0);\n*filter->SetInput(1,image1);\n*...\n*filter->Update();\n* itk::VectorImage< PixelType, dimension >::Pointer=filter->GetOutput();\n*\n\\endcode\nAll input images are expected to have the same template parameters and have the same size and origin.\n\n\\see VectorImage\n\\see \n\\see VectorIndexSelectionCastImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Create a vector image from a collection of scalar images\n\n\\li Compose a vector image (with 3 components) from three scalar images\n\n\\li Convert a real image and an imaginary image to a complex image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/RegionOfInterestImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/RegionOfInterestImageFilter.json deleted file mode 100644 index 3de213db4..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/RegionOfInterestImageFilter.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name" : "RegionOfInterestImageFilter", - "itk_name" : "RegionOfInterestImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "The RegionOfInterest filter extract an N-D image from an N-D image. If a 2-D image is desired then the Extract image filter should be used.", - "pixel_types" : "NonLabelPixelIDTypeList", - "members" : [ - { - "name" : "Size", - "type" : "unsigned int", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "itk_type" : "typename InputImageType::SizeType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "", - "custom_itk_cast" : "" - }, - { - "name" : "Index", - "type" : "int", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename InputImageType::IndexType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "\todo the internal setting of the method need work!!!", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "", - "custom_itk_cast" : " typename InputImageType::RegionType itkRegion;\n for( unsigned int i = 0; i < inImage1.GetDimension(); ++i )\n {\n itkRegion.SetIndex( i, m_Index[i] );\n itkRegion.SetSize( i, m_Size[i] );\n }\n filter->SetRegionOfInterest( itkRegion );" - } - ], - "briefdescription" : "Extract a region of interest from the input image.", - "detaileddescription" : "This filter produces an output image of the same dimension as the input image. The user specifies the region of the input image that will be contained in the output image. The origin coordinates of the output images will be computed in such a way that if mapped to physical space, the output image will overlay the input image with perfect registration. In other words, a registration process between the output image and the input image will return an identity transform.\n\nIf you are interested in changing the dimension of the image, you may want to consider the ExtractImageFilter. For example for extracting a 2D image from a slice of a 3D image.\n\nThe region to extract is set using the method SetRegionOfInterest.\n\n\\see ExtractImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Extract a portion of an image (region of interest)" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/ResampleImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/ResampleImageFilter.json deleted file mode 100644 index 636e5871b..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/ResampleImageFilter.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "name" : "ResampleImageFilter", - "itk_name" : "ResampleImageFilter", - "template_code_filename" : "DualImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "pixel_types" : "BasicPixelIDTypeList", - "pixel_types2" : "BasicPixelIDTypeList", - "custom_type2" : "PixelIDValueEnum type2 = (m_OutputPixelType != srtkUnknown) ? m_OutputPixelType : type1;", - "output_image_type" : "InputImageType2", - "vector_pixel_types_by_component" : "VectorPixelIDTypeList", - "vector_pixel_types_by_component2" : "VectorPixelIDTypeList", - "filter_type" : "itk::ResampleImageFilter", - "no_procedure" : "1", - "include_files" : [ - "srtkCreateInterpolator.hxx", - "srtkTransform.h" - ], - "members" : [ - { - "name" : "Size", - "type" : "uint32_t", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "doc" : "", - "itk_type" : "typename FilterType::SizeType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Get/Set the size of the output image.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get/Set the size of the output image." - }, - { - "name" : "Transform", - "type" : "Transform", - "default" : "rtk::simple::Transform()", - "custom_itk_cast" : "const typename FilterType::TransformType *itkTx;\n if ( !(itkTx = dynamic_cast(this->m_Transform.GetITKBase() )) ) {\n if( this->m_Transform.GetITKBase()->GetNameOfClass() != std::string(\"IdentityTransform\") )\n srtkExceptionMacro( \"Unexpected error converting transform! Possible miss matching dimensions!\" );\n }\n else { filter->SetTransform( itkTx ); }", - "no_print" : "1", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Get/Set the coordinate transformation. Set the coordinate transform to use for resampling. Note that this must be in physical coordinates and it is the output-to-input transform, NOT the input-to-output transform that you might naively expect. By default the filter uses an Identity transform. You must provide a different transform here, before attempting to run the filter, if you do not want to use the default Identity transform.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get/Set the coordinate transformation. Set the coordinate transform to use for resampling. Note that this must be in physical coordinates and it is the output-to-input transform, NOT the input-to-output transform that you might naively expect. By default the filter uses an Identity transform. You must provide a different transform here, before attempting to run the filter, if you do not want to use the default Identity transform." - }, - { - "name" : "Interpolator", - "type" : "InterpolatorEnum", - "default" : "rtk::simple::srtkLinear", - "doc" : "", - "custom_itk_cast" : "filter->SetInterpolator( CreateInterpolator( image1.GetPointer(), m_Interpolator ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Get/Set the interpolator function. The default is LinearInterpolateImageFunction . Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation).", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get/Set the interpolator function. The default is LinearInterpolateImageFunction . Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation)." - }, - { - "name" : "OutputOrigin", - "type" : "double", - "default" : "std::vector(3, 0.0)", - "dim_vec" : 1, - "doc" : "", - "itk_type" : "typename FilterType::OriginPointType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the output image origin.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the output image origin." - }, - { - "name" : "OutputSpacing", - "type" : "double", - "default" : "std::vector(3, 1.0)", - "dim_vec" : 1, - "doc" : "", - "itk_type" : "typename FilterType::SpacingType", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the output image spacing.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get the output image spacing." - }, - { - "name" : "OutputDirection", - "type" : "std::vector", - "default" : "std::vector()", - "doc" : "Passing a zero sized array, defaults to identiy matrix. The size of the array must exactly match the direction matrix for the dimension of the image.", - "custom_itk_cast" : "filter->SetOutputDirection( srtkSTLToITKDirection( this->m_OutputDirection ) );", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Set the output direciton cosine matrix.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Set the output direciton cosine matrix." - }, - { - "name" : "DefaultPixelValue", - "type" : "double", - "default" : "0.0", - "pixeltype" : "Output", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0.", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0." - }, - { - "name" : "OutputPixelType", - "type" : "PixelIDValueEnum", - "default" : "rtk::simple::srtkUnknown", - "custom_itk_cast" : "", - "briefdescriptionSet" : "Set the output pixel type, if srtkUnknown then the input type is used.", - "briefdescriptionGet" : "Get the ouput pixel type." - } - ], - "custom_methods" : [ - { - "name" : "SetReferenceImage", - "doc" : "This methods sets the output size, origin, spacing and direction to that of the provided image", - "return_type" : "void", - "parameters" : [ - { - "type" : "const Image &", - "var_name" : "refImage" - } - ], - "body" : "this->SetSize( refImage.GetSize() ); this->SetOutputOrigin( refImage.GetOrigin() ); this->SetOutputSpacing( refImage.GetSpacing() );this->SetOutputDirection( refImage.GetDirection() );" - } - ], - "tests" : [ - { - "tag" : "defaults", - "description" : "run with some defaults", - "settings" : [ - { - "parameter" : "Size", - "type" : "uint32_t", - "dim_vec" : 1, - "value" : [ - 64, - 64, - 64 - ] - } - ], - "tolerance" : "0.001", - "inputs" : [ - "Input/RA-Float.nrrd" - ] - }, - { - "tag" : "wCastwInterpolator", - "description" : "Resample With Cast and Interpolator", - "settings" : [ - { - "parameter" : "Size", - "type" : "uint32_t", - "dim_vec" : 1, - "value" : [ - 64, - 64, - 64 - ] - }, - { - "parameter" : "OutputPixelType", - "value" : "itk::simple::srtkUInt16", - "lua_value" : "SimpleRTK.srtkUInt16", - "python_value" : "SimpleRTK.srtkUInt16", - "ruby_value" : "Simpleitk::SitkUInt16", - "java_value" : "PixelIDValueEnum.srtkUInt16", - "tcl_value" : "$$srtkUInt16", - "csharp_value" : "PixelIDValueEnum.srtkUInt16", - "R_value" : "'srtkUInt16'" - }, - { - "parameter" : "Interpolator", - "value" : "itk::simple::srtkGaussian", - "lua_value" : "SimpleRTK.srtkGaussian", - "python_value" : "SimpleRTK.srtkGaussian", - "ruby_value" : "Simpleitk::SitkGaussian", - "java_value" : "InterpolatorEnum.srtkGaussian", - "tcl_value" : "$$srtkGaussian", - "csharp_value" : "InterpolatorEnum.srtkGaussian", - "R_value" : "'srtkGaussian'" - } - ], - "tolerance" : "0.001", - "inputs" : [ - "Input/RA-Float.nrrd" - ] - }, - { - "tag" : "vector", - "description" : "resample a vector image", - "settings" : [ - { - "parameter" : "Size", - "type" : "uint32_t", - "dim_vec" : 1, - "value" : [ - 512, - 512 - ], - "tcl_value" : "[list 512 512 ]" - }, - { - "parameter" : "OutputSpacing", - "type" : "double", - "dim_vec" : 1, - "value" : [ - 0.73, - 0.73 - ] - } - ], - "tolerance" : "0.001", - "inputs" : [ - "Input/VM1111Shrink-RGBFloat.nrrd" - ] - } - ], - "briefdescription" : "Resample an image via a coordinate transform.", - "detaileddescription" : "ResampleImageFilter resamples an existing image through some coordinate transform, interpolating via some image function. The class is templated over the types of the input and output images.\n\nNote that the choice of interpolator function can be important. This function is set via SetInterpolator() . The default is LinearInterpolateImageFunction , which is reasonable for ordinary medical images. However, some synthetic images have pixels drawn from a finite prescribed set. An example would be a mask indicating the segmentation of a brain into a small number of tissue types. For such an image, one does not want to interpolate between different pixel values, and so NearestNeighborInterpolateImageFunction < InputImageType, TCoordRep > would be a better choice.\n\nIf an sample is taken from outside the image domain, the default behavior is to use a default pixel value. If different behavior is desired, an extrapolator function can be set with SetExtrapolator() .\n\nOutput information (spacing, size and direction) for the output image should be set. This information has the normal defaults of unit spacing, zero origin and identity direction. Optionally, the output information can be obtained from a reference image. If the reference image is provided and UseReferenceImage is On, then the spacing, origin and direction of the reference image will be used.\n\nSince this filter produces an image which is a different size than its input, it needs to override several of the methods defined in ProcessObject in order to properly manage the pipeline execution model. In particular, this filter overrides ProcessObject::GenerateInputRequestedRegion() and ProcessObject::GenerateOutputInformation() .\n\nThis filter is implemented as a multithreaded filter. It provides a ThreadedGenerateData() method for its implementation.\\warning For multithreading, the TransformPoint method of the user-designated coordinate transform must be threadsafe.\n\n\\par Wiki Examples:\n\n\\li All Examples \n\n\\li Translate an image \n\n\\li Upsampling an image \n\n\\li Resample (stretch or compress) an image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/SheppLoganPhantomFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/SheppLoganPhantomFilter.json deleted file mode 100644 index c26a400cd..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/SheppLoganPhantomFilter.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name" : "SheppLoganPhantomFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::SheppLoganPhantomFilter", - "include_files" : [ - "srtkThreeDCircularProjectionGeometry.h" - ], - "members" : [ - { - "name" : "Geometry", - "type" : "ThreeDCircularProjectionGeometry*", - "default" : "0", - "itk_type" : "typename FilterType::GeometryPointer", - "custom_itk_cast" : "typename FilterType::GeometryType* itkTx;\n if ( !(itkTx = dynamic_cast(this->m_Geometry->GetRTKBase() )) ) {\n srtkExceptionMacro( \"Unexpected error converting geometry\" );\n }\n else { filter->SetGeometry( itkTx ); }" - }, - { - "name" : "OriginOffset", - "type" : "double", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::VectorType" - }, - { - "name" : "PhantomScale", - "type" : "double", - "default" : "128." - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/SliceImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/SliceImageFilter.json deleted file mode 100644 index d2083aa25..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/SliceImageFilter.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name" : "SliceImageFilter", - "itk_name" : "SliceImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "pixel_types" : "NonLabelPixelIDTypeList", - "members" : [ - { - "name" : "Start", - "type" : "int32_t", - "default" : "std::vector(3, 0)", - "dim_vec" : 1, - "itk_type" : "typename FilterType::IndexType" - }, - { - "name" : "Stop", - "type" : "int32_t", - "default" : "std::vector(3, std::numeric_limits::max())", - "dim_vec" : 1, - "itk_type" : "typename FilterType::IndexType" - }, - { - "name" : "Step", - "type" : "int", - "default" : "std::vector(3, 1)", - "dim_vec" : 1, - "set_as_scalar" : 1, - "itk_type" : "typename FilterType::ArrayType" - } - ], - "briefdescription" : "Slice a 3D volume to produce a 2D slice image.", - "detaileddescription" : "Slice a 3D volume to produce a 2D slice image." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/SqrtImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/SqrtImageFilter.json deleted file mode 100644 index 918b05008..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/SqrtImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "SqrtImageFilter", - "itk_name" : "SqrtImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "Some global documentation", - "pixel_types" : "BasicPixelIDTypeList", - "vector_pixel_types_by_component" : "VectorPixelIDTypeList", - "members" : [], - "briefdescription" : "Computes the square root of each pixel.", - "detaileddescription" : "The computations are performed using vcl_sqrt(x)." -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/SubtractImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/SubtractImageFilter.json deleted file mode 100644 index 7284b2fe4..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/SubtractImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "SubtractImageFilter", - "itk_name" : "SubtractImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "double", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "NonLabelPixelIDTypeList", - "members" : [], - "briefdescription" : "Pixel-wise subtraction of two images.", - "detaileddescription" : "Subtract each pixel from image2 from its corresponding pixel in image1:\n\n\\code\n*Output=Input1-Input2.\n*\n\\endcode\n\n\nThis is done using\n\n\\code\n* SetInput1(image1);\n* SetInput2(image2);\n*\n\\endcode\n\n\nThis class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nAdditionally, a constant can be subtracted from every pixel in an image using:\n\n\\code\n* SetInput1(image1);\n* SetConstant2(constant);\n*\n\\endcode\n\n\n\\note The result of AddImageFilterwith a negative constant is not necessarily the same as SubtractImageFilter. This would be the case when the PixelType defines an operator-()that is not the inverse of operator+()\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Subtract two images\n\n\\li Subtract a constant from every pixel in an image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/UnaryMinusImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/UnaryMinusImageFilter.json deleted file mode 100644 index a3175f520..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/UnaryMinusImageFilter.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name" : "UnaryMinusImageFilter", - "itk_name" : "UnaryMinusImageFilter", - "template_code_filename" : "ImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "pixel_types" : "typelist::Append< SignedPixelIDTypeList, ComplexPixelIDTypeList >::Type", - "filter_type" : "itk::UnaryFunctorImageFilter< InputImageType, OutputImageType, itk::Functor::UnaryMinus >", - "vector_pixel_types_by_component" : "SignedVectorPixelIDTypeList", - "members" : [], - "briefdescription" : "Computes the negative of each pixel.\n", - "detaileddescription" : "" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/VectorIndexSelectionCastImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/VectorIndexSelectionCastImageFilter.json deleted file mode 100644 index b67a2fc5f..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/VectorIndexSelectionCastImageFilter.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name" : "VectorIndexSelectionCastImageFilter", - "itk_name" : "VectorIndexSelectionCastImageFilter", - "template_code_filename" : "DualImageFilter", - "number_of_inputs" : 1, - "doc" : "", - "pixel_types" : "VectorPixelIDTypeList", - "pixel_types2" : "typelist::Append::Type", - "custom_type2" : "const PixelIDValueEnum type2 = (m_OutputPixelType != srtkUnknown) ? m_OutputPixelType : type1;", - "output_pixel_type" : "typename InputImageType2::InternalPixelType", - "members" : [ - { - "name" : "Index", - "type" : "unsigned int", - "default" : "0u", - "doc" : "", - "briefdescriptionSet" : "", - "detaileddescriptionSet" : "Get/Set methods for the index", - "briefdescriptionGet" : "", - "detaileddescriptionGet" : "" - }, - { - "name" : "OutputPixelType", - "type" : "PixelIDValueEnum", - "default" : "rtk::simple::srtkUnknown", - "custom_itk_cast" : "", - "briefdescriptionSet" : "Set the output pixel type of the scalar component to extract.", - "briefdescriptionGet" : "Get the ouput pixel type." - } - ], - "briefdescription" : "Extracts the selected index of the vector that is the input pixel type.", - "detaileddescription" : "This filter is templated over the input image type and output image type.\n\nThe filter expect the input image pixel type to be a vector and the output image pixel type to be a scalar. The only requirement on the type used for representing the vector is that it must provide an operator[].\n\n\\see ComposeImageFilter\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Extract a component/channel of a vector image" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/WaterPrecorrectionImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/WaterPrecorrectionImageFilter.json deleted file mode 100644 index 1cf050210..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/WaterPrecorrectionImageFilter.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "WaterPrecorrectionImageFilter", - "template_code_filename" : "RTKImageFilter", - "template_test_filename" : "ImageFilter", - "number_of_inputs" : 1, - "output_image_type" : "TImageType", - "pixel_types" : "RealPixelIDTypeList", - "filter_type" : "rtk::WaterPrecorrectionImageFilter", - "members" : [ - { - "name" : "Coefficients", - "type" : "std::vector", - "default" : "std::vector(2,0)", - "itk_type" : "std::vector" - } - ] -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/json/XorImageFilter.json b/utilities/SimpleRTK/Code/BasicFilters/json/XorImageFilter.json deleted file mode 100644 index ebc8a29f0..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/json/XorImageFilter.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name" : "XorImageFilter", - "itk_name" : "XorImageFilter", - "template_code_filename" : "BinaryFunctorFilter", - "template_test_filename" : "ImageFilter", - "constant_type" : "int", - "number_of_inputs" : 2, - "doc" : "Some global documentation", - "pixel_types" : "IntegerPixelIDTypeList", - "members" : [], - "briefdescription" : "Computes the XOR bitwise operator pixel-wise between two images.", - "detaileddescription" : "This class is templated over the types of the two input images and the type of the output image. Numeric conversions (castings) are done by the C++ defaults.\n\nSince the bitwise XOR operation is only defined in C++ for integer types, the images passed to this filter must comply with the requirement of using integer pixel type.\n\nThe total operation over one pixel will be\n\n\\code\n*output_pixel=static_cast(input1_pixel^input2_pixel)\n*\n\\endcode\n\n\nWhere \"^\" is the boolean XOR operator in C++.\n\n\\par Wiki Examples:\n\n\\li All Examples\n\n\\li Binary XOR (exclusive OR) two images" -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/CMakeLists.txt b/utilities/SimpleRTK/Code/BasicFilters/src/CMakeLists.txt deleted file mode 100644 index 2a8eaf838..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -# Include the hand-written and auto-generated code -include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR} - ) - -set_source_files_properties ( ${SimpleRTKBasicFiltersGeneratedSource} PROPERTIES GENERATED 1 ) - -# these files are the instantiated ITK filter, but they do not do IO, -# so we don't need to register the IO factoried here. -set ( ITK_NO_IO_FACTORY_REGISTER_MANAGER 1 ) -include ( ${ITK_USE_FILE} ) -include ( ${RTK_USE_FILE} ) - -# common source which all basic filter libraries need to be linked against -set ( SimpleRTKBasicFilters0Source - srtkImageFilter.cxx -) - -add_library ( SimpleRTKBasicFilters0 ${SimpleRTKBasicFilters0Source} ) -target_link_libraries ( SimpleRTKBasicFilters0 SimpleRTKCommon ${ITK_LIBRARIES} ) -set_target_properties( SimpleRTKBasicFilters0 PROPERTIES SKIP_BUILD_RPATH TRUE ) -srtk_install_exported_target( SimpleRTKBasicFilters0 ) - -# append this new library to the globally cached list -list ( APPEND SimpleRTK_LIBRARIES SimpleRTKBasicFilters0 ) -set ( SimpleRTK_LIBRARIES ${SimpleRTK_LIBRARIES} CACHE INTERNAL "" ) - - -set ( SimpleRTKBasicFiltersSource - srtkCastImageFilter-2.cxx - srtkCastImageFilter-2l.cxx - srtkCastImageFilter-2v.cxx - srtkCastImageFilter-3.cxx - srtkCastImageFilter-3l.cxx - srtkCastImageFilter-3v.cxx - srtkCastImageFilter.cxx - srtkHashImageFilter.cxx - srtkCreateInterpolator.hxx - srtkMeasurementMap.cxx - srtkStatisticsImageFilter.cxx -) -# sort the list to en-sure the same list across platforms -list ( SORT SimpleRTKBasicFiltersGeneratedSource ) - -# add additional files which may depend on Filters0 -list ( APPEND SimpleRTKBasicFiltersSource ${SimpleRTKBasicFiltersGeneratedSource} ) -list ( APPEND SimpleRTKBasicFiltersSource srtkAdditionalProcedures.cxx ) - -list ( LENGTH SimpleRTKBasicFiltersSource _length ) -math( EXPR _end_range "${_length} - 1 " ) - -# The other filters an automatically split into files. They all -# use the following for export their interface. There must not be and -# inter-filter include. -if(BUILD_SHARED_LIBS) - add_definitions(-DSimpleRTKBasicFilters_EXPORTS) -endif() - -# Break all these source files into a bunch of libraries base on every -# n files in the list. -set ( _stride 25 ) -set ( _library_i 0 ) -foreach ( _start RANGE 0 ${_end_range} ${_stride} ) - - math( EXPR _library_i "${_library_i} + 1 " ) - - # compute the end of the range ensuring that the inclusive range - # [_start, _end] is all valid indexes - math( EXPR _end "${_start} + ${_stride} - 1" ) - if ( ${_end} VERSION_GREATER ${_end_range} OR - ${_end} VERSION_EQUAL ${_end_range} ) - math( EXPR _end "${_end_range}" ) - set(_last 1) - endif() - - # extract out the range into SRC - set ( SRC "" ) - foreach( _j RANGE ${_start} ${_end} ) - list ( GET SimpleRTKBasicFiltersSource ${_j} _v ) - list ( APPEND SRC ${_v} ) - endforeach() - - add_library ( SimpleRTKBasicFilters${_library_i} ${SRC} ) - target_link_libraries ( SimpleRTKBasicFilters${_library_i} SimpleRTKCommon SimpleRTKBasicFilters0 ${ITK_LIBRARIES} ) - if(_last) - # the last library include additional cxx files which may depend on - # other filter libraries - target_link_libraries ( SimpleRTKBasicFilters${_library_i} ${SimpleRTK_LIBRARIES} ) - endif() - set_target_properties( SimpleRTKBasicFilters${_library_i} PROPERTIES SKIP_BUILD_RPATH TRUE ) - add_dependencies ( SimpleRTKBasicFilters${_library_i} BasicFiltersSourceCode ) - - # append this new library to the globaly cached list - list ( APPEND SimpleRTK_LIBRARIES SimpleRTKBasicFilters${_library_i} ) - set ( SimpleRTK_LIBRARIES ${SimpleRTK_LIBRARIES} CACHE INTERNAL "" ) - - srtk_install_exported_target( SimpleRTKBasicFilters${_library_i} ) - -endforeach () - - -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/../include/SimpleRTKBasicFiltersGeneratedHeaders.h - DESTINATION ${SimpleRTK_INSTALL_INCLUDE_DIR} - COMPONENT Development ) diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/itkBitwiseNotFunctor.h b/utilities/SimpleRTK/Code/BasicFilters/src/itkBitwiseNotFunctor.h deleted file mode 100644 index ef365549f..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/itkBitwiseNotFunctor.h +++ /dev/null @@ -1,56 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __itkBitwiseNotFunctor_h -#define __itkBitwiseNotFunctor_h - -#include - -namespace itk -{ -namespace Functor -{ -/** - * \class BitwiseNot - * \brief Performs the C++ unary bitwise NOT operator. - */ -template< class TInput, class TOutput > -class BitwiseNot -{ -public: - // Use default copy, assigned and destructor - // BitwiseNot() {} default constructor OK - - bool operator!=(const BitwiseNot &) const - { - return false; - } - - bool operator==(const BitwiseNot & other) const - { - return !( *this != other ); - } - - inline TOutput operator()(const TInput & A) const - { - return static_cast( ~A ); - } -}; -} -} - -#endif // __itkBitwiseNotFunctor_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkAdditionalProcedures.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkAdditionalProcedures.cxx deleted file mode 100644 index 3ae474c2f..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkAdditionalProcedures.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ - -#include "srtkAdditionalProcedures.h" -#include "srtkResampleImageFilter.h" -#include "srtkPatchBasedDenoisingImageFilter.h" - -namespace rtk { -namespace simple { - -// -// Function to run the Execute method of this filter after custom -// setting the parameters. -// - -SRTKBasicFilters_EXPORT Image Resample ( const Image& image1, - Transform transform, - InterpolatorEnum interpolator, - double defaultPixelValue, - PixelIDValueEnum outputPixelType ) -{ - ResampleImageFilter filter; - filter.SetReferenceImage( image1 ); - filter.SetTransform( transform ); - filter.SetInterpolator( interpolator ); - filter.SetDefaultPixelValue( defaultPixelValue ); - filter.SetOutputPixelType(outputPixelType); - return filter.Execute ( image1); -} - -Image Resample ( const Image& image1, - const Image& referenceImage, - Transform transform, - InterpolatorEnum interpolator, - double defaultPixelValue, - PixelIDValueEnum outputPixelType ) -{ - ResampleImageFilter filter; - filter.SetReferenceImage( referenceImage ); - filter.SetTransform( transform ); - filter.SetInterpolator( interpolator ); - filter.SetDefaultPixelValue( defaultPixelValue ); - filter.SetOutputPixelType(outputPixelType); - return filter.Execute ( image1); -} - - -SRTKBasicFilters_EXPORT Image Resample ( const Image& image1, - std::vector size, - Transform transform, - InterpolatorEnum interpolator, - std::vector outputOrigin, - std::vector outputSpacing, - std::vector outputDirection, - double defaultPixelValue, - PixelIDValueEnum outputPixelType ) -{ - ResampleImageFilter filter; - return filter.Execute ( image1, size, transform, interpolator, outputOrigin, outputSpacing, outputDirection, defaultPixelValue, outputPixelType ); -} - -SRTKBasicFilters_EXPORT Image PatchBasedDenoising (const Image& image1, - double kernelBandwidthSigma, - uint32_t patchRadius, - uint32_t numberOfIterations, - uint32_t numberOfSamplePatches, - double sampleVariance ) -{ - PatchBasedDenoisingImageFilter filter; - - const PatchBasedDenoisingImageFilter::NoiseModelType noiseModel = rtk::simple::PatchBasedDenoisingImageFilter::NOMODEL; - const double noiseSigma = 0.0; - const double noiseModelFidelityWeight = 0.0; - //const bool alwaysTreatComponentsAsEuclidean = false; - - - filter.KernelBandwidthEstimationOff(); - - filter.SetKernelBandwidthSigma(kernelBandwidthSigma); - filter.SetPatchRadius(patchRadius); - filter.SetNumberOfIterations(numberOfIterations); - filter.SetNumberOfSamplePatches(numberOfSamplePatches); - filter.SetSampleVariance(sampleVariance); - filter.SetNoiseModel(noiseModel); - filter.SetNoiseSigma(noiseSigma); - filter.SetNoiseModelFidelityWeight(noiseModelFidelityWeight); - //filter.SetAlwaysTreatComponentsAsEuclidean(alwaysTreatComponentsAsEuclidean); - return filter.Execute ( image1 ); -} - - - -SRTKBasicFilters_EXPORT Image PatchBasedDenoising (const Image& image1, - PatchBasedDenoisingImageFilter::NoiseModelType noiseModel, - double kernelBandwidthSigma, - uint32_t patchRadius, - uint32_t numberOfIterations, - uint32_t numberOfSamplePatches, - double sampleVariance, - double noiseSigma, - double noiseModelFidelityWeight ) -{ - PatchBasedDenoisingImageFilter filter; - - //const bool alwaysTreatComponentsAsEuclidean = false; - - filter.KernelBandwidthEstimationOff(); - - filter.SetKernelBandwidthSigma(kernelBandwidthSigma); - filter.SetPatchRadius(patchRadius); - filter.SetNumberOfIterations(numberOfIterations); - filter.SetNumberOfSamplePatches(numberOfSamplePatches); - filter.SetSampleVariance(sampleVariance); - filter.SetNoiseModel(noiseModel); - filter.SetNoiseSigma(noiseSigma); - filter.SetNoiseModelFidelityWeight(noiseModelFidelityWeight); - //filter.SetAlwaysTreatComponentsAsEuclidean(alwaysTreatComponentsAsEuclidean); - - return filter.Execute ( image1 ); -} - -} -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2.cxx deleted file mode 100644 index 015b91451..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkCastImageFilter.hxx" - - -namespace rtk -{ -namespace simple -{ - - -void CastImageFilter::RegisterMemberFactory2() -{ - // cast between complex pixels and complex pixel - m_DualMemberFactory->RegisterMemberFunctions > (); - - // cast between basic pixels and complex number pixels - m_DualMemberFactory->RegisterMemberFunctions > (); - - // cast between basic images - m_DualMemberFactory->RegisterMemberFunctions > (); - -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2l.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2l.cxx deleted file mode 100644 index b84f6416d..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2l.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkCastImageFilter.hxx" - - -namespace rtk -{ -namespace simple -{ - - -void CastImageFilter::RegisterMemberFactory2l() -{ - // basic to Label - m_DualMemberFactory->RegisterMemberFunctions > (); - - // Label to basic - m_DualMemberFactory->RegisterMemberFunctions > (); -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2v.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2v.cxx deleted file mode 100644 index 9fd340cd1..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-2v.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkCastImageFilter.hxx" - - -namespace rtk -{ -namespace simple -{ - - -void CastImageFilter::RegisterMemberFactory2v() -{ - - // cast between vector images - m_DualMemberFactory->RegisterMemberFunctions > (); - - // basic to vector - m_DualMemberFactory->RegisterMemberFunctions > (); - -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3.cxx deleted file mode 100644 index 0c6810ec5..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkCastImageFilter.hxx" - - -namespace rtk -{ -namespace simple -{ - - -void CastImageFilter::RegisterMemberFactory3() -{ - // cast between complex pixels and complex pixel - m_DualMemberFactory->RegisterMemberFunctions > (); - - // cast between basic pixels and complex number pixels - m_DualMemberFactory->RegisterMemberFunctions > (); - - // cast between basic images - m_DualMemberFactory->RegisterMemberFunctions > (); - -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3l.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3l.cxx deleted file mode 100644 index c718c36f1..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3l.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkCastImageFilter.hxx" - - -namespace rtk -{ -namespace simple -{ - - -void CastImageFilter::RegisterMemberFactory3l() -{ - // basic to Label - m_DualMemberFactory->RegisterMemberFunctions > (); - - // Label to basic - m_DualMemberFactory->RegisterMemberFunctions > (); - -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3v.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3v.cxx deleted file mode 100644 index 662941bdc..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter-3v.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkCastImageFilter.hxx" - -namespace rtk -{ -namespace simple -{ - -void CastImageFilter::RegisterMemberFactory3v() -{ - - // cast between vector images - m_DualMemberFactory->RegisterMemberFunctions > (); - - // basic to vector - m_DualMemberFactory->RegisterMemberFunctions > (); -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.cxx deleted file mode 100644 index 31e1ef556..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkCastImageFilter.h" - - -namespace rtk -{ -namespace simple -{ - - -//---------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -CastImageFilter::CastImageFilter () -{ - this->m_OutputPixelType = srtkFloat32; - - m_DualMemberFactory.reset( new detail::DualMemberFunctionFactory( this ) ); - - this->RegisterMemberFactory2(); - this->RegisterMemberFactory2v(); - this->RegisterMemberFactory2l(); - this->RegisterMemberFactory3(); - this->RegisterMemberFactory3v(); - this->RegisterMemberFactory3l(); - - -} - -// -// ToString -// -std::string CastImageFilter::ToString() const -{ - std::ostringstream out; - out << "rtk::simple::CastImageFilter\n" - << "\tOutputPixelType: " << this->m_OutputPixelType << std::endl; - return out.str(); -} - -// -// Set/Get Methods for output pixel type -// - -CastImageFilter::Self& CastImageFilter::SetOutputPixelType( PixelIDValueEnum pixelID ) -{ - this->m_OutputPixelType = pixelID; - return *this; -} - - -CastImageFilter::Self& CastImageFilter::SetOutputPixelType( PixelIDValueType pixelID ) -{ - return this->SetOutputPixelType( static_cast(pixelID) ); -} - -PixelIDValueEnum CastImageFilter::GetOutputPixelType( void ) const -{ - return this->m_OutputPixelType; -} - - -// -// Execute -// -Image CastImageFilter::Execute ( const Image& image ) -{ - - const PixelIDValueEnum inputType = image.GetPixelID(); - const PixelIDValueEnum outputType = this->m_OutputPixelType; - const unsigned int dimension = image.GetDimension(); - - if (this->m_DualMemberFactory->HasMemberFunction( inputType, outputType, dimension ) ) - { - return this->m_DualMemberFactory->GetMemberFunction( inputType, outputType, dimension )( image ); - } - - srtkExceptionMacro( << "Filter does not support casting from casting " << rtk::simple::GetPixelIDValueAsString (inputType) << " to " - << rtk::simple::GetPixelIDValueAsString (outputType) ); - -} - - -//---------------------------------------------------------------------------- - - -Image Cast ( const Image& image, PixelIDValueEnum pixelID ) { - CastImageFilter filter; - return filter.SetOutputPixelType ( pixelID ).Execute ( image ); -} - - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.hxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.hxx deleted file mode 100644 index fe63f354a..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCastImageFilter.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkCastImageFilter_hxx -#define __srtkCastImageFilter_hxx - -// include itk first to suppress std::copy conversion warning -#include - -#include "srtkCastImageFilter.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include -#include - -namespace rtk -{ -namespace simple -{ - -//---------------------------------------------------------------------------- -// Execute Internal Methods -//---------------------------------------------------------------------------- - -template -Image -CastImageFilter::ExecuteInternalCast( const Image& inImage ) -{ - typedef TImageType InputImageType; - typedef TOutputImageType OutputImageType; - - typename InputImageType::ConstPointer image = this->CastImageToITK( inImage ); - - typedef itk::CastImageFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - - filter->SetInput ( image ); - - this->PreUpdate( filter.GetPointer() ); - - filter->Update(); - - return Image( filter->GetOutput() ); -} - - -template -Image CastImageFilter::ExecuteInternalToVector( const Image& inImage ) -{ - - typedef TImageType InputImageType; - typedef TOutputImageType OutputImageType; - - typename InputImageType::ConstPointer image = this->CastImageToITK( inImage ); - - typedef itk::ComposeImageFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput ( image ); - - this->PreUpdate( filter.GetPointer() ); - - typedef itk::CastImageFilter< typename FilterType::OutputImageType, OutputImageType > CastFilterType; - typename CastFilterType::Pointer caster = CastFilterType::New(); - caster->SetInput( filter->GetOutput() ); - caster->InPlaceOn(); - - if (this->GetDebug()) - { - std::cout << "Executing ITK filters:" << std::endl; - std::cout << filter; - std::cout << caster; - } - - caster->Update(); - - return Image( caster->GetOutput() ); -} - - -template -Image CastImageFilter::ExecuteInternalToLabel( const Image& inImage ) -{ - typedef TImageType InputImageType; - typedef TOutputImageType OutputImageType; - typedef typename OutputImageType::LabelObjectType LabelObjectType; - typedef typename LabelObjectType::LabelType LabelType; - -#ifdef RTK_USE_CUDA - typedef itk::CudaImage LabelImageType; -#else - typedef itk::Image LabelImageType; -#endif - - typename InputImageType::ConstPointer image = this->CastImageToITK( inImage ); - - typedef itk::LabelImageToLabelMapFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput ( image ); - - this->PreUpdate( filter.GetPointer() ); - - filter->Update(); - - return Image( filter->GetOutput() ); -} - - - -template -Image CastImageFilter::ExecuteInternalLabelToImage( const Image& inImage ) -{ - typedef TImageType InputImageType; - typedef TOutputImageType OutputImageType; - - typename InputImageType::ConstPointer image = this->CastImageToITK( inImage ); - - - typedef itk::LabelMapToLabelImageFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput ( image ); - - this->PreUpdate( filter.GetPointer() ); - - filter->Update(); - - return Image( filter->GetOutput() ); -} - -} // end namespace simple -} // end namespace rtk - -#endif //__srtkCastImageFilter_hxx diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateInterpolator.hxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateInterpolator.hxx deleted file mode 100644 index 9657aeb99..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateInterpolator.hxx +++ /dev/null @@ -1,153 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkCreateInterpolator_hxx -#define srtkCreateInterpolator_hxx - - -#include "srtkInterpolator.h" -#include -#include -#include -#include -#include -#include - -namespace rtk -{ - -namespace simple -{ - -template -typename TInterpolatorType::Pointer -ConditionalCreateInterpolator( const TrueType & ) -{ - return TInterpolatorType::New(); -} - -template -TInterpolatorType* -ConditionalCreateInterpolator( const FalseType & ) -{ - return NULL; -} - -template< typename TImageType > -typename itk::InterpolateImageFunction< TImageType, double >::Pointer -CreateInterpolator( const TImageType *image, InterpolatorEnum itype ) -{ - typedef typename itk::InterpolateImageFunction< TImageType, double >::Pointer RType; - typedef typename itk::ZeroFluxNeumannBoundaryCondition BoundaryCondition; - //typedef typename itk::ConstantBoundaryCondition BoundaryCondition; - - typedef typename TImageType::SpacingType SpacingType; - - static const unsigned int WindowingRadius = 5; - - const SpacingType &spacing = image->GetSpacing(); - - switch( itype ) - { - case srtkNearestNeighbor: - { - typedef itk::NearestNeighborInterpolateImageFunction InterpolatorType; - return RType( InterpolatorType::New() ); - } - case srtkLinear: - { - typedef itk::LinearInterpolateImageFunction InterpolatorType; - return RType( InterpolatorType::New() ); - } - case srtkBSpline: - { - typedef itk::BSplineInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - case srtkGaussian: - { - typedef itk::GaussianInterpolateImageFunction InterpolatorType; - - typename InterpolatorType::ArrayType sigma; - - for( unsigned int i = 0; i < TImageType::ImageDimension; ++i ) - { - sigma[i] = 0.8*spacing[i]; - } - typename InterpolatorType::Pointer p = InterpolatorType::New(); - p->SetSigma(sigma); - p->SetAlpha(4.0); - return RType(p); - } - case srtkLabelGaussian: - { - typedef itk::LabelImageGaussianInterpolateImageFunction InterpolatorType; - - typename InterpolatorType::ArrayType sigma; - - for( unsigned int i = 0; i < TImageType::ImageDimension; ++i ) - { - sigma[i] = spacing[i]; - } - typename InterpolatorType::Pointer p = InterpolatorType::New(); - p->SetSigma(sigma); - p->SetAlpha(1.0); - return RType(p); - } - case srtkHammingWindowedSinc: - { - - typedef typename itk::Function::HammingWindowFunction WindowFunction; - typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - case srtkCosineWindowedSinc: - { - typedef typename itk::Function::CosineWindowFunction WindowFunction; - typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - case srtkWelchWindowedSinc: - { - typedef typename itk::Function::WelchWindowFunction WindowFunction; - typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - case srtkLanczosWindowedSinc: - { - typedef typename itk::Function::LanczosWindowFunction WindowFunction; - typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - case srtkBlackmanWindowedSinc: - { - typedef typename itk::Function::BlackmanWindowFunction WindowFunction; - typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; - return RType( ConditionalCreateInterpolator( typename IsBasic::Type() ) ); - } - default: - return NULL; - } - -} - - -} // end namespace simple -} // end namespace itk - - -#endif // srtkCreateInterpolator_hxx diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateKernel.h b/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateKernel.h deleted file mode 100644 index e32a9b8e9..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkCreateKernel.h +++ /dev/null @@ -1,73 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __srtkCreateKernel_h -#define __srtkCreateKernel_h - - -#include "srtkKernel.h" -#include - -namespace rtk -{ - -namespace simple -{ - -#define srtkKernelPolygonCreateMacro(n) \ - case srtkPolygon##n: return ITKKernelType::Polygon( radius, n ) - -template< unsigned int VImageDimension > -itk::FlatStructuringElement< VImageDimension > -CreateKernel( KernelEnum kernelType, const std::vector &size ) -{ - typedef typename itk::FlatStructuringElement< VImageDimension > ITKKernelType; - - typename ITKKernelType::SizeType radius = srtkSTLVectorToITK( size ); - - switch (kernelType) - { - case srtkAnnulus: - return ITKKernelType::Annulus( radius, 1, false ); - case srtkBall: - return ITKKernelType::Ball( radius ); - case srtkBox: - return ITKKernelType::Box( radius ); - case srtkCross: - return ITKKernelType::Cross( radius ); - srtkKernelPolygonCreateMacro(3); - srtkKernelPolygonCreateMacro(4); - srtkKernelPolygonCreateMacro(5); - srtkKernelPolygonCreateMacro(6); - srtkKernelPolygonCreateMacro(7); - srtkKernelPolygonCreateMacro(8); - srtkKernelPolygonCreateMacro(9); - default: - srtkExceptionMacro( "Logic Error: Unknown Kernel Type" ); - } - -#undef srtkKernelPolygonCreateMacro - - -} - - -} // end namespace simple -} // end namespace rtk - - -#endif //__srtkCreateKernel_h diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkDirectionConvert.hxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkDirectionConvert.hxx deleted file mode 100644 index 06719f824..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkDirectionConvert.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkDirectionConvert_hxx -#define __srtkDirectionConvert_hxx - -namespace rtk -{ -namespace simple -{ - -template< typename TDirectionType > -TDirectionType VectorToITKDirection( std::vector &direction ) -{ - TDirectionType itkDirection; - - if ( direction.size() == 0 ) - { - itkDirection.SetIdentity(); - } - else if( direction.size() == TDirectionType::RowDimensions*TDirectionType::ColumnDimensions ) - { - std::copy( direction.begin(), direction.end(), itkDirection.GetVnlMatrix().begin() ); - } - else - { - } - - return itkDirection; -} - -} // end namespace simple -} // end namespace rtk - -#endif // __srtkDirectionConvert_hxx diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkHashImageFilter.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkHashImageFilter.cxx deleted file mode 100644 index 036849263..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkHashImageFilter.cxx +++ /dev/null @@ -1,140 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkHashImageFilter.h" -#include "srtkCastImageFilter.h" -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkHashImageFilter.h" -#include "itkVectorImage.h" -#include "itkLabelMap.h" -#include "itkLabelObject.h" - -#include -#include - -namespace rtk { - namespace simple { - HashImageFilter::HashImageFilter () { - this->m_HashFunction = SHA1; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 4 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - - this->m_MemberFactory->RegisterMemberFunctions < LabelPixelIDTypeList, 4, detail::ExecuteInternalLabelImageAddressor > (); - this->m_MemberFactory->RegisterMemberFunctions < LabelPixelIDTypeList, 3, detail::ExecuteInternalLabelImageAddressor > (); - this->m_MemberFactory->RegisterMemberFunctions < LabelPixelIDTypeList, 2, detail::ExecuteInternalLabelImageAddressor > (); - } - - std::string HashImageFilter::ToString() const { - std::ostringstream out; - out << "itk::simple::HashImageFilter" << std::endl; - out << "HashFunction: "; - switch ( this->m_HashFunction ) - { - case SHA1: - out << "SHA1"; - break; - case MD5: - out << "MD5"; - break; - } - out << std::endl; - out << ProcessObject::ToString(); - return out.str(); - } - - HashImageFilter::HashFunction HashImageFilter::GetHashFunction() const - { - return this->m_HashFunction; - } - - HashImageFilter& HashImageFilter::SetHashFunction ( HashImageFilter::HashFunction hashFunction ) - { - this->m_HashFunction = hashFunction; - return *this; - } - - std::string HashImageFilter::Execute ( const Image& image ) { - - PixelIDValueEnum type = image.GetPixelID(); - unsigned int dimension = image.GetDimension(); - - return this->m_MemberFactory->GetMemberFunction( type, dimension )( image ); - } - - template - std::string HashImageFilter::ExecuteInternalLabelImage( const Image &inImage ) - { - typedef TLabelImageType LabelImageType; - -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< typename LabelImageType::PixelType, LabelImageType::ImageDimension > ScalarImageType; -#else - typedef itk::Image< typename LabelImageType::PixelType, LabelImageType::ImageDimension > ScalarImageType; -#endif - - // The image id for a scalar image of the label map image - PixelIDValueEnum scalarID = static_cast(PixelIDToPixelIDValue< typename ImageTypeToPixelID::PixelIDType >::Result); - - // convert the LabelMapImage to a scalar image - Image img = Cast( inImage, scalarID ); - - return this->Execute( img ); - } - - template - std::string HashImageFilter::ExecuteInternal ( const Image& inImage ) - { - typedef TImageType InputImageType; - - typename InputImageType::ConstPointer image = - dynamic_cast ( inImage.GetITKBase() ); - - typedef itk::HashImageFilter HashFilterType; - typename HashFilterType::Pointer hasher = HashFilterType::New(); - hasher->SetInput( image ); - hasher->InPlaceOff(); // pointless copy of data needed - - switch ( this->GetHashFunction() ) - { - case SHA1: - hasher->SetHashFunction( HashFilterType::SHA1 ); - break; - case MD5: - hasher->SetHashFunction( HashFilterType::MD5 ); - break; - } - - this->PreUpdate( hasher.GetPointer() ); - - hasher->Update(); - - return hasher->GetHash(); - } - - std::string Hash ( const Image& image, HashImageFilter::HashFunction function ) - { - return HashImageFilter().SetHashFunction ( function ).Execute ( image ); - } - } -} diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageFilter.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageFilter.cxx deleted file mode 100644 index 064284164..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageFilter.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkImageFilter.h" - -#include "itkProcessObject.h" - -#include - - - -namespace rtk { -namespace simple { -//---------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -template< unsigned int N > -ImageFilter< N >::ImageFilter () -{ -} - -// -// Default destructor -// -template< unsigned int N > -ImageFilter< N >::~ImageFilter () -{ -} - -template class ImageFilter<0>; -template class ImageFilter<1>; -template class ImageFilter<2>; -template class ImageFilter<3>; -template class ImageFilter<4>; -template class ImageFilter<5>; - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageToKernel.hxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageToKernel.hxx deleted file mode 100644 index bdfefc759..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkImageToKernel.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __srtkBoundaryConditions_h -#define __srtkBoundaryConditions_h - -#include -#include -#include - -namespace rtk { -namespace simple { - - -/** \brief Convert an itk Image to an itk ImageKernalOperator - * - * This method will internally pad the image with the - * ConstantPadImageFilter, and then convert to an ImageKernalOperator - * via a deep copy. - * - */ -template -nsstd::auto_ptr< ImageKernelOperator< typename TImageType::PixelType, TImageType::ImageDimension > > -CreateOperatorFromImage( const TImageType * image ) -{ -typedef typename TImageType::PixelType KernelImagePixelType; -typedef ImageKernelOperator< KernelImagePixelType, TImageType::ImageDimension > KernelType; -typedef nsstd::auto_ptr KernelPointerType; - -typedef typename KernelType::SizeType KernelSizeType; - -KernelPointerType kernelOperator( new KernelType() ); - -bool kernelNeedsPadding = false; - -typedef itk::ConstantPadImageFilter PadImageFilter; -typename PadImageFilter::Pointer padFilter = PadImageFilter::New(); -padFilter->SetConstant( NumericTraits< KernelImagePixelType >::ZeroValue() ); -typename TImageType::SizeType padSize = image->GetLargestPossibleRegion().GetSize(); -for( unsigned int i = 0; i < TImageType::ImageDimension; ++i ) - { - // Pad by 1 if the size fo the image in this dimension is even. - padSize[i] = 1 - padSize[i]%2; - - if ( padSize[i] != 0 ) - { - kernelNeedsPadding = true; - } - } -padFilter->SetPadLowerBound(padSize); -padFilter->SetInput( image ); - -if ( kernelNeedsPadding ) - { - padFilter->UpdateLargestPossibleRegion(); - image = padFilter->GetOutput(); - } - -kernelOperator->SetImageKernel( image ); - -KernelSizeType radius; -for ( unsigned int i = 0; i < TImageType::ImageDimension; ++i ) - { - radius[i] = image->GetLargestPossibleRegion().GetSize()[i]/2; - } - -kernelOperator->CreateToRadius( radius ); - -return kernelOperator; -} - -} // end namespace simple -} // end namespace rtk - -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkMeasurementMap.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkMeasurementMap.cxx deleted file mode 100644 index 307bb0785..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkMeasurementMap.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkMeasurementMap.h" - -#include -#include -#include -#include - -namespace rtk { -namespace simple { - - //Constructor - MeasurementMap::MeasurementMap() : BasicMeasurementMap() - { - } - - MeasurementMap::LabelListType MeasurementMap::GetVectorOfMeasurementNames () const - { - MeasurementMap::LabelListType returnLabelList(0); - returnLabelList.reserve(this->size()); - for(BasicMeasurementMap::const_iterator elementIt=this->begin(); - elementIt != this->end(); - ++elementIt) - { - returnLabelList.push_back(elementIt->first); - } - return returnLabelList; - } - - - MeasurementMap::ValueListType MeasurementMap::GetVectorOfMeasurementValues () const - { - MeasurementMap::ValueListType returnValueList(0); - returnValueList.reserve(this->size()); - for(BasicMeasurementMap::const_iterator elementIt=this->begin(); - elementIt != this->end(); - ++elementIt) - { - returnValueList.push_back(elementIt->second); - } - return returnValueList; - } - - - BasicMeasurementMap MeasurementMap::GetBasicMeasurementMap() const - { - return *this; - } - - std::string MeasurementMap::ToString() const - { - std::ostringstream s; - this->ToStream ( s ); - return s.str(); - } - - - void MeasurementMap::ToStream ( std::ostream &stream ) const - { - const MeasurementMap::LabelListType printLabelList = this->GetVectorOfMeasurementNames(); - const MeasurementMap::ValueListType printValueList = this->GetVectorOfMeasurementValues(); - //Print with trailing comma. - { - std::ostream_iterator< BasicMeasurementMap::key_type > outputLabels( stream, ", " ); - std::copy( printLabelList.begin(), printLabelList.end(), outputLabels ); - stream << std::endl; - } - { - std::ostream_iterator< BasicMeasurementMap::mapped_type > outputValues( stream, ", " ); - std::copy( printValueList.begin(), printValueList.end(), outputValues ); - stream << std::endl; - } - } - - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkPermuteAxis_Static.hxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkPermuteAxis_Static.hxx deleted file mode 100644 index 14235a2a3..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkPermuteAxis_Static.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __srtkPermiteAxis_Static_hxx -#define __srtkPermiteAxis_Static_hxx - -#include "srtkPermuteAxesImageFilter.h" - -// This file is intended to contain the definition of static -// membervariables needed by JSON Expand templated image filters. -// It may also contain other member declarations, or other useful -// items that could be specified here, as opposed to the JSON. - -namespace rtk { - namespace simple { - - const unsigned int PermuteAxesImageFilter::DefaultOrder[3] = {0,1,2}; - - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/src/srtkStatisticsImageFilter.cxx b/utilities/SimpleRTK/Code/BasicFilters/src/srtkStatisticsImageFilter.cxx deleted file mode 100644 index 0dd35a23e..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/src/srtkStatisticsImageFilter.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkStatisticsImageFilter.h" - -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkStatisticsImageFilter.h" - -namespace rtk { -namespace simple { - -//---------------------------------------------------------------------------- - -// Functional interface - rtk::simple::MeasurementMap Statistics ( const Image& image ) - { - StatisticsImageFilter filter; - filter.Execute ( image ); - return filter.GetMeasurementMap( ); - } - -// -// Default constructor that initializes parameters -// -StatisticsImageFilter::StatisticsImageFilter () - { - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - } - -double StatisticsImageFilter::QueryValue( const std::string currMeasurement) const - { - const MeasurementMap::const_iterator measurmentContainerIt( this->m_MeasurementMap.find(currMeasurement) ); - if( measurmentContainerIt != this->m_MeasurementMap.end() ) - { - return measurmentContainerIt->second; - } - return itk::NumericTraits< double >::quiet_NaN(); - } -// -// ToString -// -std::string StatisticsImageFilter::ToString() const - { - std::ostringstream out; - out << "rtk::simple::StatisticsImageFilter\n"; - for ( MeasurementMap::const_iterator measurmentContainerIt = this->m_MeasurementMap.begin(); - measurmentContainerIt != this->m_MeasurementMap.end(); - ++measurmentContainerIt) - { - out << - "\t[" << - measurmentContainerIt->first << - "] = " << - measurmentContainerIt->second << - "\n"; - } - return out.str(); - } - - -double StatisticsImageFilter::GetMinimum ( ) const - { - return this->QueryValue( "Minimum" ); - } -double StatisticsImageFilter::GetMaximum ( ) const - { - return this->QueryValue( "Maximum" ); - } -double StatisticsImageFilter::GetMean ( ) const - { - return this->QueryValue( "Mean" ); - } -double StatisticsImageFilter::GetSigma( ) const - { - return this->QueryValue( "Sigma" ); - } -double StatisticsImageFilter::GetVariance( ) const - { - return this->QueryValue( "Variance" ); - } -double StatisticsImageFilter::GetSum( ) const - { - return this->QueryValue( "Sum" ); - } - -rtk::simple::MeasurementMap StatisticsImageFilter::GetMeasurementMap( ) const - { - return this->m_MeasurementMap; - } - -// -// Execute -// - -Image StatisticsImageFilter::Execute ( const Image& image1 ) - { - PixelIDValueEnum type = image1.GetPixelID(); - unsigned int dimension = image1.GetDimension(); - - return this->m_MemberFactory->GetMemberFunction( type, dimension )( image1 ); - } - -//---------------------------------------------------------------------------- - -// -// ExecuteInternal -// -template -Image StatisticsImageFilter::ExecuteInternal ( const Image& inImage1 ) - { - typedef TImageType InputImageType; - typedef InputImageType OutputImageType; - - typename InputImageType::ConstPointer image1 = - dynamic_cast ( inImage1.GetITKBase() ); - - if ( image1.IsNull() ) - { - srtkExceptionMacro( "Unexpected template dispatch error!" ); - } - - typedef itk::StatisticsImageFilter FilterType; - - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput( image1 ); - - this->PreUpdate( filter.GetPointer() ); - - this->m_MeasurementMap.clear(); - - filter->Update(); - - m_MeasurementMap["Minimum"] =filter->GetMinimum(); - m_MeasurementMap["Maximum"] =filter->GetMaximum(); - m_MeasurementMap["Mean"] =filter->GetMean(); - m_MeasurementMap["Sigma"]=filter->GetSigma(); - m_MeasurementMap["Variance"]=filter->GetVariance(); - m_MeasurementMap["Sum"]=filter->GetSum(); - - return Image( filter->GetOutput() ); - } - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.cxx.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.cxx.in deleted file mode 100644 index 156d8738b..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.cxx.in +++ /dev/null @@ -1,212 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -$(include DoNotEditWarning.cxx.in) - -$(include StandardIncludes.cxx.in) -$(include AddExtraIncludes.cxx.in) - -namespace rtk { -namespace simple { - - -namespace { -template -static void ToPixelType( ${constant_type} inPixel, TPixel &outPixel) -{ - outPixel = static_cast( inPixel ); -} - -template -static void ToPixelType( ${constant_type} inPixel, itk::VariableLengthVector &outPixel) -{ - outPixel.Fill( static_cast( inPixel ) ); -} -} - -//----------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -$(include ConstructorSignature.cxx.in) -{ -$(include ConstructorInitializeMembers.cxx.in) -$(include ConstructorMemberFunctionSetup.cxx.in) - -$(include ConstructorVectorPixels.cxx.in) - - this->m_MemberFactory1.reset( new detail::MemberFunctionFactory( this ) ); - this->m_MemberFactory1->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory1->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - - this->m_MemberFactory2.reset( new detail::MemberFunctionFactory( this ) ); - this->m_MemberFactory2->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory2->RegisterMemberFunctions< PixelIDTypeList, 2 > (); -} - -$(include DesctuctorDefinition.cxx.in) - -$(include CustomMethods.cxx.in) - -// -// ToString -// -$(include ToStringSignature.cxx.in) -{ -$(include ToStringBody.cxx.in) -$(include ToStringReturn.cxx.in) -} - -// -// Execute -//$(include ExecuteWithParameters.cxx.in) -$(if members and #members > 0 then -OUT = [[ - -Image ${name}::Execute ( const Image& image1, ${constant_type} constant$(include MemberParameters.in) ) -{ -$(foreach members -$(if (not no_set_method) or (no_set_method == 0) then -OUT = ' this->Set${name} ( ${name:sub(1,1):lower() .. name:sub(2,-1)} );' -end) -) -return this->Execute ( image1, constant ); -} - - -Image ${name}::Execute ( ${constant_type} constant, const Image& image2$(include MemberParameters.in) ) -{ -$(foreach members -$(if (not no_set_method) or (no_set_method == 0) then -OUT = ' this->Set${name} ( ${name:sub(1,1):lower() .. name:sub(2,-1)} );' -end) -) -return this->Execute ( constant, image2 ); -} -]] -end) - - - -$(include ExecuteNoParameters.cxx.in) - -Image ${name}::Execute ( ${constant_type} constant, const Image& image2 ) -{ - - PixelIDValueEnum type = image2.GetPixelID(); - unsigned int dimension = image2.GetDimension(); - - return this->m_MemberFactory1->GetMemberFunction( type, dimension )( constant, image2 ); -} - -Image ${name}::Execute ( const Image& image1, ${constant_type} constant ) -{ - - PixelIDValueEnum type = image1.GetPixelID(); - unsigned int dimension = image1.GetDimension(); - - - return this->m_MemberFactory2->GetMemberFunction( type, dimension )( image1, constant ); -} - -//----------------------------------------------------------------------------- - -// -// ExecuteInternal -// -$(include ExecuteInternalSignature.cxx.in) -{ -$(include ExecuteInternalTypedefs.cxx.in) - -$(include ExecuteInternalGetImagePointers.cxx.in) - -$(include ExecuteInternalITKFilter.cxx.in) - -$(include ExecuteInternalSetITKFilterInputs.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - - -template -Image ${name}::ExecuteInternal ( ${constant_type} constant, const Image& inImage2 ) -{ -$(include ExecuteInternalTypedefs.cxx.in) - - // Get the pointer to the ITK image contained in image2 - typename InputImageType2::ConstPointer image2 = this->CastImageToITK( inImage2 ); - -$(include ExecuteInternalITKFilter.cxx.in) - - typename InputImageType::PixelType c; - itk::NumericTraits::SetLength( c, image2->GetNumberOfComponentsPerPixel() ); - ToPixelType( constant, c ); - filter->SetConstant1( c ); - filter->SetInput2( image2 ); -$(include ExecuteInternalSetITKFilterParameters.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - - -template -Image ${name}::ExecuteInternal ( const Image& inImage1, ${constant_type} constant ) -{ -$(include ExecuteInternalTypedefs.cxx.in) - - // Get the pointer to the ITK image contained in image1 - typename InputImageType::ConstPointer image1 = this->CastImageToITK( inImage1 ); - -$(include ExecuteInternalITKFilter.cxx.in) - - typename InputImageType2::PixelType c; - itk::NumericTraits::SetLength( c, image1->GetNumberOfComponentsPerPixel() ); - ToPixelType( constant, c ); - filter->SetInput1( image1 ); - filter->SetConstant2( c ); -$(include ExecuteInternalSetITKFilterParameters.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - -//----------------------------------------------------------------------------- - -$(include ExecuteInternalVectorImages.cxx.in) -$(include FunctionalAPI.cxx.in) - -Image ${name:gsub("ImageFilter$", "")} ( const Image& image1, ${constant_type} constant$(include MemberParameters.in) ) -{ - ${name} filter; - return filter.Execute ( image1, constant$(for i = 1,#members do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - OUT= OUT .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) - end) ); -} - -Image ${name:gsub("ImageFilter$", "")} ( ${constant_type} constant, const Image& image2$(include MemberParameters.in) ) -{ - ${name} filter; - return filter.Execute ( constant, image2$(for i = 1,#members do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - OUT= OUT .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) - end) ); -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.h.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.h.in deleted file mode 100644 index ed08de6b7..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkBinaryFunctorFilterTemplate.h.in +++ /dev/null @@ -1,69 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk${name}_h -#define __srtk${name}_h - -$(include DoNotEditWarning.h.in) - -#include - -#include "srtkBasicFilters.h" -#include "srtkImageFilter.h" - -namespace rtk { - namespace simple { - -$(include ClassDeclaration.h.in) -$(include PublicDeclarations.h.in) -$(include MemberGetSetDeclarations.h.in) -$(include ClassNameAndPrint.h.in) - -$(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) - - /** Execute the filter with an image and a constant */ - Image Execute ( const Image& image1, ${constant_type} constant ); - Image Execute ( ${constant_type} constant, const Image& image2 ); -$(if members and #members > 0 then -OUT=[[ - - /** Execute the filter on an image and a constant with the given parameters */ - Image Execute ( const Image& image1, ${constant_type} constant$(include MemberParameters.in) ); - Image Execute ( ${constant_type} constant, const Image& image2$(include MemberParameters.in) );]] -end) - -$(include ExecuteInternalMethod.h.in) - -$(include MemberFunctionDispatch.h.in) - typedef Image (Self::*MemberFunction1Type)( ${constant_type} constant, const Image& image2 ); - template Image ExecuteInternal ( ${constant_type} constant, const Image& image2 ); - friend struct detail::MemberFunctionAddressor; - std::auto_ptr > m_MemberFactory1; - - typedef Image (Self::*MemberFunction2Type)( const Image& image1, ${constant_type} constant ); - template Image ExecuteInternal ( const Image& image1, ${constant_type} constant ); - friend struct detail::MemberFunctionAddressor; - std::auto_ptr > m_MemberFactory2; - -$(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) - -$(include FunctionalAPI.h.in) - SRTKBasicFilters_EXPORT Image ${name:gsub("ImageFilter$", "")} ( const Image& image1, ${constant_type} constant$(include MemberParametersWithDefaults.in) ); - SRTKBasicFilters_EXPORT Image ${name:gsub("ImageFilter$", "")} ( ${constant_type} constant, const Image& image2$(include MemberParametersWithDefaults.in) ); - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.cxx.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.cxx.in deleted file mode 100644 index fe3f45684..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.cxx.in +++ /dev/null @@ -1,248 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -$(include DoNotEditWarning.cxx.in) - -$(include StandardIncludes.cxx.in) -$(include AddExtraIncludes.cxx.in) - -namespace rtk { -namespace simple { - -//----------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -$(include ConstructorSignature.cxx.in) -{ -$(include ConstructorInitializeMembers.cxx.in) - - typedef ${pixel_types2} PixelIDTypeList2; - - - this->m_DualMemberFactory.reset( new detail::DualMemberFunctionFactory( this ) ); - - this->m_DualMemberFactory->RegisterMemberFunctions< PixelIDTypeList, PixelIDTypeList2, 3 > (); - this->m_DualMemberFactory->RegisterMemberFunctions< PixelIDTypeList, PixelIDTypeList2, 2 > (); - -$(if vector_pixel_types_by_component then - OUT=[[ typedef ${vector_pixel_types_by_component} VectorByComponentsPixelIDTypeList; -]] - if vector_pixel_types_by_component2 then - OUT = OUT..[[ typedef ${vector_pixel_types_by_component2} VectorByComponentsPixelIDTypeList2; -]] - else - OUT = OUT..[[ typedef PixelIDTypeList2 VectorByComponentsPixelIDTypeList2; -]] - end - OUT = OUT..[[ - typedef detail::DualExecuteInternalVectorAddressor VectorAddressorType; - this->m_DualMemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, VectorByComponentsPixelIDTypeList2, 3, VectorAddressorType> (); - this->m_DualMemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, VectorByComponentsPixelIDTypeList2, 2, VectorAddressorType> ();]] -end) - - -} - -$(include DesctuctorDefinition.cxx.in) - -// -// ToString -// -$(include ToStringSignature.cxx.in) -{ -$(include ToStringBody.cxx.in) -$(include ToStringReturn.cxx.in) -} - -$(include CustomMethods.cxx.in) - -// -// Execute -//$(include ExecuteWithParameters.cxx.in) -Image ${name}::Execute ( $(include ImageParameters.in) ) -{ - PixelIDValueEnum type1 = image1.GetPixelID(); - unsigned int dimension = image1.GetDimension(); - -$(if number_of_inputs == 2 then -OUT=[[ - PixelIDValueEnum type2 = image2.GetPixelID(); - // todo need better error handling and potential type conversion - if ( dimension != image2.GetDimension() || - image1.GetWidth() != image2.GetWidth() || - image1.GetHeight() != image2.GetHeight() || - image1.GetDepth() != image2.GetDepth() ) - { - sitkExceptionMacro ( "Both images for ${name} don't match type or dimension!" ); - }]] -else -OUT=[[ - ${custom_type2}]] - -end) - - return this->m_DualMemberFactory->GetMemberFunction( type1, type2, dimension )( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT .. ', ' - end - OUT= OUT .. 'image' .. inum - end) ); -} - - -//----------------------------------------------------------------------------- - -// -// ExecuteInternal -// -template -Image ${name}::DualExecuteInternal ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT.. ', ' - end - OUT= OUT .. 'const Image& inImage' .. inum - end ) ) -{ - // Define the input and output image types - typedef TImageType InputImageType; - typedef TImageType2 InputImageType2; - - $(if output_image_type then - OUT=[[//Define output image type - typedef ${output_image_type} OutputImageType;]] - elseif output_pixel_type then - OUT=[[// Define output image type -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#else - typedef itk::Image< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#endif - ]] - else - OUT=[[typedef InputImageType OutputImageType;]] - end) - -$(include ExecuteInternalGetImagePointers.cxx.in) - -$(include ExecuteInternalITKFilter.cxx.in) - -$(include ExecuteInternalSetITKFilterInputs.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - -$(if vector_pixel_types_by_component then -OUT=[[ -// -// Dispatched methods to call DualExecuteInternal on each component of the VectorImage -// -template Image -${name}::DualExecuteInternalVector ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT.. ', ' - end - OUT= OUT .. 'const Image& inImage' .. inum - end ) ) -{ - typedef TImageType VectorInputImageType; - typedef typename VectorInputImageType::InternalPixelType ComponentType; -#ifdef RTK_USE_CUDA - typedef typename itk::CudaImage ComponentImageType; -#else - typedef typename itk::Image ComponentImageType; -#endif - - // we must define the input and output image types - // they should be the same as the scalar execute internal method - typedef ComponentImageType InputImageType; -]] -if vector_pixel_types_by_component2 then OUT = OUT..[[ - typedef TImageType2 VectorInputImageType2; - typedef typename VectorInputImageType2::InternalPixelType ComponentType2; -#ifdef RTK_USE_CUDA - typedef typename itk::CudaImage ComponentImageType2; -#else - typedef typename itk::Image ComponentImageType2; -#endif - typedef ComponentImageType2 InputImageType2;]] -else - OUT= OUT..[[ - typedef TImageType2 InputImageType2;]] -end -if output_image_type then -OUT=OUT..[[ - //Define output image type - typedef ${output_image_type} OutputImageType;]] -elseif output_pixel_type then -OUT=OUT..[[ - // Define output image type -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#else - typedef itk::Image< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#endif - ]] -else - OUT=OUT..[[ - // Define output image type - typedef InputImageType OutputImageType;]] -end - -OUT=OUT..[[ - - // Get the pointer to the ITK image contained in image1 - typename VectorInputImageType::ConstPointer image1 = - this->CastImageToITK( inImage1 ); - - typedef itk::VectorIndexSelectionCastImageFilter< VectorInputImageType, ComponentImageType > ComponentExtratorType; - typename ComponentExtratorType::Pointer extractor = ComponentExtratorType::New(); - extractor->SetInput( image1 ); - - typedef itk::ComposeImageFilter ToVectorFilterType; - typename ToVectorFilterType::Pointer toVector = ToVectorFilterType::New(); - - unsigned int numComps = image1->GetNumberOfComponentsPerPixel(); - for ( unsigned int i = 0; i < numComps; ++i ) - { - extractor->SetIndex( i ); - extractor->Update(); - - Image tmp = this->DualExecuteInternal( Image( extractor->GetOutput() )$(for inum=2,number_of_inputs do - OUT=OUT .. ', inImage' .. inum - end) ); - - typename OutputImageType::ConstPointer tempITKImage = this->CastImageToITK( tmp ); - - toVector->SetInput( i, tempITKImage ); - } - - toVector->Update(); - - return Image( toVector->GetOutput() ); -} - -//----------------------------------------------------------------------------- -]]end) - - -//----------------------------------------------------------------------------- - -$(include FunctionalAPI.cxx.in) - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.h.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.h.in deleted file mode 100644 index 53c0386e6..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkDualImageFilterTemplate.h.in +++ /dev/null @@ -1,60 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk${name}_h -#define __srtk${name}_h - -$(include DoNotEditWarning.h.in) - -#include - -#include "srtkImageFilter.h" -#include "srtkDualMemberFunctionFactory.h" -#include "srtkBasicFilters.h" - -namespace rtk { - namespace simple { - -$(include ClassDeclaration.h.in) -$(include PublicDeclarations.h.in) -$(include MemberGetSetDeclarations.h.in) -$(include ClassNameAndPrint.h.in) - -$(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) - - private: - /** Setup for member function dispatching */ - typedef Image (Self::*MemberFunctionType)( $(include ImageParameters.in) ); - - friend struct detail::DualExecuteInternalAddressor; - template Image DualExecuteInternal ( $(include ImageParameters.in) ); -$(if vector_pixel_types_by_component then -OUT=[[ - friend struct detail::DualExecuteInternalVectorAddressor; - template Image DualExecuteInternalVector ( $(include ImageParameters.in) );]] -end) - - std::auto_ptr > m_DualMemberFactory; - - -$(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) - - -$(include FunctionalAPI.h.in) - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.cxx.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.cxx.in deleted file mode 100644 index b0b18f637..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.cxx.in +++ /dev/null @@ -1,79 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -$(include DoNotEditWarning.cxx.in) - -$(include StandardIncludes.cxx.in) -$(include AddExtraIncludes.cxx.in) - -namespace rtk { -namespace simple { - -//----------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -$(include ConstructorSignature.cxx.in) -{ -$(include ConstructorInitializeMembers.cxx.in) -$(include ConstructorMemberFunctionSetup.cxx.in) - -$(include ConstructorVectorPixels.cxx.in) -} -$(include DesctuctorDefinition.cxx.in) - -$(include CustomMethods.cxx.in) - -// -// ToString -// -$(include ToStringSignature.cxx.in) -{ -$(include ToStringBody.cxx.in) -$(include ToStringReturn.cxx.in) -} - -// -// Execute -//$(include ExecuteWithParameters.cxx.in) -$(include ExecuteNoParameters.cxx.in) - -//----------------------------------------------------------------------------- - -// -// ExecuteInternal -// -$(include ExecuteInternalSignature.cxx.in) -{ -$(include ExecuteInternalTypedefs.cxx.in) - -$(include ExecuteInternalGetImagePointers.cxx.in) - -$(include ExecuteInternalITKFilter.cxx.in) - -$(include ExecuteInternalSetITKFilterInputs.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - -//----------------------------------------------------------------------------- - -$(include ExecuteInternalVectorImages.cxx.in) -$(include FunctionalAPI.cxx.in) - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.h.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.h.in deleted file mode 100644 index 933a1ee89..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageFilterTemplate.h.in +++ /dev/null @@ -1,48 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk${name}_h -#define __srtk${name}_h - -$(include DoNotEditWarning.h.in) - -#include - -#include "srtkBasicFilters.h" -#include "srtkImageFilter.h" - -namespace rtk { - namespace simple { - -$(include ClassDeclaration.h.in) -$(include PublicDeclarations.h.in) -$(include MemberGetSetDeclarations.h.in) -$(include ClassNameAndPrint.h.in) - -$(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) - -$(include ExecuteInternalMethod.h.in) - -$(include MemberFunctionDispatch.h.in) - -$(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) - - -$(include FunctionalAPI.h.in) - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.cxx.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.cxx.in deleted file mode 100644 index 7eb65896c..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.cxx.in +++ /dev/null @@ -1,112 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -$(include DoNotEditWarning.cxx.in) - -$(include StandardIncludes.cxx.in) -$(include AddExtraIncludes.cxx.in) - -namespace rtk { -namespace simple { - -//----------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -$(include ConstructorSignature.cxx.in) -{ -$(include ConstructorInitializeMembers.cxx.in) -$(include ConstructorMemberFunctionSetup.cxx.in) - -$(include ConstructorVectorPixels.cxx.in) -} -$(include DesctuctorDefinition.cxx.in) -// -// ToString -// -$(include ToStringSignature.cxx.in) -{ -$(include ToStringBody.cxx.in) -$(include ToStringReturn.cxx.in) -} - -$(include CustomMethods.cxx.in) - -// -// Execute -//$(include ExecuteWithParameters.cxx.in) - - -Image ${name}::Execute ( $(include ImageParameters.in) ) -{ - - PixelIDValueEnum type = m_OutputPixelType; - unsigned int dimension = m_Size.size(); - - $(for inum=2,number_of_inputs do - OUT= OUT .. '\n if ( type != image' .. inum .. '.GetPixelIDValue() || dimension != image' .. inum .. '.GetDimension() ) { srtkExceptionMacro ( "Image' .. inum .. ' for ${name} doesnt match type or dimension!" ); }' - end) - - return this->m_MemberFactory->GetMemberFunction( type, dimension )( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT .. ', ' - end - OUT= OUT .. 'image' .. inum - end) ); -} -//----------------------------------------------------------------------------- - -// -// ExecuteInternal -// -$(include ExecuteInternalSignature.cxx.in) -{ -$(include ExecuteInternalTypedefs.cxx.in) - -$(include ExecuteInternalGetImagePointers.cxx.in) - -$(include ExecuteInternalITKFilter.cxx.in) - -$(include ExecuteInternalSetITKFilterInputs.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - -//----------------------------------------------------------------------------- - -$(include ExecuteInternalVectorImages.cxx.in) -// -// Function to run the Execute method of this filter -// -Image ${name:gsub("ImageSource$", "Source")} ( $(include ImageParameters.in)$(include MemberParameters.in) ) -{ - ${name} filter; - return filter.Execute ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT..', ' - end - OUT=OUT .. 'image' .. inum - end)$(for i = 1,#members do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - OUT= OUT .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) - end) ); -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.h.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.h.in deleted file mode 100644 index b8a5dbc7c..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkImageSourceTemplate.h.in +++ /dev/null @@ -1,66 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk${name}_h -#define __srtk${name}_h - -$(include DoNotEditWarning.h.in) - -#include - -#include "srtkBasicFilters.h" -#include "srtkImageFilter.h" - -namespace rtk { - namespace simple { - -$(include ClassDeclaration.h.in) -$(include PublicDeclarations.h.in) - - -$(include MemberGetSetDeclarations.h.in) -$(include ClassNameAndPrint.h.in) - -$(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) - -$(include ExecuteInternalMethod.h.in) - -$(include MemberFunctionDispatch.h.in) - -$(include PrivateMemberDeclarations.h.in) - - -$(include ClassEnd.h.in) - - - - /** -$(if briefdescription and (briefdescription:len() > 0) then - OUT=OUT..' * \\brief ${briefdescription}' -else - OUT=OUT..' * \\brief rtk::simple::${name} Procedural Interface' -end) - * - * This function directly calls the execute method of ${name} - * in order to support a procedural API - * - * \sa rtk::simple::${name} for the object oriented interface - */ -SRTKBasicFilters_EXPORT Image ${name:gsub("ImageSource$", "Source")} ( $(include ImageParameters.in)$(include MemberParametersWithDefaults.in) ); - } -} -#endif diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.cxx.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.cxx.in deleted file mode 100644 index b28c7b022..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.cxx.in +++ /dev/null @@ -1,79 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -$(include DoNotEditWarning.cxx.in) - -$(include StandardIncludes.cxx.in) -$(include AddExtraIncludes.cxx.in) - -namespace rtk { -namespace simple { - -//----------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -$(include ConstructorSignature.cxx.in) -{ -$(include ConstructorInitializeMembers.cxx.in) -$(include ConstructorMemberFunctionSetup.cxx.in) - -$(include ConstructorVectorPixels.cxx.in) -} -$(include DesctuctorDefinition.cxx.in) - -$(include CustomMethods.cxx.in) - -// -// ToString -// -$(include ToStringSignature.cxx.in) -{ -$(include ToStringBody.cxx.in) -$(include ToStringReturn.cxx.in) -} - -// -// Execute -//$(include ExecuteWithParameters.cxx.in) -$(include ExecuteNoParameters.cxx.in) - -//----------------------------------------------------------------------------- - -// -// ExecuteInternal -// -$(include ExecuteInternalSignature.cxx.in) -{ -$(include ExecuteInternalTypedefs.cxx.in) - -$(include ExecuteInternalGetImagePointers.cxx.in) - -$(include ExecuteInternalITKFilter.cxx.in) - -$(include ExecuteInternalSetITKFilterInputs.cxx.in) -$(include ExecuteInternalUpdateAndReturn.cxx.in) -} - -//----------------------------------------------------------------------------- - -$(include ExecuteInternalVectorImages.cxx.in) -$(include RTKFunctionalAPI.cxx.in) - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.h.in b/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.h.in deleted file mode 100644 index 2d469e0a5..000000000 --- a/utilities/SimpleRTK/Code/BasicFilters/templates/srtkRTKImageFilterTemplate.h.in +++ /dev/null @@ -1,48 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk${name}_h -#define __srtk${name}_h - -$(include DoNotEditWarning.h.in) - -#include - -#include "srtkBasicFilters.h" -#include "srtkImageFilter.h" - -namespace rtk { - namespace simple { - -$(include ClassDeclaration.h.in) -$(include PublicDeclarations.h.in) -$(include MemberGetSetDeclarations.h.in) -$(include ClassNameAndPrint.h.in) - -$(include ExecuteMethodNoParameters.h.in)$(include ExecuteMethodWithParameters.h.in)$(include CustomMethods.h.in) - -$(include ExecuteInternalMethod.h.in) - -$(include MemberFunctionDispatch.h.in) - -$(include PrivateMemberDeclarations.h.in)$(include ClassEnd.h.in) - - -$(include RTKFunctionalAPI.h.in) - } -} -#endif diff --git a/utilities/SimpleRTK/Code/CMakeLists.txt b/utilities/SimpleRTK/Code/CMakeLists.txt deleted file mode 100644 index eb4d6cf20..000000000 --- a/utilities/SimpleRTK/Code/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(Common) -add_subdirectory(BasicFilters) -add_subdirectory(IO) diff --git a/utilities/SimpleRTK/Code/Common/CMakeLists.txt b/utilities/SimpleRTK/Code/Common/CMakeLists.txt deleted file mode 100644 index f755eabc1..000000000 --- a/utilities/SimpleRTK/Code/Common/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_subdirectory( src ) - -configure_file( "src/srtkConfigure.h.in" "include/srtkConfigure.h" ) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/srtkConfigure.h" - DESTINATION "${SimpleRTK_INSTALL_INCLUDE_DIR}" - COMPONENT Development) - -configure_file("src/srtkVersionConfig.h.in" "include/srtkVersionConfig.h" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/srtkVersionConfig.h" - DESTINATION "${SimpleRTK_INSTALL_INCLUDE_DIR}" - COMPONENT Development) diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/FunctionTraits.h b/utilities/SimpleRTK/Code/Common/include/Ancillary/FunctionTraits.h deleted file mode 100644 index 339dbd8ee..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/FunctionTraits.h +++ /dev/null @@ -1,108 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __FunctionTraits_h -#define __FunctionTraits_h - -namespace detail { - -template struct FunctionTraits; - -template -struct FunctionTraits { - static const unsigned int arity = 0; - typedef C ClassType; - typedef R ResultType; -}; - - -template -struct FunctionTraits { - static const unsigned int arity = 1; - typedef C ClassType; - typedef R ResultType; - typedef A0 Argument0Type; -}; - - -template -struct FunctionTraits { - static const unsigned int arity = 2; - typedef C ClassType; - typedef R ResultType; - typedef A0 Argument0Type; - typedef A1 Argument1Type; -}; - - -template -struct FunctionTraits { - static const unsigned int arity = 3; - typedef C ClassType; - typedef R ResultType; - typedef A0 Argument0Type; - typedef A1 Argument1Type; - typedef A2 Argument2Type; -}; - -template -struct FunctionTraits { - static const unsigned int arity = 4; - typedef C ClassType; - typedef R ResultType; - typedef A0 Argument0Type; - typedef A1 Argument1Type; - typedef A2 Argument2Type; - typedef A3 Argument3Type; -}; - -template -struct FunctionTraits { - static const unsigned int arity = 5; - typedef C ClassType; - typedef R ResultType; - typedef A0 Argument0Type; - typedef A1 Argument1Type; - typedef A2 Argument2Type; - typedef A3 Argument3Type; - typedef A4 Argument4Type; -}; - -} - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/TypeList.h b/utilities/SimpleRTK/Code/Common/include/Ancillary/TypeList.h deleted file mode 100644 index e0cb34622..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/TypeList.h +++ /dev/null @@ -1,477 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -// This file is based off of the work done in the Loki library but is -// substantailly modified. It's a good book buy it. - -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2001 by Andrei Alexandrescu -// This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// The author or Addison-Welsey Longman make no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - - -#ifndef __TypeList_H__ -#define __TypeList_H__ - -namespace typelist -{ - - -/** \class TypeList - * \brief The building block of typelists of any length - * - * A TypeList is a type, not an object. It enables complex - * compile-time manipulation of a set of types. - * - * Defines nested types: - * Head (first element, a non-typelist type by convention) - * Tail (second element, can be another typelist) - */ -template -struct TypeList -{ - typedef H Head; - typedef T Tail; -}; - -/** \class NullType - * \brief a empty type to indicate end of list - */ -struct NullType {}; - - - -/**\class MakeTypeList - * \brief Generates a TypeList from it's template arguments - * - * The arguments are type names. - * \code - * MakeTypeList::Type - * \endcode - * returns a typelist that contans the types T1, T2, T3 - * - * Example: - * \code - * typedef typelist::MakeTypeList< int, char, short>::Type MyTypeList; - * \endcode - * - */ -template -< - typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, - typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, - typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, - typename T10 = NullType, typename T11 = NullType, typename T12 = NullType, - typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, - typename T16 = NullType, typename T17 = NullType, typename T18 = NullType, - typename T19 = NullType, typename T20 = NullType, typename T21 = NullType, - typename T22 = NullType, typename T23 = NullType, typename T24 = NullType, - typename T25 = NullType, typename T26 = NullType, typename T27 = NullType, - typename T28 = NullType, typename T29 = NullType, typename T30 = NullType -> -struct MakeTypeList -{ -private: - typedef typename MakeTypeList - < - T2, T3, T4, - T5, T6, T7, - T8, T9, T10, - T11, T12, T13, - T14, T15, T16, - T17, T18, T19, - T20, T21, T22, - T23, T24, T25, - T26, T27, T28, - T29, T30 - >::Type TailType; -public: - typedef TypeList< T1, TailType > Type; -}; -template <> -struct MakeTypeList<> -{ - typedef NullType Type; -}; - - - -template struct Length; -/**\class Length - * \brief Computes the length of a typelist - * - * Example: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList; - * int len = typelist::Length::Result; - * \endcode - * returns a compile-time constant containing the length of TTypeList, - * not counting the end terminator (which by convention is NullType) - * - */ -template -struct Length< TypeList > -{ - enum { Result = 1 + Length::Result }; -}; - -/** \cond TYPELIST_IMPLEMENTATION */ -template <> struct Length -{ - enum { Result = 0 }; -}; -/** \endcond */ - - - -/**\class TypeAt - * \brief Finds the type at a given index in a typelist - * - * Example: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList; - * typelist::TypeAt::Result intVariable; - * \endcode - * - * returns the type's position 'index' in TTypeList - * If you pass an out-of-bounds index, the result is a compile-time - * error - * - */ -template struct TypeAt; - -template -struct TypeAt, 0> -{ - typedef Head Result; -}; - -template -struct TypeAt, i> -{ - typedef typename TypeAt::Result Result; -}; - -template < unsigned int i> -struct TypeAt -{ - typedef NullType Result; -}; - - -template struct Append; -/**\class Append - * \brief Appends a type or a typelist to another - * - * Example 1: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList1; - * typedef typelist::MakeTypeList::Type MyTypeList2; - * typedef typelist::Append::Type MyCombinedList; - * \endcode - * - * Example 2: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList; - * typedef typelist::Append::Type MyAddedTypeList; - * \endcode - * - * returns a typelist that is TTypeList1 followed by TTypeList2 - * terminated by NullType. TTypeList2 may be another typelist or a - * single type. - * - */ -template -struct Append, T> -{ - typedef TypeList::Type> Type; -}; - -/** \cond TYPELIST_IMPLEMENTATION */ -template <> struct Append -{ - typedef NullType Type; -}; -template struct Append -{ - typedef TypeList Type; -}; -template struct Append -{ - typedef TypeList Type; -}; -template -struct Append > -{ - typedef TypeList Type; -}; -template -struct Append, NullType> -{ - typedef TypeList Type; -}; -/** \endcond */ - -/**\class IndexOf - * \brief Finds the index of a type in a typelist - * - * Example: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList; - * int index = typelist::IndexOf::Result; - * \endcode - * - * IndexOf::Result - * returns the position of T in TList, or NullType if T is not found in TList - */ -template struct IndexOf; -template -struct IndexOf -{ - enum { Result = -1 }; -}; -template -struct IndexOf, TType> -{ - enum { Result = 0 }; -}; -template -struct IndexOf, TType> -{ -private: - enum { temp = IndexOf::Result }; -public: - enum { Result = (temp == -1 ? -1 : 1 + temp) }; -}; - - -/**\class HasType - * \brief Queries the typelist for a type - * - * Example: - * \code - * typedef typelist::MakeTypeList::Type MyTypeList; - * bool query = typelist::HasType::Result; - * \endcode - * - * HasType::Result - * evaluates to true if TList contains T, false otherwise. - */ -template struct HasType; -template -struct HasType -{ - enum { Result = false }; -}; -template -struct HasType, TType> { - enum { Result = true }; -}; -template -struct HasType, TType> { - enum { Result = HasType::Result }; -}; - - -/**\class Visit - * \brief Runs a templated predicate on each type in the list - * - * \code - * struct Predicate - * { - * template - * void operator()( void ) const - * { std::cout << typeid(TType).name() << std::endl; } - * } - * - * typedef typelist::MakeTypeList::Type MyTypeList; - * typelist::Visit( Predicate() ); - * - * \endcode - * - * - */ -template -struct Visit -{ - template < class Predicate > - void operator()( Predicate &visitor ) - { - typedef typename TTypeList::Head Head; - typedef typename TTypeList::Tail Tail; - visitor.CLANG_TEMPLATE operator()( ); - Visit next; - next.CLANG_TEMPLATE operator()( visitor ); - } - template < class Predicate > - void operator()( const Predicate &visitor ) - { - typedef typename TTypeList::Head Head; - typedef typename TTypeList::Tail Tail; - visitor.CLANG_TEMPLATE operator()( ); - Visit next; - next.CLANG_TEMPLATE operator()( visitor ); - } -}; -template <> struct Visit < NullType> -{ - template < class Predicate > - void operator()( const Predicate &) - {} -}; - - -template < typename TLeftTypeList, typename TRightTypeList > -struct DualVisitImpl; - -/**\class DualVisit - * \brief Runs a templated predicate on each combination of the types - * on the two lists - * - * \code - * struct Predicate - * { - * template - * void operator()( void ) const - * { std::cout << typeid(TType1).name() << " " << typeid(TType2.name() << - * std::endl; } - * } - * - * typedef typelist::MakeTypeList::Type MyTypeList; - * typelist::DualVisit( Predicate() ); - * - * \endcode - * - */ -template < typename TLeftTypeList, typename TRightTypeList > -struct DualVisit -{ - - template - void operator()( Visitor &visitor ) const - { - DualVisitImpl impl; - return impl.CLANG_TEMPLATE operator()( visitor ); - } - - template - void operator()( const Visitor &visitor ) const - { - DualVisitImpl impl; - return impl.CLANG_TEMPLATE operator()( visitor ); - } -}; - -/** \cond TYPELIST_IMPLEMENTATION -* -* The procedural algorithm for this code is: -* \code -* foreach leftType in TLeftTypList -* foreach rightType in TRightTypeList -* visit( leftType, rightTYpe ) -* \endcode -* -* Where inner loop has been unwound in to a tail recursive templated -* meta-function visitRHS. The outer loop is recursively implemented in -* the operator(). -*/ -template < typename TLeftTypeList, typename TRightTypeList > -struct DualVisitImpl -{ - typedef typename TLeftTypeList::Head LeftHead; - typedef typename TRightTypeList::Head RightHead; - typedef typename TLeftTypeList::Tail LeftTail; - typedef typename TRightTypeList::Tail RightTail; - - template - void operator()( Visitor &visitor ) const - { - DualVisitImpl< TLeftTypeList, TRightTypeList> goRight; - goRight.visitRHS( visitor ); - - DualVisitImpl goLeft; - goLeft.CLANG_TEMPLATE operator()( visitor ); - } - - template - void operator()( const Visitor &visitor ) const - { - DualVisitImpl< TLeftTypeList, TRightTypeList> goRight; - goRight.visitRHS( visitor ); - - DualVisitImpl goLeft; - goLeft.CLANG_TEMPLATE operator()( visitor ); - } - - template - void visitRHS( Visitor &visitor ) const - { - visitor.CLANG_TEMPLATE operator()( ); - - DualVisitImpl< TLeftTypeList, RightTail> goRight; - goRight.CLANG_TEMPLATE visitRHS( visitor ); - } - template - void visitRHS( const Visitor &visitor ) const - { - visitor.CLANG_TEMPLATE operator()( ); - - DualVisitImpl< TLeftTypeList, RightTail> goRight; - goRight.CLANG_TEMPLATE visitRHS( visitor ); - } -}; - -template < typename TRightTypeList > -struct DualVisitImpl< typelist::NullType, TRightTypeList > -{ - template - void operator()( const Visitor & ) const - { } -}; -template < typename TLeftTypeList > -struct DualVisitImpl< TLeftTypeList, typelist::NullType > -{ - template - void operator()( const Visitor & ) const - { } - - template - void visitRHS( const Visitor & ) const {} -}; - -template < > -struct DualVisitImpl< typelist::NullType, typelist::NullType > -{ - template - void operator()( const Visitor & ) const - { } -}; -/**\endcond*/ - -} - -#endif // __TypeList_H__ diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.cxx b/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.cxx deleted file mode 100644 index dd322d812..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.cxx +++ /dev/null @@ -1,403 +0,0 @@ -/* - * hashlib++ - a simple hash library for C++ - * - * Copyright (c) 2007-2010 Benjamin Grüdelbach - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//---------------------------------------------------------------------- - -/* - * The hashlib++ MD5 implementation is derivative from the sourcecode - * published in RFC 1321 - * - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD5 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD5 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -//---------------------------------------------------------------------- - -/** - * @file hl_md5.cpp - * @brief This file contains the implementation of the MD5 class - * @date Mo 17 Sep 2007 - */ - -//---------------------------------------------------------------------- -//hashlib++ includes -#include "hl_md5.h" - -//---------------------------------------------------------------------- -// defines - -// Constants for MD5Transform routine. -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* - * ROTATE_LEFT rotates x left n bits. - * cast to unsigned int to guarantee support for 64Bit System - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | (( (unsigned int) x) >> (32-(n)))) - -/* -FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. -Rotation is separate from addition to prevent recomputation. -*/ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (unsigned long int)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (unsigned long int)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (unsigned long int)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (unsigned long int)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -//---------------------------------------------------------------------- -//private member-functions - -/** - * @brief Basic transformation. Transforms state based on block. - * @param state state to transform - * @param block block to transform - */ -void MD5::MD5Transform (unsigned long int state[4], unsigned char block[64]) -{ - unsigned long int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode (x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* - * Zeroize sensitive information. - */ - MD5_memset ((POINTER)x, 0, sizeof (x)); -} - -/** - * @brief Encodes input data - * @param output Encoded data as OUT parameter - * @param input Input data - * @param len The length of the input assuming it is a - * multiple of 4 - */ -void MD5::Encode (unsigned char *output, unsigned long int *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/** - * @brief Decodes input data into output - * @param output Decoded data as OUT parameter - * @param input Input data - * @param len The length of the input assuming it is a - * multiple of 4 - */ -void MD5::Decode (unsigned long int *output, unsigned char *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((unsigned long int)input[j]) | - (((unsigned long int)input[j+1]) << 8) | - (((unsigned long int)input[j+2]) << 16) | - (((unsigned long int)input[j+3]) << 24); -} - -/** - * @brief internal memory management - * @param output OUT parameter where POINTER is a unsigned - * char* - * @param input Data to copy where POINTER is a unsigned char* - * @param len The length of the data - */ -void MD5::MD5_memcpy (POINTER output, POINTER input, unsigned int len) -{ - /* - * TODO-Note: Replace "for loop" with standard memcpy if possible. - */ - unsigned int i; - - for (i = 0; i < len; i++) - output[i] = input[i]; -} - -/** - * @brief internal memory management - * @param output OUT parameter where POINTER is an unsigned - * char* - * @param value Value to fill the memory with - * @param len The length of the data - * - */ -void MD5::MD5_memset (POINTER output,int value,unsigned int len) -{ - /* - * TODO-Note: Replace "for loop" with standard memset if possible. - */ - unsigned int i; - for (i = 0; i < len; i++) - ((char *)output)[i] = (char)value; -} - -//---------------------------------------------------------------------- -//public member-functions - -/** - * @brief Initialization begins an operation, - * writing a new context - * @param context The HL_MD5_CTX context to initialize - */ -void MD5::MD5Init (HL_MD5_CTX *context) -{ - context->count[0] = context->count[1] = 0; - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/** - * @brief Block update operation. Continues an md5 - * message-digest operation, processing another - * message block, and updating the context. - * @param context The HL_MD5_CTX context to update - * @param input The data to write into the context - * @param inputLen The length of the input data - */ -void MD5::MD5Update (HL_MD5_CTX *context, unsigned char *input, unsigned int inputLen) -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ( (context->count[0] += ((unsigned long int)inputLen << 3)) - < ((unsigned long int)inputLen << 3)) - context->count[1]++; - - context->count[1] += ((unsigned long int)inputLen >> 29); - partLen = 64 - index; - - /* - * Transform as many times as possible. - */ - if (inputLen >= partLen) - { - MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD5Transform (context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - MD5_memcpy ((POINTER)&context->buffer[index], - (POINTER)&input[i], - inputLen-i); -} - -/** - * @brief Finalization ends the md5 message-digest - * operation, writing the the message digest and - * zeroizing the context. - * @param digest This is an OUT parameter which contains - * the created hash after the method returns - * @param context The context to finalize - */ -void MD5::MD5Final (unsigned char digest[16], HL_MD5_CTX *context) -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode (bits, context->count, 8); - - /* - * Pad out to 56 mod 64. - */ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update (context, bits, 8); - - /* Store state in digest */ - Encode (digest, context->state, 16); - - /* - * Zeroize sensitive information. - */ - MD5_memset ((POINTER)context, 0, sizeof (*context)); -} - -//---------------------------------------------------------------------- -//EOF diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.h b/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.h deleted file mode 100644 index a97142ff4..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_md5.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * hashlib++ - a simple hash library for C++ - * - * Copyright (c) 2007-2010 Benjamin Grüdelbach - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//---------------------------------------------------------------------- - -/* - * The hashlib++ MD5 implementation is derivative from the sourcecode - * published in RFC 1321 - * - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD5 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD5 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -//---------------------------------------------------------------------- - -/** - * @file hl_md5.h - * @brief This file contains the declaration of the MD5 class - * @date Mo 17 Sep 2007 - */ - -//---------------------------------------------------------------------- -//include protection -#ifndef MD5_H -#define MD5_H - -//---------------------------------------------------------------------- -//STL includes -#include - -// included for import export macros -#include "srtkCommon.h" - -//---------------------------------------------------------------------- -//hl includes -// #include "hl_types.h" -typedef unsigned char hl_uint8; -typedef unsigned short int hl_uint16; -typedef unsigned int hl_uint32; - -//---------------------------------------------------------------------- -//typedefs -typedef hl_uint8 *POINTER; - -/** - * @brief this struct represents a MD5-hash context. - */ -typedef struct -{ - /** state (ABCD) */ - unsigned long int state[4]; - - /** number of bits, modulo 2^64 (lsb first) */ - unsigned long int count[2]; - - /** input buffer */ - unsigned char buffer[64]; -} HL_MD5_CTX; - -//---------------------------------------------------------------------- - -/** - * @brief This class represents the implementation of - * the md5 message digest algorithm. - * - * Basically the class provides three public member-functions - * to create a hash: MD5Init(), MD5Update() and MD5Final(). - * If you want to create a hash based on a string or file quickly - * you should use the md5wrapper class instead of MD5. - */ -class SRTKCommon_EXPORT MD5 -{ - - private: - - /** - * @brief Basic transformation. Transforms state based on block. - * @param state state to transform - * @param block block to transform - */ - void MD5Transform (unsigned long int state[4], unsigned char block[64]); - - /** - * @brief Encodes input data - * @param output Encoded data as OUT parameter - * @param input Input data - * @param len The length of the input assuming it is a - * multiple of 4 - */ - void Encode (unsigned char* output, - unsigned long int *input, - unsigned int len); - - /** - * @brief Decodes input data into output - * @param output Decoded data as OUT parameter - * @param input Input data - * @param len The length of the input assuming it is a - * multiple of 4 - */ - void Decode (unsigned long int *output, - unsigned char *input, - unsigned int len); - - /** - * @brief internal memory management - * @param output OUT parameter where POINTER is an unsigned - * char* - * @param input Data to copy where POINTER is a unsigned char* - * @param len The length of the data - */ - void MD5_memcpy (POINTER output, POINTER input, unsigned int len); - - /** - * @brief internal memory management - * @param output OUT parameter where POINTER is an unsigned - * char* - * @param value Value to fill the memory with - * @param len The length of the data - * - */ - void MD5_memset (POINTER output, int value, unsigned int len); - - public: - - /** - * @brief Initialization begins an operation, - * writing a new context - * @param context The HL_MD5_CTX context to initialize - */ - void MD5Init (HL_MD5_CTX* context); - - /** - * @brief Block update operation. Continues an md5 - * message-digest operation, processing another - * message block, and updating the context. - * @param context The HL_MD5_CTX context to update - * @param input The data to write into the context - * @param inputLen The length of the input data - */ - void MD5Update (HL_MD5_CTX* context, - unsigned char *input, - unsigned int inputLen); - - /** - * @brief Finalization ends the md5 message-digest - * operation, writing the the message digest and - * zeroizing the context. - * @param digest This is an OUT parameter which contains - * the created hash after the method returns - * @param context The context to finalize - */ - void MD5Final (unsigned char digest[16], HL_MD5_CTX* context); - - /** - * @brief default constructor - */ - MD5(){}; -}; - -//---------------------------------------------------------------------- -//End of include protection -#endif - -//---------------------------------------------------------------------- -//EOF diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.cxx b/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.cxx deleted file mode 100644 index e58828b3d..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.cxx +++ /dev/null @@ -1,388 +0,0 @@ -/* - * hashlib++ - a simple hash library for C++ - * - * Copyright (c) 2007-2010 Benjamin Grüdelbach - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//---------------------------------------------------------------------- - -/* - * The hashlib++ SHA1 implementation is derivative from the sourcecode - * published in RFC 3174 - * - * Copyright (C) The Internet Society (2001). All Rights Reserved. - * - * This document and translations of it may be copied and furnished to - * others, and derivative works that comment on or otherwise explain it - * or assist in its implementation may be prepared, copied, published - * and distributed, in whole or in part, without restriction of any - * kind, provided that the above copyright notice and this paragraph are - * included on all such copies and derivative works. However, this - * document itself may not be modified in any way, such as by removing - * the copyright notice or references to the Internet Society or other - * Internet organizations, except as needed for the purpose of - * developing Internet standards in which case the procedures for - * copyrights defined in the Internet Standards process must be - * followed, or as required to translate it into languages other than - * English. - * - * The limited permissions granted above are perpetual and will not be - * revoked by the Internet Society or its successors or assigns. - * - * This document and the information contained herein is provided on an - * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING - * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION - * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -//---------------------------------------------------------------------- - -/** - * @file hl_sha1.cpp - * @brief This file contains the implementation of the SHA1 class - * @date Mo 17 Sep 2007 - */ - -//---------------------------------------------------------------------- -//hashlib++ includes -#include "hl_sha1.h" - - -//---------------------------------------------------------------------- -//defines - -/* - * Define the SHA1 circular left shift macro - */ -#define SHA1CircularShift(bits,word) \ - (((word) << (bits)) | ((word) >> (32-(bits)))) - -//---------------------------------------------------------------------- -//private member-functions - -/** - * @brief Internal method to padd the message - * - * According to the standard, the message must - * be padded to an even 512 bits. The first - * padding bit must be a '1'. The last 64 bits - * represent the length of the original message. - * All bits in between should be 0. - * This function will pad the message according - * to those rules by filling the Message_Block array - * accordingly. It will also call the - * ProcessMessageBlock function provided appropriately. - * When it returns, it can be assumed that the message - * digest has been computed. - * - * @param context The context to padd - * - */ -void SHA1::SHA1PadMessage(HL_SHA1_CTX *context) -{ - /* - * Check to see if the current message block is too small to hold - * the initial padding bits and length. If so, we will pad the - * block, process it, and then continue padding into a second - * block. - */ - if (context->Message_Block_Index > 55) - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 64) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - - SHA1ProcessMessageBlock(context); - - while(context->Message_Block_Index < 56) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - else - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 56) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - - /* - * Store the message length as the last 8 octets - */ - context->Message_Block[56] = context->Length_High >> 24; - context->Message_Block[57] = context->Length_High >> 16; - context->Message_Block[58] = context->Length_High >> 8; - context->Message_Block[59] = context->Length_High; - context->Message_Block[60] = context->Length_Low >> 24; - context->Message_Block[61] = context->Length_Low >> 16; - context->Message_Block[62] = context->Length_Low >> 8; - context->Message_Block[63] = context->Length_Low; - - SHA1ProcessMessageBlock(context); -} - -/** - * @brief This member-function will process the next 512 bits of the - * message stored in the Message_Block array. - * - * Many of the variable names in this code, especially the - * single character names, were used because those were the - * names used in the publication. - * - * @param context The context to process - */ -void SHA1::SHA1ProcessMessageBlock(HL_SHA1_CTX *context) -{ - const hl_uint32 K[] = { /* Constants defined in SHA-1 */ - 0x5A827999, - 0x6ED9EBA1, - 0x8F1BBCDC, - 0xCA62C1D6 - }; - int t; /* Loop counter */ - hl_uint32 temp; /* Temporary word value */ - hl_uint32 W[80]; /* Word sequence */ - hl_uint32 A, B, C, D, E; /* Word buffers */ - - /* - * Initialize the first 16 words in the array W - */ - for(t = 0; t < 16; t++) - { - W[t] = context->Message_Block[t * 4] << 24; - W[t] |= context->Message_Block[t * 4 + 1] << 16; - W[t] |= context->Message_Block[t * 4 + 2] << 8; - W[t] |= context->Message_Block[t * 4 + 3]; - } - - for(t = 16; t < 80; t++) - { - W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - - A = context->Intermediate_Hash[0]; - B = context->Intermediate_Hash[1]; - C = context->Intermediate_Hash[2]; - D = context->Intermediate_Hash[3]; - E = context->Intermediate_Hash[4]; - - for(t = 0; t < 20; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | ((~B) & D)) + E + W[t] + K[0]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 20; t < 40; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 40; t < 60; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 60; t < 80; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - context->Intermediate_Hash[0] += A; - context->Intermediate_Hash[1] += B; - context->Intermediate_Hash[2] += C; - context->Intermediate_Hash[3] += D; - context->Intermediate_Hash[4] += E; - - context->Message_Block_Index = 0; -} - -//---------------------------------------------------------------------- -//public member-functions - -/** - * @brief Resets the sha1 context and starts a new - * hashprocess - * @param context The context to reset - * @return 0 on succes an error number otherwise - */ -int SHA1::SHA1Reset(HL_SHA1_CTX *context) -{ - if (!context) - { - return shaNull; - } - - context->Length_Low = 0; - context->Length_High = 0; - context->Message_Block_Index = 0; - - context->Intermediate_Hash[0] = 0x67452301; - context->Intermediate_Hash[1] = 0xEFCDAB89; - context->Intermediate_Hash[2] = 0x98BADCFE; - context->Intermediate_Hash[3] = 0x10325476; - context->Intermediate_Hash[4] = 0xC3D2E1F0; - - context->Computed = 0; - context->Corrupted = 0; - - return shaSuccess; -} - -/** - * @brief Data input. - * - * This memberfunction add data to the specified - * context. - * - * @param context The context to add data to - * @param message_array The data to add - * @param length The length of the data to add - */ -int SHA1::SHA1Input( HL_SHA1_CTX *context, - const hl_uint8 *message_array, - unsigned int length) -{ - if (!length) - { - return shaSuccess; - } - - if (!context || !message_array) - { - return shaNull; - } - - if (context->Computed) - { - context->Corrupted = shaStateError; - return shaStateError; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - while(length-- && !context->Corrupted) - { - context->Message_Block[context->Message_Block_Index++] = - (*message_array & 0xFF); - - context->Length_Low += 8; - if (context->Length_Low == 0) - { - context->Length_High++; - if (context->Length_High == 0) - { - /* Message is too long */ - context->Corrupted = 1; - } - } - - if (context->Message_Block_Index == 64) - { - SHA1ProcessMessageBlock(context); - } - - message_array++; - } - - return shaSuccess; -} - -/** - * @brief This ends the sha operation, zeroizing the context - * and returning the computed hash. - * - * @param context The context to get the hash from - * @param Message_Digest This is an OUT parameter which - * contains the hash after the menberfunction returns - * @return 0 on succes, an error-code otherwise - */ -int SHA1::SHA1Result( HL_SHA1_CTX *context, - hl_uint8 Message_Digest[SHA1HashSize]) -{ - int i; - - if (!context || !Message_Digest) - { - return shaNull; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - - if (!context->Computed) - { - SHA1PadMessage(context); - for(i=0; i<64; ++i) - { - /* message may be sensitive, clear it out */ - context->Message_Block[i] = 0; - } - context->Length_Low = 0; /* and clear length */ - context->Length_High = 0; - context->Computed = 1; - } - - for(i = 0; i < SHA1HashSize; ++i) - { - Message_Digest[i] = context->Intermediate_Hash[i>>2] - >> 8 * ( 3 - ( i & 0x03 ) ); - } - - return shaSuccess; -} - -//---------------------------------------------------------------------- -//EOF diff --git a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.h b/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.h deleted file mode 100644 index e52b86ba4..000000000 --- a/utilities/SimpleRTK/Code/Common/include/Ancillary/hl_sha1.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * hashlib++ - a simple hash library for C++ - * - * Copyright (c) 2007-2010 Benjamin Grüdelbach - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//---------------------------------------------------------------------- - -/* - * The hashlib++ SHA1 implementation is derivative from the sourcecode - * published in RFC 3174 - * - * Copyright (C) The Internet Society (2001). All Rights Reserved. - * - * This document and translations of it may be copied and furnished to - * others, and derivative works that comment on or otherwise explain it - * or assist in its implementation may be prepared, copied, published - * and distributed, in whole or in part, without restriction of any - * kind, provided that the above copyright notice and this paragraph are - * included on all such copies and derivative works. However, this - * document itself may not be modified in any way, such as by removing - * the copyright notice or references to the Internet Society or other - * Internet organizations, except as needed for the purpose of - * developing Internet standards in which case the procedures for - * copyrights defined in the Internet Standards process must be - * followed, or as required to translate it into languages other than - * English. - * - * The limited permissions granted above are perpetual and will not be - * revoked by the Internet Society or its successors or assigns. - * - * This document and the information contained herein is provided on an - * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING - * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION - * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -//---------------------------------------------------------------------- - -/** - * @file hl_sha1.h - * @brief This file contains the declaration of the SHA1 class - * @date Mo 17 Sep 2007 - */ - -//---------------------------------------------------------------------- -//include protection -#ifndef SHA1_H -#define SHA1_H - - -// included for import export macros -#include "srtkCommon.h" - -//---------------------------------------------------------------------- -//hl includes -// #include "hl_types.h" -typedef unsigned char hl_uint8; -typedef unsigned short int hl_uint16; -typedef unsigned int hl_uint32; - -//---------------------------------------------------------------------- -//enums - -#ifndef _SHA_enum_ -#define _SHA_enum_ -enum -{ - shaSuccess = 0, - shaNull, /* Null pointer parameter */ - shaInputTooLong, /* input data too long */ - shaStateError /* called Input after Result */ -}; -#endif - -//---------------------------------------------------------------------- -//defines -#define SHA1HashSize 20 - -//---------------------------------------------------------------------- -//structs - -/** - * @brief this struct represents a SHA1-hash context. - */ -typedef struct HL_SHA1_CTX -{ - /** Message Digest */ - hl_uint32 Intermediate_Hash[SHA1HashSize/4]; - - /** Message length in bits */ - hl_uint32 Length_Low; - - /** Message length in bits */ - hl_uint32 Length_High; - - /** Index into message block array */ - hl_uint16 Message_Block_Index; - - /** 512-bit message blocks */ - hl_uint8 Message_Block[64]; - - /** Is the digest computed? */ - int Computed; - - /** Is the message digest corrupted? */ - int Corrupted; - -} HL_SHA1_CTX; - -//---------------------------------------------------------------------- -//class definition - -/** - * @brief This class represents the implementation of - * the sha1 algorithm. - * - * Basically the class provides three public member-functions - * to create a hash: SHA1Reset(), SHA1Input() and SHA1Result(). - * If you want to create a hash based on a string or file quickly - * you should use the sha1wrapper class instead of SHA1. - */ -class SRTKCommon_EXPORT SHA1 -{ - private: - - /** - * @brief Internal method to padd the message - * - * According to the standard, the message must - * be padded to an even 512 bits. The first - * padding bit must be a '1'. The last 64 bits - * represent the length of the original message. - * All bits in between should be 0. - * This function will pad the message according - * to those rules by filling the Message_Block array - * accordingly. It will also call the - * ProcessMessageBlock function provided appropriately. - * When it returns, it can be assumed that the message - * digest has been computed. - * - * @param context The context to padd - * - */ - void SHA1PadMessage(HL_SHA1_CTX *context); - - /** - * @brief This member-function will process the next 512 bits of the - * message stored in the Message_Block array. - * - * Many of the variable names in this code, especially the - * single character names, were used because those were the - * names used in the publication. - * - * @param context The context to process - */ - void SHA1ProcessMessageBlock(HL_SHA1_CTX *context); - - public: - - /** - * @brief Resets the sha1 context and starts a new - * hashprocess - * @param context The context to reset - * @return 0 on succes an error number otherwise - */ - int SHA1Reset( HL_SHA1_CTX *context); - - /** - * @brief Data input. - * - * This memberfunction add data to the specified - * context. - * - * @param context The context to add data to - * @param message_array The data to add - * @param length The length of the data to add - */ - int SHA1Input( HL_SHA1_CTX *context, - const hl_uint8 *message_array, - unsigned int length); - - /** - * @brief This ends the sha operation, zeroizing the context - * and returning the computed hash. - * - * @param context The context to get the hash from - * @param Message_Digest This is an OUT parameter which - * contains the hash after the menberfunction returns - * @return 0 on succes, an error-code otherwise - */ - int SHA1Result( HL_SHA1_CTX *context, - hl_uint8 Message_Digest[SHA1HashSize]); -}; - -//---------------------------------------------------------------------- -//end of include protection -#endif - -//---------------------------------------------------------------------- -//EOF diff --git a/utilities/SimpleRTK/Code/Common/include/SimpleRTK.h b/utilities/SimpleRTK/Code/Common/include/SimpleRTK.h deleted file mode 100644 index 509188f2e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/SimpleRTK.h +++ /dev/null @@ -1,57 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __SimpleRTK_h -#define __SimpleRTK_h - -#include - -// Utility classes -#include "srtkMacro.h" -#include "srtkDetail.h" -#include "srtkVersion.h" -#include "srtkImage.h" -#include "srtkTransform.h" -#include "srtkThreeDCircularProjectionGeometry.h" -#include "srtkShow.h" - -#include "srtkInterpolator.h" -#include "srtkEvent.h" - -#include "srtkProcessObject.h" -#include "srtkImageFilter.h" -#include "srtkCommand.h" -#include "srtkFunctionCommand.h" - -// IO classes -#include "srtkImageFileReader.h" -#include "srtkImageSeriesReader.h" -#include "srtkProjectionsReader.h" -#include "srtkImageFileWriter.h" -#include "srtkImageSeriesWriter.h" -#include "srtkImportImageFilter.h" -#include "srtkThreeDCircularProjectionGeometryXMLFileReader.h" -#include "srtkThreeDCircularProjectionGeometryXMLFileWriter.h" - -#include "srtkHashImageFilter.h" -#include "srtkPixelIDTypeLists.h" -#include "srtkStatisticsImageFilter.h" -#include "srtkCastImageFilter.h" - -// These headers are auto-generated -#include "SimpleRTKBasicFiltersGeneratedHeaders.h" -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/nsstd/auto_ptr.h b/utilities/SimpleRTK/Code/Common/include/nsstd/auto_ptr.h deleted file mode 100644 index 2241e7524..000000000 --- a/utilities/SimpleRTK/Code/Common/include/nsstd/auto_ptr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtk_nsstd_auto_ptr_h -#define srtk_nsstd_auto_ptr_h - -#include "srtkConfigure.h" - -#include - -namespace rtk -{ -namespace simple -{ -namespace nsstd -{ -#if defined SRTK_HAS_CXX11_UNIQUE_PTR && defined SRTK_HAS_CXX11_ALIAS_TEMPLATE -template -using auto_ptr = std::unique_ptr; -#else -using std::auto_ptr; -#endif -} -} -} - -#endif // srtk_nsstd_auto_ptr_h diff --git a/utilities/SimpleRTK/Code/Common/include/nsstd/functional.h b/utilities/SimpleRTK/Code/Common/include/nsstd/functional.h deleted file mode 100644 index 900fda3bc..000000000 --- a/utilities/SimpleRTK/Code/Common/include/nsstd/functional.h +++ /dev/null @@ -1,52 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtk_nsstd_functional_h -#define srtk_nsstd_functional_h - -#include "srtkConfigure.h" - -#if !defined SRTK_HAS_TR1_FUNCTIONAL && !defined SRTK_HAS_CXX11_FUNCTIONAL -#error "No system (tr1/c++11) functional header available!" -#endif - -#if defined SRTK_HAS_CXX11_FUNCTIONAL || !defined SRTK_HAS_TR1_SUB_INCLUDE -#include -#else -#include -#endif - -namespace rtk -{ -namespace simple -{ -namespace nsstd -{ -#if defined SRTK_HAS_TR1_FUNCTIONAL && !defined SRTK_HAS_CXX11_FUNCTIONAL -using std::tr1::function; -using std::tr1::bind; -namespace placeholders = std::tr1::placeholders; -#else -using std::function; -using std::bind; -namespace placeholders = std::placeholders; -#endif -} -} -} - -#endif // srtk_nsstd_functional_h diff --git a/utilities/SimpleRTK/Code/Common/include/nsstd/type_traits.h b/utilities/SimpleRTK/Code/Common/include/nsstd/type_traits.h deleted file mode 100644 index 7027507ab..000000000 --- a/utilities/SimpleRTK/Code/Common/include/nsstd/type_traits.h +++ /dev/null @@ -1,55 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtk_nsstd_type_traits_h -#define __srtk_nsstd_type_traits_h - -#include "srtkConfigure.h" - -#if !defined SRTK_HAS_TR1_TYPE_TRAITS && !defined SRTK_HAS_CXX11_TYPE_TRAITS -#error "No system (tr1/c++11) type_traits header available!" -#endif - -#if defined SRTK_HAS_CXX11_TYPE_TRAITS || !defined SRTK_HAS_TR1_SUB_INCLUDE -#include -#else -#include -#endif - - -namespace rtk -{ -namespace simple -{ -namespace nsstd -{ -#if defined SRTK_HAS_TR1_TYPE_TRAITS && !defined SRTK_HAS_CXX11_TYPE_TRAITS -using std::tr1::is_same; -using std::tr1::true_type; -using std::tr1::false_type; -using std::tr1::integral_constant; -#else -using std::is_same; -using std::true_type; -using std::false_type; -using std::integral_constant; -#endif -} -} -} - -#endif // srtk_nsstd_type_traits_h diff --git a/utilities/SimpleRTK/Code/Common/include/nsstd/unordered_map.h b/utilities/SimpleRTK/Code/Common/include/nsstd/unordered_map.h deleted file mode 100644 index b076a52e3..000000000 --- a/utilities/SimpleRTK/Code/Common/include/nsstd/unordered_map.h +++ /dev/null @@ -1,50 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtk_nsstd_unordered_map_h -#define srtk_nsstd_unordered_map_h - -#include "srtkConfigure.h" - -#if !defined SRTK_HAS_TR1_UNORDERED_MAP && !defined SRTK_HAS_CXX11_UNORDERED_MAP -#error "No system (tr1/c++11) unordered_map header available!" -#endif - - -#if defined SRTK_HAS_CXX11_UNORDERED_MAP && !defined SRTK_HAS_TR1_SUB_INCLUDE -#include -#elif -#include -#endif - -namespace rtk -{ -namespace simple -{ -namespace nsstd -{ -#if defined SRTK_HAS_TR1_UNORDERED_MAP && !defined SRTK_HAS_CXX11_UNORDERED_MAP -using std::tr1::unordered_map; -#else -using std::unordered_map; -#endif -} -} -} - - -#endif // srtk_nsstd_unordered_map_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkCommand.h b/utilities/SimpleRTK/Code/Common/include/srtkCommand.h deleted file mode 100644 index 86a200e15..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkCommand.h +++ /dev/null @@ -1,95 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkCommand_h -#define srtkCommand_h - - -#include "srtkCommon.h" -#include "srtkNonCopyable.h" - -#include - -namespace rtk { -namespace simple { - -class ProcessObject; - -/** \class Command - * \brief An implementation of the Command design pattern for callback. - * - * This class provides a callback mechanism for event that occur from - * the ProcessObject. These commands can be utilized to observe these - * events. - * - * The Command can be created on the stack, and will automatically - * unregistered it's self when destroyed. - * - * For more information see the page \ref CommandPage. - */ -class SRTKCommon_EXPORT Command: - protected NonCopyable -{ -public: - - /** \brief Default Constructor */ - Command(); - - /** Destructor. */ - virtual ~Command(void); - - /** Set/Get Command Name */ - virtual std::string GetName() const { return this->m_Name; } - virtual void SetName(const std::string &name) { this->m_Name = name; } - - /** The method that defines action to be taken by the command */ - virtual void Execute(void); - -protected: - - friend class rtk::simple::ProcessObject; - - #ifndef SWIG - // internal methods to maintain reference between ProcessObject and - // Command, so when either is destroyed, the other will be notified. - // - // Return value is the number of referenced process objects after - // operation. - virtual size_t AddProcessObject(rtk::simple::ProcessObject *o); - virtual size_t RemoveProcessObject(const rtk::simple::ProcessObject *o); - - virtual void SetOwnedByProcessObjects(bool o) {this->m_OwnedByProcessObjects = o;} - virtual bool GetOwnedByProcessObjects() const {return this->m_OwnedByProcessObjects;} - virtual void OwnedByProcessObjectsOn() {this->SetOwnedByProcessObjects(true);} - virtual void OwnedByProcessObjectsOff() {this->SetOwnedByProcessObjects(false);} - #endif - - - -private: - - // a set of objects who use us - std::set m_ReferencedObjects; - - bool m_OwnedByProcessObjects; - std::string m_Name; -}; - -} // end namespace simple -} // end namespace itk - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkCommon.h b/utilities/SimpleRTK/Code/Common/include/srtkCommon.h deleted file mode 100644 index c260ff20b..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkCommon.h +++ /dev/null @@ -1,41 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkCommon_h -#define __srtkCommon_h - -#include "srtkMacro.h" - -#ifndef srtkMacro_h -#error "srtkMacro.h must be included before srtkCommon.h" -#endif - -#if defined( SRTKDLL ) - #ifdef SimpleRTKCommon_EXPORTS - #define SRTKCommon_EXPORT SRTK_ABI_EXPORT - #else - #define SRTKCommon_EXPORT SRTK_ABI_IMPORT - #endif /* SimpleRTKCommon_EXPORTS */ -#else - // Don't hide symbols in the static SimpleRTKCommon library in case - // -fvisibility=hidden is used - #define SRTKCommon_EXPORT -#endif - -#define SRTKCommon_HIDDEN SRTK_ABI_HIDDEN - -#endif // __srtkCommon_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkConditional.h b/utilities/SimpleRTK/Code/Common/include/srtkConditional.h deleted file mode 100644 index f1d849989..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkConditional.h +++ /dev/null @@ -1,66 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkConditional_h -#define __srtkConditional_h - -namespace rtk -{ -namespace simple -{ - -/* \brief An object for selection of a type at compile-time. - * * - * If VCode is true, then the member Type will be TIfTrue, otherwise - * the member typedef Type will be equivalent to TIfFalse. - * - */ -template struct Conditional { typedef TIfTrue Type; }; -/** \cond SPECIALIZATION_IMPLEMENTATION */ -template -struct Conditional { typedef TIfFalse Type; }; - -/**\endcond*/ - -/* \brief An object for selecting an integer value at compile-time. - * - * - * If VCode is true, then the member Value will be TIfTrue, otherwise - * the member Value will be equivalent to TIfFalse. - * - * This class also contains a typedef for ValueType, which is an the - * selected integral constant as a type. - */ -template -struct ConditionalValue - : public rtk::simple::Conditional, - nsstd::integral_constant >::Type -{ -private: - typedef ConditionalValue Self; -public: - typedef typename Self::value_type ValueType; - typedef typename Self::type Type; - - static const ValueType Value = Self::value; -}; - -} -} - -#endif // __srtkConditional_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkDetail.h b/utilities/SimpleRTK/Code/Common/include/srtkDetail.h deleted file mode 100644 index e26888d9e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkDetail.h +++ /dev/null @@ -1,105 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkDetail_h -#define __srtkDetail_h - -#include "srtkMemberFunctionFactoryBase.h" -#include "Ancillary/FunctionTraits.h" - -namespace rtk { -namespace simple { - -// this namespace is internal classes not part of the external simple ITK interface -namespace detail { - - -template < class TMemberFunctionPointer > -struct MemberFunctionAddressor -{ - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternal< TImageType >; - } -}; - -template < class TMemberFunctionPointer > -struct DualExecuteInternalAddressor -{ - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template DualExecuteInternal< TImageType1, TImageType2 >; - } -}; - -/** An addressor of ExecuteInternalCast to be utilized with - * registering member functions with the factory. - */ -template < class TMemberFunctionPointer > -struct ExecuteInternalVectorImageAddressor -{ - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalVectorImage< TImageType >; - } -}; - - -/** An addressor of ExecuteInternalCast to be utilized with - * registering member functions with the factory. - */ -template < class TMemberFunctionPointer > -struct DualExecuteInternalVectorAddressor -{ - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType1, typename TImageType2 > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template DualExecuteInternalVector< TImageType1, TImageType2 >; - } -}; - -/** An addressor of ExecuteInternal to be utilized with - * registering member functions with the factory. - */ -template < class TMemberFunctionPointer > -struct ExecuteInternalLabelImageAddressor -{ - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template ExecuteInternalLabelImage< TImageType >; - } -}; - - -} -} -} -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.h b/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.h deleted file mode 100644 index 1a0d30a19..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.h +++ /dev/null @@ -1,183 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkDualMemberFunctionFactory_h -#define __srtkDualMemberFunctionFactory_h - -#include "srtkDetail.h" -#include "srtkMemberFunctionFactoryBase.h" - - - -namespace rtk -{ -namespace simple -{ -// this namespace is internal classes not part of the external simple ITK interface -namespace detail -{ - - - -/** \class DualMemberFunctionFactory - * \brief A class used to instantiate and generate function objects of - * templated member functions with two template arguments. - * - * \tparam TMemberFunctionPointer is the type of pointer to member - * function - * - * Example member function and pointer: - * \code - * typedef Image::Pointer (Self::*MemberFunctionType)( Image::Pointer ); - * - * template - * Image::Pointer ExecuteInternal( Image::Pointer ); - * \endcode - * - * The provided Addressor will instantiate the templeted - * member functions by taking the address in the - * RegisterMethods. Later they can be retrieve with the - * GetMemberFunction method, which returns a function object with the - * same arguments as the templated member function pointer. - * - * An instance of a MemberFunctionFactory is bound to a specific - * instance of an object, so that the returned function object does - * not need to have the calling object specified. - * - * \warning Use this class with caution because it can instantiate a - * combinatorial number of methods. - * - * \sa MemberFunctionFactory - */ -template -class DualMemberFunctionFactory - : protected MemberFunctionFactoryBase > -{ - -public: - - typedef MemberFunctionFactoryBase > Superclass; - typedef DualMemberFunctionFactory Self; - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - typedef typename Superclass::FunctionObjectType FunctionObjectType; - - /** \brief Constructor which permanently binds the constructed - * object to pObject */ - DualMemberFunctionFactory( ObjectType *pObject ); - - /** \brief Registers a specific member function. - * - * Registers a member function templated over TImageType1 and TImageType2 */ - template< typename TImageType1, typename TImageType2 > - void Register( MemberFunctionType pfunc, TImageType1*, TImageType2* ); - - /** \brief Registers the member functions for all combinations of - * TPixelIDTypeList1 and PixelIDTypeList2 - * - * With out the third template argument, the DualExecuteInternalAddressor - * will be used to instantiate "DualExecuteInternal" methods over - * the two image types referenced by all combination of type in the - * first list with types in the second. - * - * The optional third template parameter provides a custom addressor. - * - * Example usage: - * \code - * this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1, - * PixelIDTypeList2, 3 > (); - * \endcode - * - * or if a custom addressor is needed: - * \code - * template < class TMemberFunctionPointer > - * struct MyCustomAddressor - * { - * typedef typename ::detail::FunctionTraits::ClassType ObjectType; - * - * template< typename TImageType1, typename TImageType2 > - * TMemberFunctionPointer operator() ( void ) const - * { - * return &ObjectType::template CustomMethod< TImageType1, TImageType2 >; - * } - * }; - * - * this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1, - * PixelIDTypeList2, - * 3, - * MyCustomAddressor > (); - * \endcode - * @{ - */ - template < typename TPixelIDTypeList1, - typename TPixelIDTypeList2, - unsigned int VImageDimension, - typename TAddressor > - void RegisterMemberFunctions( void ); - template < typename TPixelIDTypeList1, - typename TPixelIDTypeList2, - unsigned int VImageDimension > - void RegisterMemberFunctions( void ) - { - typedef detail::DualExecuteInternalAddressor AddressorType; - this->RegisterMemberFunctions< TPixelIDTypeList1, TPixelIDTypeList2, VImageDimension, AddressorType>(); - } - /** @} */ - - /** \brief Query to determine if an member function has been - * registered for pixelID1, pixelID2 and imageDimension - */ - bool HasMemberFunction( PixelIDValueType pixelID1, - PixelIDValueType pixelID2, - unsigned int imageDimension ) const throw(); - - - /** \brief Returns a function object for the combination of - * PixelID1 and PixelID2, and image dimension. - * - * pixelID1 or pixelID2 is the value of Image::GetPixelIDValue(), - * or PixelIDToPixelIDValue::Result - * - * imageDimension is the the value returned by Image::GetDimension() - * - * Example usage: - * \code - * PixelIDValueType pixelID = image->GetPixelIDValue(); - * unsigned int dimension = image->GetDimension(); - * return this->m_MemberFactory->GetMemberFunction( pixelID, pixelID, dimension )( image ); - * \endcode - * - * If the requested member function is not registered then an - * exception is generated. The returned function object is - * guaranteed to be valid. - */ - FunctionObjectType GetMemberFunction( PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension ); - -protected: - - ObjectType *m_ObjectPointer; - -}; - -} // end namespace detail -} // end namespace simple -} // end namespace rtk - -#include "srtkDualMemberFunctionFactory.hxx" - -#endif // __srtkDualMemberFunctionFactory_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.hxx b/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.hxx deleted file mode 100644 index 6f8ae8559..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkDualMemberFunctionFactory.hxx +++ /dev/null @@ -1,228 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkDualMemberFunctionFactory_hxx -#define __srtkDualMemberFunctionFactory_hxx - -#include "srtkDualMemberFunctionFactory.h" - -#include "srtkPixelIDTokens.h" -#include "srtkExceptionObject.h" - -namespace rtk -{ -namespace simple -{ -// this namespace is internal classes not part of the external simple ITK interface -namespace detail -{ - -// a privately declared predicate for use with the typelist::Visit -// algorithm -// -// \todo doc -// -// This predicate calls the member function factories AddressorType on -// each valid ImageType defined from the pixel type id, and the -// provided dimension -template < typename TMemberFunctionFactory, unsigned int VImageDimension, typename TAddressor > -struct DualMemberFunctionInstantiater -{ - DualMemberFunctionInstantiater( TMemberFunctionFactory &factory ) - : m_Factory( factory ) - {} - template - typename EnableIf< IsInstantiated::Value && - IsInstantiated::Value >::Type - operator()( TPixelIDType1* t1=NULL, TPixelIDType2*t2=NULL ) const - { - (void)t1; - (void)t2; - typedef typename PixelIDToImageType::ImageType ImageType1; - typedef typename PixelIDToImageType::ImageType ImageType2; - typedef TAddressor AddressorType; - - AddressorType addressor; - m_Factory.Register(addressor.CLANG_TEMPLATE operator()(), (ImageType1*)(NULL), (ImageType2*)(NULL) ); - - } - - // this methods is conditionally enabled when the PixelID is not instantiated - template - typename DisableIf< IsInstantiated::Value && - IsInstantiated::Value >::Type - operator()( TPixelIDType1*t1=NULL, TPixelIDType2*t2=NULL ) const - { - (void)t1; - (void)t2; - } - -private: - - TMemberFunctionFactory &m_Factory; -}; - -template -DualMemberFunctionFactory< TMemberFunctionPointer > -::DualMemberFunctionFactory( ObjectType *pObject ) - : m_ObjectPointer( pObject ) -{ - assert( pObject ); -} - -template -template< typename TImageType1, typename TImageType2 > -void -DualMemberFunctionFactory< TMemberFunctionPointer > -::Register( MemberFunctionType pfunc, TImageType1*, TImageType2* ) -{ - PixelIDValueType pixelID1 = ImageTypeToPixelIDValue::Result; - PixelIDValueType pixelID2 = ImageTypeToPixelIDValue::Result; - - // this shouldn't occour, just may be useful for debugging - assert( pixelID1 >= 0 && pixelID1 < typelist::Length< InstantiatedPixelIDTypeList >::Result ); - assert( pixelID2 >= 0 && pixelID2 < typelist::Length< InstantiatedPixelIDTypeList >::Result ); - - srtkStaticAssert( TImageType1::ImageDimension == 2 || TImageType1::ImageDimension == 3, - "Image Dimension out of range" ); - srtkStaticAssert( int(TImageType1::ImageDimension) == int(TImageType2::ImageDimension), - "Image Dimensions do not match" ); - srtkStaticAssert( IsInstantiated::Value, - "invalid pixel type for argument one"); - srtkStaticAssert( IsInstantiated::Value, - "invalid pixel type for argument two"); - - if ( pixelID1 >= 0 && pixelID1 < typelist::Length< InstantiatedPixelIDTypeList >::Result && - pixelID2 >= 0 && pixelID2 < typelist::Length< InstantiatedPixelIDTypeList >::Result ) - { - typename Superclass::KeyType key(pixelID1, pixelID2); - - switch( int(TImageType1::ImageDimension) ) - { - case 3: - Superclass::m_PFunction3[ key ] = Superclass::BindObject( pfunc, m_ObjectPointer ); - break; - case 2: - Superclass::m_PFunction2[ key ] = Superclass::BindObject( pfunc, m_ObjectPointer ); - break; - default: - break; - } - } -} - -template -template < typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension, typename TAddressor > -void -DualMemberFunctionFactory< TMemberFunctionPointer > -::RegisterMemberFunctions( void ) -{ - typedef DualMemberFunctionInstantiater< Self, VImageDimension, TAddressor > InstantiaterType; - - // initialize function array with pointer - typelist::DualVisit visitEachComboInLists; - visitEachComboInLists( InstantiaterType( *this ) ); -} - - -template -bool -DualMemberFunctionFactory< TMemberFunctionPointer > -::HasMemberFunction( PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension ) const throw() -{ - try - { - - typename Superclass::KeyType key(pixelID1, pixelID2); - - switch ( imageDimension ) - { - case 3: - // check if tr1::function has been set in map - return Superclass::m_PFunction3.find( key ) != Superclass::m_PFunction3.end(); - case 2: - // check if tr1::function has been set in map - return Superclass::m_PFunction2.find( key ) != Superclass::m_PFunction2.end(); - default: - return false; - } - } - // we do not throw exceptions - catch(...) - { - return false; - } -} - -template -typename DualMemberFunctionFactory< TMemberFunctionPointer >::FunctionObjectType -DualMemberFunctionFactory< TMemberFunctionPointer > -::GetMemberFunction( PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension ) -{ - if ( pixelID1 >= typelist::Length< InstantiatedPixelIDTypeList >::Result || pixelID1 < 0 ) - { - srtkExceptionMacro ( << "unexpected error pixelID1 is out of range " << pixelID1 << " " << typeid(ObjectType).name() ); - } - - if ( pixelID2 >= typelist::Length< InstantiatedPixelIDTypeList >::Result || pixelID2 < 0 ) - { - srtkExceptionMacro ( << "unexpected error pixelID2 is out of range " << pixelID2 << " " << typeid(ObjectType).name() ); - } - - typename Superclass::KeyType key(pixelID1, pixelID2); - - switch ( imageDimension ) - { - case 3: - // check if tr1::function has been set - if ( Superclass::m_PFunction3.find( key ) != Superclass::m_PFunction3.end() ) - { - return Superclass::m_PFunction3[ key ]; - } - - // todo updated exceptions here - srtkExceptionMacro ( << "Pixel type: " - << GetPixelIDValueAsString(pixelID1) - << " is not supported in 3D by" - << typeid(ObjectType).name() ); - - break; - case 2: - // check if tr1::function has been set - if ( Superclass::m_PFunction2.find( key ) != Superclass::m_PFunction2.end() ) - { - return Superclass::m_PFunction2[ key ]; - } - - srtkExceptionMacro ( << "Pixel type: " - << GetPixelIDValueAsString(pixelID1) - << " is not supported in 2D by" - << typeid(ObjectType).name() ); - - break; - default: - srtkExceptionMacro ( << "Image dimension " << imageDimension << " is not supported" ); - } -} - - -} // end namespace detail -} // end namespace simple -} // end namespace rtk - - -#endif // __srtkDualMemberFunctionFactory_hxx diff --git a/utilities/SimpleRTK/Code/Common/include/srtkEnableIf.h b/utilities/SimpleRTK/Code/Common/include/srtkEnableIf.h deleted file mode 100644 index ebf091e85..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkEnableIf.h +++ /dev/null @@ -1,65 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkEnableIf_h -#define __srtkEnableIf_h - -namespace rtk -{ -namespace simple -{ - -/* \brief This is an implementation of the enable if idiom. - * - * This template enables specialization of a templated function based - * on some traits or concepts. It is implemented with SFINAE. - * - * If the parameter V is true then the Type trait is the second - * template parameter, otherwise an implementation does not exist and - * with SFIANE another implementation may be choosen. - * - * Example: - * \code - * template - * typename EnableIf::Value>::Type - * AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth ); - * - * template - * typename EnableIf::Value>::Type - * AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth ); - * \endcode - * - */ -template struct EnableIf {}; -/** \cond SPECIALIZATION_IMPLEMENTATION */ -template struct EnableIf { typedef T Type; }; -/**\endcond*/ - - -/* \brief An implementation of the negation of the enable if idiom. - * - * \sa EnableIf - */ -template struct DisableIf {}; -/** \cond SPECIALIZATION_IMPLEMENTATION */ -template struct DisableIf { typedef T Type; }; -/**\endcond*/ - -} -} - -#endif // __srtkEnableIf_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkEvent.h b/utilities/SimpleRTK/Code/Common/include/srtkEvent.h deleted file mode 100644 index 379f5f61e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkEvent.h +++ /dev/null @@ -1,72 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkEvent_h -#define srtkEvent_h - -#include "srtkCommon.h" -#include - -namespace rtk { -namespace simple { - -/** \brief Events which can be observed from ProcessObject. - * - * For more information see the page \ref CommandPage. - */ -enum EventEnum { - /** \brief Occurs for all event types. - */ - srtkAnyEvent = 0, - /** \brief Occurs after the process has been aborted, but before exiting the Execute method. - */ - srtkAbortEvent = 1, - /** \brief Occurs when the underlying itk::ProcessObject is deleted. - */ - srtkDeleteEvent = 2, - /** \brief Occurs at then end of normal processing. - */ - srtkEndEvent = 3, - /** \brief Occurs with some algorithms that run for a fixed or undetermined number of iterations. - */ - srtkIterationEvent = 4, - /** \brief Occurs when the progress changes in most process objects. - */ - srtkProgressEvent = 5, - /** \brief Occurs when then itk::ProcessObject is starting. - */ - srtkStartEvent = 6, - /** \brief Occurs when some filters change processing to a different - * scale - * - * \note This event is a sub-event of the more general - * IterationEvent. The general iteration event will also be invoked. - */ - srtkMultiResolutionIterationEvent = 9, - /** \brief Other events may fall into this enumeration. - */ - srtkUserEvent = 7 -}; - -#ifndef SWIG -SRTKCommon_EXPORT std::ostream& operator<<(std::ostream& os, const EventEnum k); -#endif - -} // end namespace simple -} // end namespace itk - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkExceptionObject.h b/utilities/SimpleRTK/Code/Common/include/srtkExceptionObject.h deleted file mode 100644 index 35650da40..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkExceptionObject.h +++ /dev/null @@ -1,100 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkExceptionObject_h -#define __srtkExceptionObject_h - -#include "srtkMacro.h" -#include "srtkCommon.h" - -#ifndef srtkMacro_h -#error "srtkMacro.h must be included before srtkExceptionObject.h" -#endif //__srtkMacro_h -#ifndef __srtkCommon_h -#error "srtkCommon.h must be included before srtkExceptionObject.h" -#endif //__srtkCommon_h - - -namespace itk -{ -// forward declaration for encapsulation -class ExceptionObject; -} - -namespace rtk -{ -namespace simple -{ - -/** \class GenericException - * \brief The base SimpleRTK exception class - */ -class SRTKCommon_EXPORT GenericException : - public std::exception -{ -public: - /** Default constructor. Needed to ensure the exception object can be - * copied. */ - GenericException() throw(); - GenericException( const GenericException &e ) throw(); - - /** Constructor. Needed to ensure the exception object can be copied. */ - GenericException(const char *file, unsigned int lineNumber) throw(); - - /** Constructor. Needed to ensure the exception object can be copied. */ - GenericException(const std::string & file, unsigned int lineNumber) throw(); - - /** Constructor. Needed to ensure the exception object can be copied. */ - GenericException(const std::string & file, - unsigned int lineNumber, - const std::string & desc) throw(); - - /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~GenericException() throw( ); - - /** Assignment operator. */ - GenericException & operator=(const GenericException & orig); - - /** Equivalence operator. */ - virtual bool operator==(const GenericException & orig) const; - - - /** Return a description of the error */ - std::string ToString() const; - - const char * what() const throw(); - - virtual const char * GetNameOfClass() const; - - virtual const char * GetLocation() const; - - virtual const char * GetDescription() const; - - /** What file did the exception occur in? */ - virtual const char * GetFile() const; - - /** What line did the exception occur in? */ - virtual unsigned int GetLine() const; - -private: - const itk::ExceptionObject *m_PimpleException; -}; - -} -} - -#endif // __srtkExceptionObject_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkFunctionCommand.h b/utilities/SimpleRTK/Code/Common/include/srtkFunctionCommand.h deleted file mode 100644 index a1fdbca45..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkFunctionCommand.h +++ /dev/null @@ -1,73 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkFunctionCommand_h -#define __srtkFunctionCommand_h - - -#include "srtkCommand.h" - -#include "nsstd/functional.h" - -namespace rtk { -namespace simple { - -/** \class FunctionCommand - * \brief A Command class which allows setting an external function, - * or member function. - */ -class SRTKCommon_EXPORT FunctionCommand: - public Command -{ -public: - - typedef FunctionCommand Self; - - FunctionCommand(); - - virtual void Execute(void); - - /** Generic method to set a class's member function to be called in - * the Execute method. - */ - template - void SetCallbackFunction ( T *object, void(T::* pMemberFunction )() ) - { - m_Function = nsstd::bind(pMemberFunction, object); - } - - /** Set a C-Style function to be called in the Execute method */ - void SetCallbackFunction ( void(* pFunction )() ); - - /** Set a C-Style function with a void* clientData as an - * argument. The caller is responsible for managing the life of - * the clientData and that it's valid when Execute is called with - * the clientData. - */ - void SetCallbackFunction( void(* pFunction )(void *), void *clientData ); - -private: - - typedef nsstd::function FunctionObjectType; - FunctionObjectType m_Function; - -}; - -} // end namespace simple -} // end namespace rtk - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkImage.h b/utilities/SimpleRTK/Code/Common/include/srtkImage.h deleted file mode 100644 index 4a955e96a..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkImage.h +++ /dev/null @@ -1,471 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImage_h -#define __srtkImage_h - -#include "srtkCommon.h" -#include "srtkTemplateFunctions.h" -#include "srtkDetail.h" -#include "srtkPixelIDTokens.h" -#include "srtkEnableIf.h" - -#include "nsstd/type_traits.h" -#include "nsstd/auto_ptr.h" - -#include -#include -#include - -namespace itk{ -// Forward decalaration for pointer -class DataObject; - -template -class SmartPointer; -} - -namespace rtk -{ -namespace simple -{ - - // This is the foward declaration of a class used internally to the - // Image class, but the actually interface is not exposed to simple - // ITK. A pointer to the implementation is used as per the pimple - // idiom. - class PimpleImageBase; - - /** \class Image - * \brief The main Image class for SimpleRTK - */ - class SRTKCommon_EXPORT Image - { - public: - typedef Image Self; - - virtual ~Image( ); - - /** \brief Default constructor, creates an image of size 0 */ - Image( void ); - - // copy constructor - Image( const Image &img ); - Image& operator=( const Image &img ); - - /** \brief Constructors for 2D, 3D an optionally 4D images where - * pixel type and number of components can be specified. - * - * If the pixel type is a scalar or a label pixel type, then the - * number of components must be specified as 0 or 1. - * - * If the pixel type is a vector pixel type, then the number of - * components defaults to the image dimension, unless the - * numberOfComponents is explicitly specified. - * - * Unlike the standard convention for Dimensional Vectors the size - * parameter must be the exact dimension requesting. That is, it must be of - * length 2 of a 2D image, 3 for a 3D image and 4 for a 4D image. - * @{ - */ - Image( unsigned int width, unsigned int height, PixelIDValueEnum valueEnum ); - Image( unsigned int width, unsigned int height, unsigned int depth, PixelIDValueEnum valueEnum ); - Image( const std::vector< unsigned int > &size, PixelIDValueEnum valueEnum, unsigned int numberOfComponents = 0 ); - /**@}*/ - - - /** \brief Construct an SimpleRTK Image from an pointer to an ITK - * image - * - * The SimpleRTK image will add a reference to the underlying the - * ITK image and hold a pointer to the image. If the image is - * manipulated directly from the ITK interface, SimpleRTK may be - * unaware of it, and may cause complication related to aliasing - * and SimpleRTK copy on write policy. - * - * If simpleRTK does not support the image type, a compile-time - * error or assertion will fail. - * - * The ITK image must be fully buffered, and must have a zero - * starting index for the Buffered/Largest regions. - * @{ - */ - template - explicit Image( itk::SmartPointer image ) - : m_PimpleImage( NULL ) - { - srtkStaticAssert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown, - "invalid pixel type" ); - this->InternalInitialization::Result, TImageType::ImageDimension>( image.GetPointer() ); - } - template - explicit Image( TImageType* image ) - : m_PimpleImage( NULL ) - { - srtkStaticAssert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown, - "invalid pixel type" ); - this->InternalInitialization::Result, TImageType::ImageDimension>( image ); - } - /**@}*/ - - /** Get access to internal ITK data object. - * - * The return value should imediately be assigned to as - * itk::SmartPointer. - * - * In many cases the value may need to be dynamically casted to - * the the actual image type. The GetPixelIDValue() method should - * return an PixelID which identifies the image type which the - * DataObject points to. - * - * @{ - */ - itk::DataObject* GetITKBase( void ); - const itk::DataObject* GetITKBase( void ) const; - /**@}*/ - - // could return -1 if in valid - PixelIDValueEnum GetPixelID( void ) const; - PixelIDValueType GetPixelIDValue( void ) const; - - unsigned int GetDimension( void ) const; - - /** \brief Get the number of components for each pixel - * - * For scalar images this methods returns 1. For vector images the - * number of components for each pixel is returned. - */ - unsigned int GetNumberOfComponentsPerPixel( void ) const; - - /** Get/Set the Origin - * @{ - */ - std::vector< double > GetOrigin( void ) const; - void SetOrigin( const std::vector< double > &origin ); - /** @} */ - - /** Get/Set the Spacing - * @{ - */ - std::vector< double > GetSpacing( void ) const; - void SetSpacing( const std::vector< double > &spacing ); - /** @} */ - - /** \brief Set/Get the Direction - * - * Internally, the Direction is represented by a matrix 2x2 for a - * 2D and and 3x3 for a 3D image. The matrix is passed as a 1D - * array in row-major form. - * @{ - */ - std::vector< double > GetDirection() const; - void SetDirection ( const std::vector< double > &direction ); - /** @} */ - - /** Transform index to physical point */ - std::vector< double > TransformIndexToPhysicalPoint( const std::vector< int64_t > &index ) const; - - /** Transform physical point to index */ - std::vector< int64_t > TransformPhysicalPointToIndex( const std::vector< double >& point ) const; - - /** Transform physical point to continuous index */ - std::vector< double > TransformPhysicalPointToContinuousIndex( const std::vector< double >& point ) const; - - /** Transform continuous index to physical point */ - std::vector< double > TransformContinuousIndexToPhysicalPoint( const std::vector< double > &index) const; - - std::vector< unsigned int > GetSize( void ) const; - - unsigned int GetHeight( void ) const; - unsigned int GetWidth( void ) const; - unsigned int GetDepth( void ) const; - - - /** \brief Copy common meta-data from an image to this one. - * - * Copies the Origin, Spacing, and Direction from the source image - * to this image. The meta-data dictionary is \b not copied. - * - * It is required for the source Image's dimension and size to - * match, this image's attributes, otherwise an exception will be - * generated. - * - */ - void CopyInformation( const Image &srcImage ); - - /** \brief get a vector of keys in from the meta-data dictionary - * - * Returns a vector of keys to the key/value entries in the - * image's meta-data dictionary. Iterate through with these keys - * to get the values. - */ - std::vector GetMetaDataKeys( void ) const; - - /** \brief Query the meta-data dictionary for the existence of a key. - */ - bool HasMetaDataKey( const std::string &key ) const; - - /** \brief Get the value of a meta-data dictionary entry as a string. - * - * If the key is not in the dictionary then an exception is - * thrown. - * - * string types in the dictionary are returned as their native - * strings. Other types are printed to string before returning. - */ - std::string GetMetaData( const std::string &key ) const; - - /** \brief Set an entry in the meta-data dictionary. - * - * Replaces or creates an entry in the image's meta-data dictionary. - */ - void SetMetaData( const std::string &key, const std::string &value); - - /** \brief Remove an entry from the meta-data dictionary. - * - * Returns true, when the value exists in the dictionary and is - * removed, false otherwise. - */ - bool EraseMetaData( const std::string &key ); - - std::string GetPixelIDTypeAsString( void ) const; - - std::string ToString( void ) const; - - /** \brief Get the value of a pixel - * - * Returns the value of a pixel for the given index. The index - * follows standard SimpleRTK conventions for it's length. The - * correct method must be called for the underlying Image type, - * otherwise an exception will be thrown. - * - * \param idx the zero based index into the image. It's length - * must be at least the value of GetDimension(), additional - * elements will be ignored. Boundary checking is performed on - * idx, if it is out of bounds an exception will be thrown. - * - * \sa Image::GetPixelIDValue - * @{ - */ - int8_t GetPixelAsInt8( const std::vector &idx) const; - uint8_t GetPixelAsUInt8( const std::vector &idx) const; - int16_t GetPixelAsInt16( const std::vector &idx ) const; - uint16_t GetPixelAsUInt16( const std::vector &idx ) const; - int32_t GetPixelAsInt32( const std::vector &idx ) const; - uint32_t GetPixelAsUInt32( const std::vector &idx ) const; - int64_t GetPixelAsInt64( const std::vector &idx ) const; - uint64_t GetPixelAsUInt64( const std::vector &idx ) const; - float GetPixelAsFloat( const std::vector &idx ) const; - double GetPixelAsDouble( const std::vector &idx ) const; - - std::vector GetPixelAsVectorInt8( const std::vector &idx) const; - std::vector GetPixelAsVectorUInt8( const std::vector &idx) const; - std::vector GetPixelAsVectorInt16( const std::vector &idx ) const; - std::vector GetPixelAsVectorUInt16( const std::vector &idx ) const; - std::vector GetPixelAsVectorInt32( const std::vector &idx ) const; - std::vector GetPixelAsVectorUInt32( const std::vector &idx ) const; - std::vector GetPixelAsVectorInt64( const std::vector &idx ) const; - std::vector GetPixelAsVectorUInt64( const std::vector &idx ) const; - std::vector GetPixelAsVectorFloat32( const std::vector &idx ) const; - std::vector GetPixelAsVectorFloat64( const std::vector &idx ) const; - - std::complex GetPixelAsComplexFloat32( const std::vector &idx ) const; - std::complex GetPixelAsComplexFloat64( const std::vector &idx ) const; - /** @} */ - - /** \brief Set the value of a pixel - * - * Set the value of a pixel at the provided index. The index - * follows standard SimpleRTK conventions for it's length. The - * correct method must be called which should match the underlying - * image type, otherwise an exception will be thrown. - * - * \param idx the zero based index into the image. It's length - * must be at least the value of GetDimension(), additional - * elements will be ignored. Boundary checking is performed on - * idx, if it is out of bounds an exception will be thrown. - * \param v value to set the pixel to - * - * \sa Image::GetPixelIDValue - * @{ - */ - void SetPixelAsInt8( const std::vector &idx, int8_t v ); - void SetPixelAsUInt8( const std::vector &idx, uint8_t v ); - void SetPixelAsInt16( const std::vector &idx, int16_t v ); - void SetPixelAsUInt16( const std::vector &idx, uint16_t v ); - void SetPixelAsInt32( const std::vector &idx, int32_t v ); - void SetPixelAsUInt32( const std::vector &idx, uint32_t v ); - void SetPixelAsInt64( const std::vector &idx, int64_t v ); - void SetPixelAsUInt64( const std::vector &idx, uint64_t v ); - void SetPixelAsFloat( const std::vector &idx, float v ); - void SetPixelAsDouble( const std::vector &idx, double v ); - - void SetPixelAsVectorInt8( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorUInt8( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorInt16( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorUInt16( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorInt32( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorUInt32( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorInt64( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorUInt64( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorFloat32( const std::vector &idx, const std::vector &v ); - void SetPixelAsVectorFloat64( const std::vector &idx, const std::vector &v ); - - void SetPixelAsComplexFloat32( const std::vector &idx, const std::complex v ); - void SetPixelAsComplexFloat64( const std::vector &idx, const std::complex v ); - - /** @} */ - - /** \brief Get a pointer to the image buffer - * \warning this is dangerous - * - * The size of the buffer is the number of components*Xsize*Ysize - * and then Zsize of a 3D image. The buffer should be accessed as - * a 1-D array. For example a 3D image buffer should be accessed: - * \code - * uint8_t *buffer = img->GetBufferAsUInt8(); - * buffer[c + numComponents*(x+xSize*(y+ySize*z))] - * \endcode - * - * The pointer to the buffer is not referenced - * counted. Additionally, while this image is made unique before - * returnign the pointer, additional copying and usage may - * introduce unexpected aliasing. - * - * The correct method for the current pixel type of the image must - * be called or else an exception will be generated. For vector - * pixel types the type of the component of the vector must be called. - * - * \sa Image::GetPixelIDValue - * @{ - */ - int8_t *GetBufferAsInt8( ); - uint8_t *GetBufferAsUInt8( ); - int16_t *GetBufferAsInt16( ); - uint16_t *GetBufferAsUInt16( ); - int32_t *GetBufferAsInt32( ); - uint32_t *GetBufferAsUInt32( ); - int64_t *GetBufferAsInt64( ); - uint64_t *GetBufferAsUInt64( ); - float *GetBufferAsFloat( ); - double *GetBufferAsDouble( ); - - const int8_t *GetBufferAsInt8( ) const; - const uint8_t *GetBufferAsUInt8( ) const; - const int16_t *GetBufferAsInt16( ) const; - const uint16_t *GetBufferAsUInt16( ) const; - const int32_t *GetBufferAsInt32( ) const; - const uint32_t *GetBufferAsUInt32( ) const; - const int64_t *GetBufferAsInt64( ) const; - const uint64_t *GetBufferAsUInt64( ) const; - const float *GetBufferAsFloat( ) const; - const double *GetBufferAsDouble( ) const; - /** @} */ - - - /** \brief Performs actually coping if needed to make object unique. - * - * The Image class by default performs lazy coping and - * assignment. This method make sure that coping actually happens - * to the itk::Image pointed to is only pointed to by this object. - */ - void MakeUnique( void ); - - protected: - - /** \brief Methods called by the constructor to allocate and initialize - * an image. - * - * This method internally utlizes the member function factory to - * dispatch to methods instantiated on the image of the pixel ID - */ - void Allocate ( unsigned int width, unsigned int height, unsigned int depth, unsigned int dim4, PixelIDValueEnum valueEnum, unsigned int numberOfComponents ); - - /** \brief Dispatched methods for allocating images - * - * The enable if idiom is used here to enable different methods - * for different pixel/image types. - * - * @{ - */ - template - typename EnableIf::Value>::Type - AllocateInternal ( unsigned int width, unsigned int height, unsigned int depth, unsigned int dim4, unsigned int numberOfComponents ); - - template - typename EnableIf::Value>::Type - AllocateInternal ( unsigned int width, unsigned int height, unsigned int depth, unsigned int dim4, unsigned int numberOfComponents ); - - template - typename EnableIf::Value>::Type - AllocateInternal ( unsigned int width, unsigned int height, unsigned int depth, unsigned int dim4, unsigned int numberOfComponents ); - /**@}*/ - - - private: - - /** Method called by certain constructors to convert ITK images - * into simpleRTK ones. - * - * This is the single method which needs to be explicitly - * instantiated to separate the internal ITK and Pimple image from - * the external SimpleRTK interface. Template parameters have been - * choosen carefully to flexibly enable this. - */ - template - void InternalInitialization( typename PixelIDToImageType::Result, - VImageDimension>::ImageType *i ); - - /** Dispatched from the InternalInitialization method. The enable - * if idiom is used here for method overloading. The second method - * is for non-instantiated image, which turn into a void pointer - * for the paramter. However, this second method should never be - * executed. - * @{ - */ - template - typename DisableIf::value>::Type - ConditionalInternalInitialization( TImageType *i); - - template - typename EnableIf::value>::Type - ConditionalInternalInitialization( TImageType *) { assert( false ); } - /**@}*/ - - /** An addressor of AllocateInternal to be utilized with - * registering member functions with the factory. - */ - template < class TMemberFunctionPointer > - struct AllocateMemberFunctionAddressor - { - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - template< typename TImageType > - TMemberFunctionPointer operator() ( void ) const - { - return &ObjectType::template AllocateInternal< TImageType >; - } - }; - - PimpleImageBase *m_PimpleImage; - }; - -} -} - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkInterpolator.h b/utilities/SimpleRTK/Code/Common/include/srtkInterpolator.h deleted file mode 100644 index 20eeae50f..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkInterpolator.h +++ /dev/null @@ -1,119 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkInterpolator_h -#define __srtkInterpolator_h - -#include "srtkCommon.h" -#include - - -namespace rtk -{ -namespace simple -{ - -enum InterpolatorEnum { - /** \brief Nearest-neighbor interpolation - * \sa itk::NearestNeighborInterpolateImageFunction - */ - srtkNearestNeighbor = 1, - - /** \brief N-D linear interpolation - * \sa itk::LinearInterpolateImageFunction - */ - srtkLinear = 2, - - /** \brief B-Spline of order 3 interpolation - * \sa itk::BSplineInterpolateImageFunction - */ - srtkBSpline = 3, - - /** \brief Gaussian interpolation - * - * Sigma is set to 0.8 input pixels and alpha is 4.0 - * - * \sa itk::GaussianInterpolateImageFunction - */ - srtkGaussian = 4, - - /** \brief Smoothly interpolate multi-label images - * - * Sigma is set to 1.0 input pixels and alpha is 1.0 - * - * \sa itk:LabelImageGaussianInterpolateImageFunction - */ - srtkLabelGaussian = 5, - - /** \brief Windowed sinc interpolation - * - * \f[ w(x) = 0.54 + 0.46 cos(\frac{\pi x}{m} ) \f] - * - * \sa itk::WindowedSincInterpolateImageFunction - * \sa itk::Function::HammingWindowFunction - */ - srtkHammingWindowedSinc = 6, - - /** \brief Windowed sinc interpolation - * - * \f[ w(x) = cos(\frac{\pi x}{2 m} ) \f] - * - * \sa itk::WindowedSincInterpolateImageFunction - * \sa itk::Function::CosineWindowFunction - */ - srtkCosineWindowedSinc = 7, - - /** \brief Windowed sinc interpolation - * - * \f[ w(x) = 1 - ( \frac{x^2}{m^2} ) \f] - * - * \sa itk::WindowedSincInterpolateImageFunction - * \sa itk::Function::WelchWindowFunction - */ - srtkWelchWindowedSinc = 8, - - /** \brief Windowed sinc interpolation - * - * \f[ w(x) = \textrm{sinc} ( \frac{x}{m} ) \f] - * - * \sa itk::WindowedSincInterpolateImageFunction - * \sa itk::Function::LanczosWindowFunction - */ - srtkLanczosWindowedSinc = 9, - - /** \brief Windowed sinc interpolation - * - * \f[ w(x) = 0.42 + 0.5 cos(\frac{\pi x}{m}) + 0.08 cos(\frac{2 \pi x}{m}) \f] - * - * \sa itk::WindowedSincInterpolateImageFunction - * \sa itk::Function::BlackmanWindowFunction - */ - srtkBlackmanWindowedSinc = 10 -}; - -#ifndef SWIG -/** - * Convert Interpolator enum to a string for printing etc.. - */ -SRTKCommon_EXPORT std::ostream& operator<<(std::ostream& os, const InterpolatorEnum i); -#endif - -} // end namespace simple -} // end namespace rtk - - -#endif //__srtkInterpolator_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkMacro.h b/utilities/SimpleRTK/Code/Common/include/srtkMacro.h deleted file mode 100644 index 9f5caf472..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkMacro.h +++ /dev/null @@ -1,130 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkMacro_h -#define srtkMacro_h - -#include -#include -#include -#include -#include - -#include "srtkConfigure.h" - - -// Setup symbol exports -// -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define SRTK_ABI_EXPORT __attribute__ ((dllexport)) - #define SRTK_ABI_IMPORT __attribute__ ((dllimport)) - #define SRTK_ABI_HIDDEN - #else - #define SRTK_ABI_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. - #define SRTK_ABI_IMPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. - #define SRTK_ABI_HIDDEN - #endif -#else - #if __GNUC__ >= 4 - #define SRTK_ABI_EXPORT __attribute__ ((visibility ("default"))) - #define SRTK_ABI_IMPORT __attribute__ ((visibility ("default"))) - #define SRTK_ABI_HIDDEN __attribute__ ((visibility ("hidden"))) - #else - #define SRTK_ABI_EXPORT - #define SRTK_ABI_IMPORT - #define SRTK_ABI_HIDDEN - #endif -#endif - - -#if __cplusplus >= 201103L -// In c++11 the override keyword allows you to explicity define that a function -// is intended to override the base-class version. This makes the code more -// managable and fixes a set of common hard-to-find bugs. -#define SRTK_OVERRIDE override -// In C++11 the throw-list specification has been deprecated, -// replaced with the noexcept specifier. Using this function -// specification adds the run-time check that the method does not -// throw. If it does throw then std::terminate will be called. -// Use cautiously. -#define SRTK_NOEXCEPT noexcept -#else -#define SRTK_OVERRIDE -#define SRTK_NOEXCEPT throw() -#endif - - -#if !defined(SRTK_RETURN_SELF_TYPE_HEADER) -#define SRTK_RETURN_SELF_TYPE_HEADER Self & -#endif - -namespace rtk { - -namespace simple { - -class GenericException; - -#define srtkExceptionMacro(x) \ - { \ - std::ostringstream message; \ - message << "srtk::ERROR: " x; \ - throw ::rtk::simple::GenericException(__FILE__, __LINE__, message.str().c_str()); \ - } - -#if defined(SRTK_HAS_CXX11_NULLPTR) && !defined(SRTK_HAS_TR1_SUB_INCLUDE) -#define SRTK_NULLPTR nullptr -#else -#define SRTK_NULLPTR NULL -#endif - - -#define srtkMacroJoin( X, Y ) srtkDoMacroJoin( X, Y ) -#define srtkDoMacroJoin( X, Y ) srtkDoMacroJoin2(X,Y) -#define srtkDoMacroJoin2( X, Y ) X##Y - -#ifdef SRTK_HAS_CXX11_STATIC_ASSERT -// utilize the c++11 static_assert if available -#define srtkStaticAssert( expr, str) static_assert( expr, str ) -#else - -template struct StaticAssertFailure; -template<> struct StaticAssertFailure{ enum { Value = 1 }; }; - -#define srtkStaticAssert( expr, str ) enum { srtkMacroJoin( static_assert_typedef, __LINE__) = sizeof( rtk::simple::StaticAssertFailure<((expr) == 0 ? false : true )> ) }; - - -#endif -} -} - -#define srtkPragma(x) _Pragma (#x) - -#if defined(__clang__) && defined(__has_warning) -#define srtkClangDiagnosticPush() srtkPragma( clang diagnostic push ) -#define srtkClangDiagnosticPop() srtkPragma( clang diagnostic pop ) -#define srtkClangWarningIgnore_0(x) -#define srtkClangWarningIgnore_1(x) srtkPragma( clang diagnostic ignored x) -#define srtkClangWarningIgnore(x) srtkMacroJoin( srtkClangWarningIgnore_, __has_warning(x) )(x) -#else -#define srtkClangDiagnosticPush() -#define srtkClangDiagnosticPop() -#define srtkClangWarningIgnore(x) -#endif - - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.h b/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.h deleted file mode 100644 index adfa6426f..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.h +++ /dev/null @@ -1,165 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkMemberFunctionFactory_h -#define __srtkMemberFunctionFactory_h - -#include "srtkDetail.h" -#include "srtkMemberFunctionFactoryBase.h" -#include "srtkPixelIDValues.h" - -namespace rtk -{ -namespace simple -{ -// this namespace is internal classes not part of the external simple ITK interface -namespace detail { - -/** \class MemberFunctionFactory - * \brief A class used to instantiate and generate function object to - * templated member functions. - * - * \tparam TMemberFunctionPointer is the type of pointer to member - * function - * - * Example member function pointer: - * \code - * typedef Self& (Self::*MemberFunctionType)( Image* ); - * \endcode - * - * The RegisterMemberFunctions instantiate the templeted member - * functions and registers the member function pointer, so that it - * be used for dispatch later. Later they can be retrieve - * with the GetMemberFunction methods, which return a function object - * with the same arguments as the templated member function pointer. - * - * An instance of a MemberFunctionFactory is bound to a specific - * instance of an object, so that the returned function object does - * not need to have the calling object specified. - */ -template -class MemberFunctionFactory - : protected MemberFunctionFactoryBase -{ - -public: - - typedef MemberFunctionFactoryBase Superclass; - typedef MemberFunctionFactory Self; - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - typedef typename Superclass::FunctionObjectType FunctionObjectType; - - /** \brief Constructor which permanently binds the constructed - * object to pObject */ - MemberFunctionFactory( ObjectType *pObject ); - - /** \brief Registers a specific member function. - * - * Registers a member function which will be dispatched to the - * TImageType type - */ - template< typename TImageType > - void Register( MemberFunctionType pfunc, TImageType* ); - - /** \brief Registers all member functions in TPixelIDTypeList and - * simple::InstantiatedPixelIDTypeList over itk::Image - * - * \tparam TAddressor is the type of a class who as a - * templated operator() which returns TMemberFunctionPointer, this - * will default to detail::MemberFunctionAddressor if not specified - * - * Example usage: - * \code - * template < class TMemberFunctionPointer > - * struct AllocateAddressor - * { - * typedef typename ::detail::FunctionTraits::ClassType ObjectType; - * - * template< typename TImageType > - * TMemberFunctionPointer operator() ( void ) const - * { - * return &ObjectType::template AllocateInternal< TImageType >; - * } - * }; - * - * this->m_MemberFunctionFactory->RegisterMemberFunctions > (); - * \endcode - * - * - * Example usage: - * \code - * this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - * this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - * \endcode - * @{ - */ - template < typename TPixelIDTypeList, - unsigned int VImageDimension, - typename TAddressor > - void RegisterMemberFunctions( void ); - template < typename TPixelIDTypeList, unsigned int VImageDimension > - void RegisterMemberFunctions( void ) - { - typedef detail::MemberFunctionAddressor< TMemberFunctionPointer > AddressorType; - this->RegisterMemberFunctions< TPixelIDTypeList, VImageDimension, AddressorType >(); - } - /** @} */ - - /** \brief Query to determine if an member function has been - * registered for pixelID and imageDimension - */ - bool HasMemberFunction( PixelIDValueType pixelID, unsigned int imageDimension ) const throw(); - - /** \brief Returns a function object for the PixelIndex, and image - * dimension. - * - * pixelID is the value of Image::GetPixelIDValue(), or - * PixelIDToPixelIDValue::Result - * - * imageDimension is the the value returned by Image::GetDimension() - * - * Example usage: - * \code - * PixelIDValueType pixelID = image->GetPixelIDValue(); - * unsigned int dimension = image->GetDimension(); - * return this->m_MemberFactory->GetMemberFunction( pixelID, dimension )( image ); - * \endcode - * - * If the requested member function is not registered then an - * exception is generated. The returned function object is - * guaranteed to be valid. - */ - FunctionObjectType GetMemberFunction( PixelIDValueType pixelID, unsigned int imageDimension ); - -protected: - - ObjectType *m_ObjectPointer; - -}; - -} // end namespace detail -} // end namespace simple -} // end namespace rtk - -#include "srtkMemberFunctionFactory.hxx" - -#endif // __srtkMemberFunctionFactory_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.hxx b/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.hxx deleted file mode 100644 index 2690df69d..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactory.hxx +++ /dev/null @@ -1,224 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkMemberFunctionFactory_hxx -#define __srtkMemberFunctionFactory_hxx - -#include - -#include "srtkMemberFunctionFactory.h" -#include "srtkDetail.h" -#include "srtkPixelIDTokens.h" -#include "srtkEnableIf.h" -#include "srtkExceptionObject.h" - -namespace rtk -{ -namespace simple -{ -// this namespace is internal classes not part of the external simple ITK interface -namespace detail { - - -// a privately declared predicate for use with the typelist::ForEach -// algorithm -// -// This predicate calls the provided AddressorType on -// each valid ImageType defined from the pixel type id, and the -// provided dimension -template < typename TMemberFunctionFactory, unsigned int VImageDimension, typename TAddressor > -struct MemberFunctionInstantiater -{ - MemberFunctionInstantiater( TMemberFunctionFactory &factory ) - : m_Factory( factory ) - {} - - template - typename EnableIf< IsInstantiated::Value >::Type - operator()( TPixelIDType*id=NULL ) const - { - Unused( id ); - typedef typename PixelIDToImageType::ImageType ImageType; - typedef TAddressor AddressorType; - - AddressorType addressor; - m_Factory.Register(addressor.CLANG_TEMPLATE operator()(), (ImageType*)(NULL)); - - } - - // this methods is conditionally enabled when the PixelID is not instantiated - template - typename DisableIf< IsInstantiated::Value >::Type - operator()( TPixelIDType*id=NULL ) const - { - Unused( id ); - } - -private: - - TMemberFunctionFactory &m_Factory; -}; - -template -MemberFunctionFactory -::MemberFunctionFactory( typename MemberFunctionFactory::ObjectType *pObject ) - : m_ObjectPointer( pObject ) -{ - assert( pObject ); -} - -template -template -void MemberFunctionFactory -::Register( typename MemberFunctionFactory::MemberFunctionType pfunc, TImageType* ) -{ - PixelIDValueType pixelID = ImageTypeToPixelIDValue::Result; - - // this shouldn't occour, just may be useful for debugging - assert( pixelID >= 0 && pixelID < typelist::Length< InstantiatedPixelIDTypeList >::Result ); - - srtkStaticAssert( IsInstantiated::Value, - "UnInstantiated ImageType or dimension"); - - if ( pixelID >= 0 && pixelID < typelist::Length< InstantiatedPixelIDTypeList >::Result ) - { - switch( int(TImageType::ImageDimension) ) - { - case 4: - Superclass::m_PFunction4[ pixelID ] = Superclass::BindObject( pfunc, m_ObjectPointer ); - break; - case 3: - Superclass::m_PFunction3[ pixelID ] = Superclass::BindObject( pfunc, m_ObjectPointer ); - break; - case 2: - Superclass::m_PFunction2[ pixelID ] = Superclass::BindObject( pfunc, m_ObjectPointer ); - break; - default: - break; - } - } -} - -template -template -void MemberFunctionFactory -::RegisterMemberFunctions( void ) -{ - typedef MemberFunctionInstantiater< MemberFunctionFactory, VImageDimension,TAddressor > InstantiaterType; - - // visit each type in the list, and register if instantiated - typelist::Visit visitEachType; - visitEachType( InstantiaterType( *this ) ); -} - - -template -bool -MemberFunctionFactory< TMemberFunctionPointer > -::HasMemberFunction( PixelIDValueType pixelID, unsigned int imageDimension ) const throw() -{ - - try - { - switch ( imageDimension ) - { - case 4: - // check if tr1::function has been set in map - return Superclass::m_PFunction4.find( pixelID ) != Superclass::m_PFunction4.end(); - case 3: - // check if tr1::function has been set in map - return Superclass::m_PFunction3.find( pixelID ) != Superclass::m_PFunction3.end(); - case 2: - // check if tr1::function has been set in map - return Superclass::m_PFunction2.find( pixelID ) != Superclass::m_PFunction2.end(); - default: - return false; - } - } - // we do not throw exceptions - catch(...) - { - return false; - } -} - - -template -typename MemberFunctionFactory::FunctionObjectType -MemberFunctionFactory -::GetMemberFunction( PixelIDValueType pixelID, unsigned int imageDimension ) -{ - if ( pixelID >= typelist::Length< InstantiatedPixelIDTypeList >::Result || pixelID < 0 ) - { - srtkExceptionMacro ( << "unexpected error pixelID is out of range " << pixelID << " " << typeid(ObjectType).name() ); - } - - switch ( imageDimension ) - { - case 4: - // check if tr1::function has been set - if ( Superclass::m_PFunction4.find( pixelID ) != Superclass::m_PFunction4.end() ) - { - return Superclass::m_PFunction4[ pixelID ]; - } - - srtkExceptionMacro ( << "Pixel type: " - << GetPixelIDValueAsString(pixelID) - << " is not supported in 4D by " - << typeid(ObjectType).name() - << " or SimpleRTK compiled with SRTK_4D_IMAGES set to OFF." ); - case 3: - // check if tr1::function has been set - if ( Superclass::m_PFunction3.find( pixelID ) != Superclass::m_PFunction3.end() ) - { - return Superclass::m_PFunction3[ pixelID ]; - } - - srtkExceptionMacro ( << "Pixel type: " - << GetPixelIDValueAsString(pixelID) - << " is not supported in 3D by" - << typeid(ObjectType).name() ); - - break; - case 2: - // check if tr1::function has been set - if ( Superclass::m_PFunction2.find( pixelID ) != Superclass::m_PFunction2.end() ) - { - return Superclass::m_PFunction2[ pixelID ]; - } - - srtkExceptionMacro ( << "Pixel type: " - << GetPixelIDValueAsString(pixelID) - << " is not supported in 2D by" - << typeid(ObjectType).name() ); - - break; - default: - srtkExceptionMacro ( << "Image dimension " << imageDimension << " is not supported" ); - throw; - } -} - - -} // end namespace detail -} // end namespace simple -} // end namespace rtk - - -#endif // __srtkMemberFunctionFactory_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactoryBase.h b/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactoryBase.h deleted file mode 100644 index 484cb3a5f..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkMemberFunctionFactoryBase.h +++ /dev/null @@ -1,459 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkMemberFunctionFactoryBase_h -#define __srtkMemberFunctionFactoryBase_h - -#include "srtkConfigure.h" - -#include "nsstd/functional.h" - -#include "srtkPixelIDTypes.h" -#include "srtkPixelIDTypeLists.h" -#include "srtkMacro.h" -#include "srtkNonCopyable.h" - -#include "Ancillary/TypeList.h" -#include "Ancillary/FunctionTraits.h" - -#if defined SRTK_HAS_UNORDERED_MAP -#include "nsstd/unordered_map.h" -#else -#include -#endif - -namespace rtk -{ -namespace simple -{ - -// this namespace is internal classes not part of the external simple ITK interface -namespace detail { - - -#if defined SRTK_HAS_UNORDERED_MAP - -template struct hash : public nsstd::hash{}; - -/** \brief A specialization of the hash function. - */ -template <> -struct hash< std::pair > - : public std::unary_function, std::size_t> { - std::size_t operator()( const std::pair &p ) const - { return nsstd::hash()( size_t(p.first) * prime + p.second ); } -private: - static const std::size_t prime = 16777619u; -}; -#endif - -template< typename TMemberFunctionPointer, - typename TKey, - unsigned int TArity = ::detail::FunctionTraits::arity> -class MemberFunctionFactoryBase; - - -/** \class MemberFunctionFactoryBase - * \brief A base class for the MemberFunctionFactory - * - * This class is for specialization needed for different arity for - * the templated member function pointer - */ -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - - - MemberFunctionFactoryBase( void ) -#if defined RITK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object */ - typedef nsstd::function< MemberFunctionResultType ( ) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object. - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc,objectPointer ); - } - - // maps of Keys to pointers to member functions -#if defined SRTK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - -}; - - -/** \class MemberFunctionFactoryBase - * \brief A base class for the MemberFunctionFactory - * - * This class is for specialization needed for different arity for - * the templated member function pointer - */ -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - typedef typename ::detail::FunctionTraits::Argument0Type MemberFunctionArgumentType; - - - MemberFunctionFactoryBase( void ) -#if defined SRTK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object */ - typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgumentType ) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object. - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - // needed for _1 place holder - using namespace nsstd::placeholders; - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc,objectPointer, _1 ); - } - - - // maps of Keys to pointers to member functions -#if defined SRTK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - - -}; - - -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - typedef typename ::detail::FunctionTraits::Argument0Type MemberFunctionArgument0Type; - typedef typename ::detail::FunctionTraits::Argument1Type MemberFunctionArgument1Type; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - - MemberFunctionFactoryBase( void ) -#if defined SRTK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object - */ - typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - // needed for _1 place holder - using namespace nsstd::placeholders; - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc, objectPointer, _1, _2 ); - } - - - // maps of Keys to pointers to member functions -#if defined SRTK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - - -}; - - -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - typedef typename ::detail::FunctionTraits::Argument0Type MemberFunctionArgument0Type; - typedef typename ::detail::FunctionTraits::Argument1Type MemberFunctionArgument1Type; - typedef typename ::detail::FunctionTraits::Argument2Type MemberFunctionArgument2Type; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - - MemberFunctionFactoryBase( void ) -#if defined SRTK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object */ - typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - // needed for _1 place holder - using namespace nsstd::placeholders; - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc, objectPointer, _1, _2, _3 ); - } - - - // maps of Keys to pointers to member functions -#if defined SRTK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - -}; - - -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - typedef typename ::detail::FunctionTraits::Argument0Type MemberFunctionArgument0Type; - typedef typename ::detail::FunctionTraits::Argument1Type MemberFunctionArgument1Type; - typedef typename ::detail::FunctionTraits::Argument2Type MemberFunctionArgument2Type; - typedef typename ::detail::FunctionTraits::Argument3Type MemberFunctionArgument3Type; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - - MemberFunctionFactoryBase( void ) -#if defined SRTK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object */ - typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type, MemberFunctionArgument3Type) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - // needed for _1 place holder - using namespace nsstd::placeholders; - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc, objectPointer, _1, _2, _3, _4 ); - } - - - // maps of Keys to pointers to member functions -#if defined SRTK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - -}; - -template< typename TMemberFunctionPointer, typename TKey> -class MemberFunctionFactoryBase : - protected NonCopyable -{ -protected: - - typedef TMemberFunctionPointer MemberFunctionType; - typedef typename ::detail::FunctionTraits::ResultType MemberFunctionResultType; - typedef typename ::detail::FunctionTraits::Argument0Type MemberFunctionArgument0Type; - typedef typename ::detail::FunctionTraits::Argument1Type MemberFunctionArgument1Type; - typedef typename ::detail::FunctionTraits::Argument2Type MemberFunctionArgument2Type; - typedef typename ::detail::FunctionTraits::Argument3Type MemberFunctionArgument3Type; - typedef typename ::detail::FunctionTraits::Argument4Type MemberFunctionArgument4Type; - typedef typename ::detail::FunctionTraits::ClassType ObjectType; - - - MemberFunctionFactoryBase( void ) -#if defined SRTK_HAS_UNORDERED_MAP - : m_PFunction4( typelist::Length::Result ), - m_PFunction3( typelist::Length::Result ), - m_PFunction2( typelist::Length::Result ) -#endif - { } - -public: - - /** the pointer MemberFunctionType redefined ad a tr1::function - * object */ - typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type, MemberFunctionArgument3Type, MemberFunctionArgument4Type ) > FunctionObjectType; - - -protected: - - typedef TKey KeyType; - - /** A function which binds the objectPointer to the calling object - * argument in the member function pointer, and returns a function - * object - */ - static FunctionObjectType BindObject( MemberFunctionType pfunc, ObjectType *objectPointer) - { - // needed for _1 place holder - using namespace nsstd::placeholders; - - // this is really only needed because std::bind1st does not work - // with tr1::function... that is with tr1::bind, we need to - // specify the other arguments, and can't just bind the first - return nsstd::bind( pfunc, objectPointer, _1, _2, _3, _4, _5 ); - } - - - // maps of Keys to pointers to member functions -#if defined SITK_HAS_UNORDERED_MAP - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction4; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction3; - nsstd::unordered_map< TKey, FunctionObjectType, hash > m_PFunction2; -#else - std::map m_PFunction4; - std::map m_PFunction3; - std::map m_PFunction2; -#endif - -}; - -} // end namespace detail -} // end namespace simple -} // end namespace rtk - -#endif // __srtkMemberFunctionFactoryBase_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkNonCopyable.h b/utilities/SimpleRTK/Code/Common/include/srtkNonCopyable.h deleted file mode 100644 index 6c2244073..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkNonCopyable.h +++ /dev/null @@ -1,76 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkNonCopyable_h -#define srtkNonCopyable_h - -#include "srtkCommon.h" - -namespace rtk -{ -namespace simple -{ - -/** \class NonCopyable -* \brief An inheratable class to disable copying of a class -* -* This class disable the implicit implementations of the assignment -* and copy constructor for derived classes. The instantiation of the -* default implementation for either method in a derived class will -* result in a compile-time error because they are private in this -* class. However, this policy is not absolute for derived classes -* because explicit implementation of these methods could be -* implemented. -* -* An advatange this apporach has is the class heiarchy makes it -* obvious what the intent is, as compared to other appoaches. -* -* For example you should not be able to copy singleton object, because -* there should only be one of them. To utilize this class just derive -* from it: -* \code -* class Singleton -* : protected NonCopyable {...}; -* \endcode -* -*/ -class SRTKCommon_EXPORT NonCopyable -{ -protected: - NonCopyable() {} -private: - NonCopyable &operator=( const NonCopyable & ); // Not implemented on purpose - NonCopyable( const NonCopyable & ); // Not implemented on purpose -}; - -#if SITK_EXPLICIT_DEFAULT_DELETE_FUNCTIONS - -// see other implementation for doxygen -struct NonCopyable -{ - NonCopyable() = default; - NonCopyable &operator=( const NonCopyable & ) = delete; - NonCopyable( const NonCopyable & ) = delete; -}; - -#endif - - -} // end namespace simple -} // end namespace itk - -#endif // srtkNonCopyable_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTokens.h b/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTokens.h deleted file mode 100644 index 086df432e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTokens.h +++ /dev/null @@ -1,133 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPixelIDTokens_h -#define __srtkPixelIDTokens_h - -#include "srtkConfigure.h" -#include "srtkPixelIDValues.h" -#include "nsstd/type_traits.h" - -namespace rtk -{ -namespace simple -{ - -typedef nsstd::true_type TrueType; -typedef nsstd::false_type FalseType; - -template -struct IsBasic -{ - static const bool Value = FalseType::value; - typedef typename FalseType::value_type ValueType; - typedef typename FalseType::type Type; -}; -template -struct IsBasic< BasicPixelID > -{ - static const bool Value = TrueType::value; - typedef typename TrueType::value_type ValueType; - typedef typename TrueType::type Type; -}; -#ifdef RTK_USE_CUDA -template -struct IsBasic< itk::CudaImage< TPixelType, VImageDimension> > - : public IsBasic< typename ImageTypeToPixelID< itk::CudaImage >::PixelIDType > -#else -template -struct IsBasic< itk::Image< TPixelType, VImageDimension> > - : public IsBasic< typename ImageTypeToPixelID< itk::Image >::PixelIDType > -#endif -{}; - - -template -struct IsVector -{ - static const bool Value = FalseType::value; - typedef typename FalseType::value_type ValueType; - typedef typename FalseType::type Type; -}; -template -struct IsVector< VectorPixelID > -{ - static const bool Value = TrueType::value; - typedef typename TrueType::value_type ValueType; - typedef typename TrueType::type Type; -}; -template -struct IsVector< itk::VectorImage< TPixelType, VImageDimension> > - : public IsVector< typename ImageTypeToPixelID< itk::VectorImage >::PixelIDType > -{}; - - -template -struct IsLabel -{ - static const bool Value = FalseType::value; - typedef typename FalseType::value_type ValueType; - typedef typename FalseType::type Type; -}; -template -struct IsLabel< LabelPixelID > -{ - static const bool Value = TrueType::value; - typedef typename TrueType::value_type ValueType; - typedef typename TrueType::type Type; -}; -template -struct IsLabel< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > > - : public IsLabel< typename ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType > -{}; - - -template -struct IsInstantiated -{ - static const bool Value = ((int)PixelIDToPixelIDValue::Result != (int)srtkUnknown) - && ( (VImageDimension == 0)||(VImageDimension == 2) || (VImageDimension == 3) -#ifdef SRTK_4D_IMAGES - || (VImageDimension == 4) -#endif - ); - typedef typename nsstd::integral_constant::value_type ValueType; - typedef typename nsstd::integral_constant::type Type; -}; -#ifdef RTK_USE_CUDA - template -struct IsInstantiated< itk::CudaImage< TPixelType, VImageDimension>, 0 > - : public IsInstantiated< typename ImageTypeToPixelID< itk::CudaImage >::PixelIDType, VImageDimension > -#else - template -struct IsInstantiated< itk::Image< TPixelType, VImageDimension>, 0 > - : public IsInstantiated< typename ImageTypeToPixelID< itk::Image >::PixelIDType, VImageDimension > -#endif -{}; -template -struct IsInstantiated< itk::VectorImage< TPixelType, VImageDimension>, 0 > - : public IsInstantiated< typename ImageTypeToPixelID< itk::VectorImage >::PixelIDType, VImageDimension > -{}; -template -struct IsInstantiated< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > >, 0 > - : public IsInstantiated< typename ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType, VImageDimension > -{}; - -} -} - -#endif // _srtkPixelIDTokens_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypeLists.h b/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypeLists.h deleted file mode 100644 index 74de5fa2e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypeLists.h +++ /dev/null @@ -1,209 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPixelIDTypeLists_h -#define __srtkPixelIDTypeLists_h - -#include - -#include "srtkConfigure.h" -#include "srtkPixelIDTypes.h" - -#include "Ancillary/TypeList.h" - -#include - -namespace rtk -{ -namespace simple -{ - - -/** List of all pixel ids for the itk::Image class. - * - * \todo adress vnl issues with long long types - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList, - BasicPixelID, - BasicPixelID, - BasicPixelID, - BasicPixelID, - BasicPixelID, -#ifdef SRTK_INT64_PIXELIDS - BasicPixelID, - BasicPixelID, -#endif - BasicPixelID, - BasicPixelID >::Type BasicPixelIDTypeList; - -/** List of all single valued images of the itk::Image class. - * - * \sa BasicPixelID - */ -typedef BasicPixelIDTypeList ScalarPixelIDTypeList; - - -/** List of pixel ids which are integer types for the itk::Image class. - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList, - BasicPixelID, - BasicPixelID, - BasicPixelID, - BasicPixelID, - BasicPixelID -#ifdef SRTK_INT64_PIXELIDS - , BasicPixelID, - BasicPixelID -#endif - >::Type IntegerPixelIDTypeList; - - -/** List of pixel ids which are real types for the itk::Image class. - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList, - BasicPixelID >::Type RealPixelIDTypeList; - -/** List of pixel ids which are std::complex types for the itk::Image class. - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList< BasicPixelID >, - BasicPixelID > >::Type ComplexPixelIDTypeList; - -/** List of pixel ids which are signed - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList, - BasicPixelID, - BasicPixelID, -#ifdef SRTK_INT64_PIXELIDS - BasicPixelID, -#endif - BasicPixelID, - BasicPixelID >::Type SignedPixelIDTypeList; - - - -/** List of pixel ids which are vectors for itk::VectorImage class. - * - * \sa VectorPixelID - */ -typedef typelist::MakeTypeList, - VectorPixelID, - VectorPixelID, - VectorPixelID, - VectorPixelID, - VectorPixelID, -#ifdef SRTK_INT64_PIXELIDS - VectorPixelID, - VectorPixelID, -#endif - VectorPixelID, - VectorPixelID >::Type VectorPixelIDTypeList; - - -/** List of pixel ids which are real vectors for itk::VectorImage class. - * - * \sa VectorPixelID - */ -typedef typelist::MakeTypeList, - VectorPixelID >::Type RealVectorPixelIDTypeList; - -/** List of pixel ids which are signed of vectors - * - * \sa BasicPixelID - */ -typedef typelist::MakeTypeList< VectorPixelID, - VectorPixelID, - VectorPixelID, - VectorPixelID, - VectorPixelID >::Type SignedVectorPixelIDTypeList; - - -/** List of pixel ids which are for itk::LabelMap Image class. - * - * \sa LabelPixelID - */ -typedef typelist::MakeTypeList, - LabelPixelID, - LabelPixelID -#ifdef SRTK_INT64_PIXELIDS - ,LabelPixelID -#endif - >::Type LabelPixelIDTypeList; - -/** List of all pixel ids available, but itk::LabelMap this include image of itk::Image, - * itk::VectorImage - * - * - * \sa BasicPixelID - * \sa VectorPixelID - * \sa LabelPixelID - */ -typedef typelist::Append< - typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList >::Type, - VectorPixelIDTypeList - >::Type NonLabelPixelIDTypeList; - - -/** List of all pixel ids available, this include image of itk::Image, - * itk::VectorImage, and itk::LabelMap types. - * - * \todo This needs to be extended to include LabelMap pixel ids. - * - * \sa BasicPixelID - * \sa VectorPixelID - * \sa LabelPixelID - */ -typedef typelist::Append< - typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList >::Type, - typelist::Append< VectorPixelIDTypeList, LabelPixelIDTypeList >::Type - >::Type AllPixelIDTypeList; - - -#ifdef SRTK_EXPRESS_INSTANTIATEDPIXELS - - -// this is a quick and dirty list to only be used for development purposes -typedef typelist::MakeTypeList< BasicPixelID, BasicPixelID, BasicPixelID, VectorPixelID >::Type InstantiatedPixelIDTypeList; - -#else - -/** List of pixel ids which are instantiated for use in SimpleRTK - * - * this include image of itk::Image,itk::VectorImage, and - * itk::LabelMap types. - * - * \sa BasicPixelID - * \sa VectorPixelID - * \sa LabelPixelID - */ -typedef AllPixelIDTypeList InstantiatedPixelIDTypeList; - -#endif - - -} -} -#endif // _srtkPixelIDTypeLists_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypes.h b/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypes.h deleted file mode 100644 index db40e474b..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDTypes.h +++ /dev/null @@ -1,173 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPixelIDTypes_h -#define __srtkPixelIDTypes_h - -#include "rtkConfiguration.h" - -namespace itk -{ -#ifdef RTK_USE_CUDA -template class CudaImage; -#else -template class Image; -#endif -template class VectorImage; -template < typename TLabelObject > class LabelMap; -template < typename TLabelObject, unsigned int VImageDimension > class LabelObject; -} - -namespace rtk -{ -namespace simple -{ - -/** This type is used as an identity for pixel of itk::Image type - * - * This is an empty type which is used for compile-time - * meta-programming. It does not contain any information, an image - * type can be converted to one of the PixelID types, and an PixelID - * can be converted to a value. However, a run-time value can not be - * converted to this compile time type. - * - * \sa PixelIDToImageType - * \sa ImageTypeToPixelID - * \sa ImageTypeToPixelIDValue - * \sa PixelIDToPixelIDValue - */ -template -struct BasicPixelID -{}; - - -/** This type is used as an identity for pixel of itk::VectorImage type - * - * This is an empty type which is used for compile-time - * meta-programming. It does not contain any information, an image - * type can be converted to one of the PixelID types, and an PixelID - * can be converted to a value. However, a run-time value can not be - * converted to this compile time type. - * - * \sa PixelIDToImageType - * \sa ImageTypeToPixelID - * \sa ImageTypeToPixelIDValue - * \sa PixelIDToPixelIDValue - */ -template -struct VectorPixelID -{}; - - -/** This type is used as an identity for pixel of itk::LabelMap type - * - * This is an empty type which is used for compile-time - * meta-programming. It does not contain any information, an image - * type can be converted to one of the PixelID types, and an PixelID - * can be converted to a value. However, a run-time value can not be - * converted to this compile time type. - * - * \sa PixelIDToImageType - * \sa ImageTypeToPixelID - * \sa ImageTypeToPixelIDValue - * \sa PixelIDToPixelIDValue - */ -template -struct LabelPixelID -{}; - -/** A meta-programming tool to query the "itk image type" if a PixelID - * at compile type - * - * This structure contains one property, - * PixelIDToImageType::ImageType is the "itk image type" of the - * pixel ID. - * - * \sa BasicPixelID - * \sa VectorPixelID - * \sa LabelPixelID - * \sa ImageTypeToPixelIDValue - * - * @{ */ -template struct PixelIDToImageType; - -template -struct PixelIDToImageType< BasicPixelID , VImageDimension > -{ -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< TPixelType, VImageDimension > ImageType; -#else - typedef itk::Image< TPixelType, VImageDimension > ImageType; -#endif -}; - -template -struct PixelIDToImageType< VectorPixelID< TVectorPixelType >, VImageDimension > -{ - typedef itk::VectorImage< TVectorPixelType, VImageDimension > ImageType; -}; - -template -struct PixelIDToImageType< LabelPixelID< TLabelType >, VImageDimension > -{ - typedef itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > ImageType; -}; -/** @} */ - - -/** A meta-programming tool to query the PixelID property of an "itk - * image type" at compile type - * - * This structure contains one property, - * ImageTypeToPixelID::PixelIDType is the "itk image type" of the - * pixel ID. - * - * \sa BasicPixelID - * \sa VectorPixelID - * \sa LabelPixelID - * \sa ImageTypeToPixelIDValue - * - * @{ */ -template struct ImageTypeToPixelID; - -#ifdef RTK_USE_CUDA -template -struct ImageTypeToPixelID< itk::CudaImage< TPixelType, VImageDimension> > -#else -template -struct ImageTypeToPixelID< itk::Image< TPixelType, VImageDimension> > -#endif -{ - typedef BasicPixelID PixelIDType; -}; - -template -struct ImageTypeToPixelID< itk::VectorImage< TPixelType, VImageDimension> > -{ - typedef VectorPixelID< TPixelType > PixelIDType; -}; - -template -struct ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > > -{ - typedef LabelPixelID< TLabelType > PixelIDType; -}; -/** @} */ - -} -} -#endif // _srtkPixelIDTypes_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDValues.h b/utilities/SimpleRTK/Code/Common/include/srtkPixelIDValues.h deleted file mode 100644 index 8010ef89e..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkPixelIDValues.h +++ /dev/null @@ -1,125 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPixelIDValues_h -#define __srtkPixelIDValues_h - -#include "srtkCommon.h" -#include "srtkPixelIDTypeLists.h" - -#include -#include - -namespace rtk -{ -namespace simple -{ - -typedef int PixelIDValueType; - -template < typename TPixelID > -struct PixelIDToPixelIDValue -{ - enum { Result = typelist::IndexOf::Result }; -}; - -template -struct ImageTypeToPixelIDValue -{ - enum { Result = PixelIDToPixelIDValue< typename ImageTypeToPixelID::PixelIDType>::Result }; -}; - -/** \brief Enumerated values of pixelIDs - * - * Each PixelID's value correspondes to the index of the PixelID type, - * in the type list "InstantiatedPixelIDTypeList". It is possible that - * different configurations for SimpleRTK could result in different - * values for pixelID. So these enumerated values should be used. - * - * Additionally, not all PixelID an instantiated in for the tool - * kit. If a PixelID is not instantiated then it's value is - * -1. Therefore it is likely that multiple elements in the - * enumeration will have a zero value. Therefore the first prefered - * methods is to use "if" statements, with the first branch checking - * for the Unknown value. - * - * If a switch case statement is needed the ConditionalValue - * meta-programming object can be used as follows: - * \code - * switch( pixelIDValue ) - * { - * case srtk::srtkUnknown: - * // handle exceptional case - * break - * case srtk::ConditionalValue< srtk::srtkUInt8 != srtk::srtkUnknown, srtk::srtkUInt8, -2 >::Value: - * ... - * break; - * case srtk::ConditionalValue< srtk::srtkInt8 != srtk::srtkUnknown, srtk::srtkInt8, -3 >::Value: - * ... - * break; - * case srtk::ConditionalValue< srtk::N != srtk::srtkUnknown, srtk::N, -N >::Value: - * ... - * break; - * default: - * // handle another exceptoinal case - * } - * \endcode - */ -enum PixelIDValueEnum { - srtkUnknown = -1, - srtkUInt8 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Unsigned 8 bit integer - srtkInt8 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Signed 8 bit integer - srtkUInt16 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Unsigned 16 bit integer - srtkInt16 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Signed 16 bit integer - srtkUInt32 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Unsigned 32 bit integer - srtkInt32 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Signed 32 bit integer - srtkUInt64 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Unsigned 64 bit integer - srtkInt64 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< Signed 64 bit integer - srtkFloat32 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< 32 bit float - srtkFloat64 = PixelIDToPixelIDValue< BasicPixelID >::Result, //< 64 bit float - srtkComplexFloat32 = PixelIDToPixelIDValue< BasicPixelID > >::Result, //< compelex number of 32 bit float - srtkComplexFloat64 = PixelIDToPixelIDValue< BasicPixelID > >::Result, //< compelex number of 64 bit float - srtkVectorUInt8 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of unsigned 8 bit integer - srtkVectorInt8 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of signed 8 bit integer - srtkVectorUInt16 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of unsigned 16 bit integer - srtkVectorInt16 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of signed 16 bit integer - srtkVectorUInt32 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of unsigned 32 bit integer - srtkVectorInt32 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of signed 32 bit integer - srtkVectorUInt64 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of unsigned 64 bit integer - srtkVectorInt64 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of signed 64 bit integer - srtkVectorFloat32 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of 32 bit float - srtkVectorFloat64 = PixelIDToPixelIDValue< VectorPixelID >::Result, //< Multi-component of 64 bit float - srtkLabelUInt8 = PixelIDToPixelIDValue< LabelPixelID >::Result, //< RLE label of unsigned 8 bit integers - srtkLabelUInt16 = PixelIDToPixelIDValue< LabelPixelID >::Result, //< RLE label of unsigned 16 bit integers - srtkLabelUInt32 = PixelIDToPixelIDValue< LabelPixelID >::Result, //< RLE label of unsigned 32 bit integers - srtkLabelUInt64 = PixelIDToPixelIDValue< LabelPixelID >::Result, //< RLE label of unsigned 64 bit integers -}; - - - -const std::string SRTKCommon_EXPORT GetPixelIDValueAsString( PixelIDValueType type ); -const std::string SRTKCommon_EXPORT GetPixelIDValueAsString( PixelIDValueEnum type ); - -#ifndef SWIG -SRTKCommon_EXPORT std::ostream& operator<<(std::ostream& os, const PixelIDValueEnum id); -#endif - - - -} -} -#endif // _srtkPixelIDValues_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkProcessObject.h b/utilities/SimpleRTK/Code/Common/include/srtkProcessObject.h deleted file mode 100644 index aa017f216..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkProcessObject.h +++ /dev/null @@ -1,367 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef srtkProcessObject_h -#define srtkProcessObject_h - -#include "srtkCommon.h" -#include "srtkNonCopyable.h" -#include "srtkTemplateFunctions.h" -#include "srtkEvent.h" -#include "srtkImage.h" - -#include -#include - -namespace itk { - -#ifndef SWIG - - template< typename T, unsigned int NVectorDimension > class Vector; - - class ProcessObject; - class Command; - class EventObject; -#endif -} - -namespace rtk { - namespace simple { - - class Command; - - - /** \class ProcessObject - * \brief Base class for SimpleRTK classes based on ProcessObject - * - */ - class SRTKCommon_EXPORT ProcessObject: - protected NonCopyable - { - public: - typedef ProcessObject Self; - - /** - * Default Constructor that takes no arguments and initializes - * default parameters - */ - ProcessObject(); - - /** - * Default Destructor - */ - virtual ~ProcessObject(); - - // Print ourselves out - virtual std::string ToString() const; - - /** return user readable name for the filter */ - virtual std::string GetName() const = 0; - - /** Turn debugging output on/off. - * - * Enabling debugging prints additional information to stdout - * about the execution of the internal filters. - * @{ - */ - virtual void DebugOn(); - virtual void DebugOff(); - /**@}*/ - - /** Get the value of the debug flag. - * @{ - */ - virtual bool GetDebug() const; - virtual void SetDebug(bool debugFlag); - /**@}*/ - - /** Turn default debugging output value on/off. - * - * This is the initial values used for new classes and - * procedural methods. - */ - static void GlobalDefaultDebugOn(); - static void GlobalDefaultDebugOff(); - /**@}*/ - - /** Get the value of the default debug flag. */ - static bool GetGlobalDefaultDebug(); - static void SetGlobalDefaultDebug(bool debugFlag); - /**@}*/ - - /** Manage warnings produced by ITK. - * - * Enabled by default, this parameter may enable printing - * of warnings indicating unstable state or parameters during - * execution. It is a global value set for all ITK filters and - * processes. - * @{ - */ - static void GlobalWarningDisplayOn(); - static void GlobalWarningDisplayOff(); - static void SetGlobalWarningDisplay(bool flag); - static bool GetGlobalWarningDisplay(); - /**@}*/ - - /** Set the number of threads that all new process objects are - * initialized with. - * @{ - */ - static void SetGlobalDefaultNumberOfThreads(unsigned int n); - static unsigned int GetGlobalDefaultNumberOfThreads(); - /**@}*/ - - /** \brief Access the global tolerance to determine congruent spaces. - * - * The default tolerance is governed by the - * GlobalDefaultCoordinateTolerance and the - * GlobalDefaultDirectionTolerance properties, defaulting to - * 1.0e-6. The default tolerance for spatial comparison is then - * scaled by the voxelSpacing for coordinates (i.e. the - * coordinates must be the same to within one part per - * million). For the direction cosines the values must be within - * the current absolute tolerance. - * @{ - */ - static double GetGlobalDefaultCoordinateTolerance(); - static void SetGlobalDefaultCoordinateTolerance(double ); - - static double GetGlobalDefaultDirectionTolerance(); - static void SetGlobalDefaultDirectionTolerance(double); - /**@}*/ - - /** The number of threads used when executing a filter if the - * filter is multi-threaded - * @{ - */ - virtual void SetNumberOfThreads(unsigned int n); - virtual unsigned int GetNumberOfThreads() const; - /**@}*/ - - /** \brief Add a Command Object to observer the event. - * - * The Command object's Execute method will be invoked when the - * internal ITK Object has the event. These events only occur - * during this ProcessObject's Execute method when the ITK - * filter is running. The command occurs in the same thread as - * this objects Execute methods was called in. - * - * An internal reference is made between the Command and this - * ProcessObject which enable automatic removal of the command - * when deleted. This enables both object to exist as stack - * based object and be automatically cleaned up. - * - * Unless specified otherwise, it's safe to get any value during - * execution. "Measurements" will have valid values only after - * the Execute method has returned. "Active Measurements" will - * have valid values during events, and access the underlying - * ITK object. - * - * Deleting a command this object has during a command call-back - * will produce undefined behavior. - * - * For more information see the page \ref CommandPage. - * - * \note The return value is reserved for latter usage. - */ - virtual int AddCommand(rtk::simple::EventEnum event, rtk::simple::Command &cmd); - - /** \brief Remove all registered commands. - * - * Calling when this object is invoking anther command will - * produce undefined behavior. - */ - virtual void RemoveAllCommands(); - - /** \brief Query of this object has any registered commands for event. */ - virtual bool HasCommand( rtk::simple::EventEnum event ) const; - - - /** \brief An Active Measurement of the progress of execution. - * - * Get the execution progress of the current process object. The - * progress is a floating number in [0,1] with 0 meaning no progress and 1 - * meaning the filter has completed execution (or aborted). - * - * This is an Active Measurement so it can be accessed during - * Events during the execution. - */ - virtual float GetProgress( ) const; - - /** Sets an abort flag on the active process. - * - * Requests the current active process to abort. Additional, - * progress or iteration event may occur. If aborted then, an - * AbortEvent should occur. The Progress should be set to 1.0 - * after aborting. - * - * The expected behavior is that not exception should be throw - * out of this processes Execute method. Additionally, the - * results returned are valid but undefined content. The - * content may be only partially updated, uninitialized or the a - * of size zero. - * - * If there is no active process the method has no effect. - */ - virtual void Abort(); - - protected: - - #ifndef SWIG - - struct EventCommand - { - EventCommand(EventEnum e, Command *c) - : m_Event(e), m_Command(c), m_ITKTag(std::numeric_limits::max()) - {} - EventEnum m_Event; - Command * m_Command; - - // set to max if currently not registered - unsigned long m_ITKTag; - - inline bool operator==(const EventCommand &o) const - { return m_Command == o.m_Command; } - inline bool operator<(const EventCommand &o) const - { return m_Command < o.m_Command; } - }; - - // method called before filter update to set parameters and - // connect commands. - virtual void PreUpdate( itk::ProcessObject *p ); - - // overridable method to add a command, the return value is - // placed in the m_ITKTag of the EventCommand object. - virtual unsigned long AddITKObserver(const itk::EventObject &, itk::Command *); - - // overridable method to remove a command - virtual void RemoveITKObserver( EventCommand &e ); - - // Create an ITK EventObject from the SimpleITK enumerated type. - static const itk::EventObject &GetITKEventObject(EventEnum e); - - // returns the current active process, if no active process then - // an exception is throw. - virtual itk::ProcessObject *GetActiveProcess( ); - - // overidable callback when the active process has completed - virtual void OnActiveProcessDelete( ); - - friend class rtk::simple::Command; - // method call by command when it's deleted, maintains internal - // references between command and process objects. - virtual void onCommandDelete(const rtk::simple::Command *cmd) throw(); - #endif - - - template< class TImageType > - static typename TImageType::ConstPointer CastImageToITK( const Image &img ) - { - typename TImageType::ConstPointer itkImage = - dynamic_cast < const TImageType* > ( img.GetITKBase() ); - - if ( itkImage.IsNull() ) - { - srtkExceptionMacro( "Unexpected template dispatch error!" ); - } - return itkImage; - } - - template< class TImageType > - static Image CastITKToImage( TImageType *img ) - { - return Image(img); - } - -#ifndef SWIG - template< class TPixelType, unsigned int VImageDimension, unsigned int VLength, - template class TVector > -#ifdef RTK_USE_CUDA - static Image CastITKToImage( itk::CudaImage< TVector< TPixelType, VLength >, VImageDimension> *img ) -#else - static Image CastITKToImage( itk::Image< TVector< TPixelType, VLength >, VImageDimension> *img ) -#endif - { - typedef itk::VectorImage< TPixelType, VImageDimension > VectorImageType; - - size_t numberOfElements = img->GetBufferedRegion().GetNumberOfPixels(); - typename VectorImageType::InternalPixelType* buffer = reinterpret_cast( img->GetPixelContainer()->GetBufferPointer() ); - - // Unlike an image of Vectors a VectorImage's container is a - // container of TPixelType, whos size is the image's number of - // pixels * number of pixels per component - numberOfElements *= VImageDimension; - - typename VectorImageType::Pointer out = VectorImageType::New(); - - // Set the image's pixel container to import the pointer provided. - out->GetPixelContainer()->SetImportPointer(buffer, numberOfElements, true ); - img->GetPixelContainer()->ContainerManageMemoryOff(); - out->CopyInformation( img ); - out->SetRegions( img->GetBufferedRegion() ); - - return Image(out.GetPointer()); - } -#endif - - /** - * Output operator to os with conversion to a printable type. - * - * That is char types are presumed to be numbers, and converted - * to int. - * @{ - */ - template - static std::ostream & ToStringHelper(std::ostream &os, const T &v) - { - os << v; - return os; - } - static std::ostream & ToStringHelper(std::ostream &os, const char &v); - static std::ostream & ToStringHelper(std::ostream &os, const signed char &v); - static std::ostream & ToStringHelper(std::ostream &os, const unsigned char &v); - /**@}*/ - - private: - - // Add command to active process object, the EventCommand's - // ITKTag must be unset as max or else an exception is - // thrown. The EventCommand's ITKTag is updated to the command - // registered to ITK's ProcessObject. It's assumed that there is - // an current active process - unsigned long AddObserverToActiveProcessObject( EventCommand &e ); - - // Remove the command from the active processes. Its is assumed - // that an active process exists. The tag is set to max after it - // is removed. - void RemoveObserverFromActiveProcessObject( EventCommand &e ); - - bool m_Debug; - unsigned int m_NumberOfThreads; - - std::list m_Commands; - - itk::ProcessObject *m_ActiveProcess; - - // - float m_ProgressMeasurement; - }; - - - } -} -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkTemplateFunctions.h b/utilities/SimpleRTK/Code/Common/include/srtkTemplateFunctions.h deleted file mode 100644 index b6c3d4f45..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkTemplateFunctions.h +++ /dev/null @@ -1,174 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkTemplateFunctions_h -#define __srtkTemplateFunctions_h - -#include "srtkMacro.h" -#include "srtkCommon.h" -#include "srtkExceptionObject.h" - -#include -#include -#include - -namespace itk { - template class ImageRegion; - } - -namespace rtk { -namespace simple { - -/** \brief A function which does nothing - * - * This function is to be used to mark parameters as unused to supress - * compiler warning. - */ -template -void SRTKCommon_HIDDEN Unused( const T &) {}; - -/** - * \brief Output the element of an std::vector to the output stream - * - * The elements of the std::vector are required to have operator<<. - * - * The format of the output should be "[ T, T, T ]". - */ -template -SRTKCommon_HIDDEN std::ostream & operator<<( std::ostream & os, const std::vector& v) -{ - if ( v.empty() ) - { - return os << "[ ]"; - } - - os << "[ "; - std::copy( v.begin(), v.end()-1, std::ostream_iterator(os, ", ") ); - return os << v.back() << " ]"; -} - -/** \brief Copy the elements of an std::vector into an ITK fixed width vector - * - * If there are more elements in paramter "in" than the templated ITK - * vector type, they are truncated. If less, then an exception is - * generated. - */ -template< typename TITKVector, typename TType> -TITKVector SRTKCommon_HIDDEN srtkSTLVectorToITK( const std::vector< TType > & in ) -{ - typedef TITKVector itkVectorType; - if ( in.size() < itkVectorType::Dimension ) - { - srtkExceptionMacro(<<"Unable to convert vector to ITK type\n" - << "Expected vector of length " << itkVectorType::Dimension - << " but only got " << in.size() << " elements." ); - } - itkVectorType out; - for( unsigned int i = 0; i < itkVectorType::Dimension; ++i ) - { - out[i] = in[i]; - } - return out; -} - -/** \brief Convert an ITK fixed width vector to a std::vector - */ -template -std::vector SRTKCommon_HIDDEN srtkITKVectorToSTL( const TITKVector & in ) -{ - std::vector out( TITKVector::Dimension ); - for( unsigned int i = 0; i < TITKVector::Dimension; ++i ) - { - out[i] = static_cast(in[i]); - } - return out; -} - - -template -std::vector SRTKCommon_HIDDEN srtkITKVectorToSTL(const std::vector & in) - { - std::vector out; - out.reserve(in.size()*TITKVector::Dimension); - typename std::vector::const_iterator iter = in.begin(); - while (iter != in.end()) - { - for (unsigned int i = 0; i < TITKVector::Dimension; ++i) - { - out.push_back(static_cast((*iter)[i])); - } - ++iter; - } - - return out; - } - -/** \brief Convert an ITK ImageRegion to and std::vector with the -* first part being the start index followed by the size. -*/ -template -std::vector SRTKCommon_HIDDEN srtkITKImageRegionToSTL(const itk::ImageRegion & in) - { - std::vector out(VImageDimension * 2); - for (unsigned int i = 0; i < VImageDimension; ++i) - { - out[i] = static_cast(in.GetIndex(i)); - out[VImageDimension + i] = static_cast(in.GetSize(i)); - } - return out; - } - - -/* \brief Convert to an itk::Matrix type, where the vector is in row -* major form. If the vector is of 0-size then an identity matrix will -* be constructed. -*/ -template< typename TDirectionType > -TDirectionType SRTKCommon_HIDDEN srtkSTLToITKDirection(const std::vector &direction) - { - TDirectionType itkDirection; - - if (direction.size() == 0) - { - itkDirection.SetIdentity(); - } - else if (direction.size() == TDirectionType::RowDimensions*TDirectionType::ColumnDimensions) - { - std::copy(direction.begin(), direction.end(), itkDirection.GetVnlMatrix().begin()); - } - else - { - srtkExceptionMacro(<< "Length of input (" << direction.size() << ") does not match matrix dimensions (" - << TDirectionType::RowDimensions << ", " << TDirectionType::ColumnDimensions << ").\n"); - } - return itkDirection; - } - - -template< typename TDirectionType > -std::vector SRTKCommon_HIDDEN srtkITKDirectionToSTL(const TDirectionType & d) - { - return std::vector(d.GetVnlMatrix().begin(), d.GetVnlMatrix().end()); - } - - - - -} -} - -#endif diff --git a/utilities/SimpleRTK/Code/Common/include/srtkThreeDCircularProjectionGeometry.h b/utilities/SimpleRTK/Code/Common/include/srtkThreeDCircularProjectionGeometry.h deleted file mode 100644 index 62b322a85..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkThreeDCircularProjectionGeometry.h +++ /dev/null @@ -1,134 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkThreeDCircularProjectionGeometry_h -#define __srtkThreeDCircularProjectionGeometry_h - -#include "srtkCommon.h" -#include "srtkExceptionObject.h" -#include - -namespace rtk{ - template class ProjectionGeometry; -} - -namespace rtk -{ -namespace simple -{ - -class PimpleThreeDCircularProjectionGeometry; - -/** \class ThreeDCircularProjectionGeometry - * \brief A simplified wrapper around RTK's ThreeDCircularProjectionGeometry. - * - */ -class SRTKCommon_EXPORT ThreeDCircularProjectionGeometry -{ -public: - typedef ThreeDCircularProjectionGeometry Self; - - /** \brief - */ - ThreeDCircularProjectionGeometry( void ); - virtual ~ThreeDCircularProjectionGeometry( void ); - - /** \brief Copy constructor and assignment operator - * Performs a shallow copy of the internal RTK Object. - * @{ - */ - ThreeDCircularProjectionGeometry &operator=( const ThreeDCircularProjectionGeometry & ); - ThreeDCircularProjectionGeometry( const ThreeDCircularProjectionGeometry & ); - /**@}*/ - - - /** Get access to internal RTK data object. - * @{ - */ - rtk::ProjectionGeometry<3>* GetRTKBase( void ); - const rtk::ProjectionGeometry<3>* GetRTKBase( void ) const; - /**@}*/ - - const std::vector &GetGantryAngles() const; - const std::vector &GetOutOfPlaneAngles() const; - const std::vector &GetInPlaneAngles() const; - const std::vector &GetSourceAngles() const; - const std::vector GetTiltAngles() const; - const std::vector &GetSourceToIsocenterDistances() const; - const std::vector &GetSourceOffsetsX() const; - const std::vector &GetSourceOffsetsY() const; - const std::vector &GetSourceToDetectorDistances() const; - const std::vector &GetProjectionOffsetsX() const; - const std::vector &GetProjectionOffsetsY() const; - const std::vector GetSourcePosition( const unsigned int i ) const; - const std::vector GetRotationMatrix( const unsigned int i) const; - const std::vector GetMatrix( const unsigned int i) const; - const std::vector GetProjectionCoordinatesToFixedSystemMatrix( const unsigned int i) const; - - const double GetRadiusCylindricalDetector(); - void SetRadiusCylindricalDetector(const double radius); - - /** Add the projection with angles in degress - * @{ - */ - void AddProjection(float sid, float sdd, float angle, float isox=0., float isoy=0., float oa=0., float ia=0., float sx=0., float sy=0.); - /**@}*/ - - /** Add the projection with angles in radians - * @{ - */ - void AddProjectionInRadians(float sid, float sdd, float angle, float isox=0., float isoy=0., float oa=0., float ia=0., float sx=0., float sy=0.); - /**@}*/ - - /** Add the projection with projection matrix - * @{ - */ - void AddProjection(const std::vector matrix); - /**@}*/ - - /** Add the projection with source and detector positions and orientations - * @{ - */ - void AddProjection(const std::vector sourcePosition, const std::vector detectorPosition, const std::vector detectorRowVector, const std::vector detectorColumnVector); - /**@}*/ - - /** Clear the geometry object - * @{ - */ - void Clear(); - /**@}*/ - - /** Return the current geometry as a string - * @{ - */ - std::string ToString( void ) const; - /**@}*/ - -protected: - -private: - - // As is the architecture of all SimpleRTK pimples, - // this pointer should never be null and should always point to a - // valid object - PimpleThreeDCircularProjectionGeometry *m_PimpleThreeDCircularProjectionGeometry; -}; - -} -} - -#endif // __srtkThreeDCircularProjectionGeometry_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkTransform.h b/utilities/SimpleRTK/Code/Common/include/srtkTransform.h deleted file mode 100644 index 27708c173..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkTransform.h +++ /dev/null @@ -1,179 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkTransform_h -#define __srtkTransform_h - -#include "srtkCommon.h" -#include "srtkExceptionObject.h" -#include - -namespace itk -{ -// Forward declaration for pointer -// After ITK_VERSION 4.5 (Acutally after June 20th, 2013) the ITK Transform -// classes are now templated. This requires forward declarations to be defined -// differently. -#if ( ( SRTK_ITK_VERSION_MAJOR == 4 ) && ( SRTK_ITK_VERSION_MINOR < 5 ) ) -class TransformBase; -#else -template< typename TScalar > class TransformBaseTemplate; -typedef TransformBaseTemplate TransformBase; -#endif - -template< typename TScalar, unsigned int NDimension> class CompositeTransform; -} - -namespace rtk -{ -namespace simple -{ - -class PimpleTransformBase; - - -enum TransformEnum { srtkIdentity, - srtkTranslation, - srtkScale, - srtkScaleLogarithmic, - srtkEuler, - srtkSimilarity, - srtkQuaternionRigid, - srtkVersor, - srtkVersorRigid, - srtkAffine, - srtkComposite }; - - -/** \class Tranform - * \brief A simplified wrapper around a variety of ITK transforms. - * - */ -class SRTKCommon_EXPORT Transform -{ -public: - typedef Transform Self; - - /** \brief By default a 3-d identity transform is constructed - */ - Transform( void ); - - /** \brief Construct a SimpleRTK Transform from a pointer to an ITK - * composite transform. - * - */ - template - explicit Transform( itk::CompositeTransform< double, NDimension >* compositeTransform ) - { - srtkStaticAssert( NDimension == 2 || NDimension == 3, "Only 2D and 3D transforms are supported" ); - if ( compositeTransform == NULL ) - { - srtkExceptionMacro( "Unable to construct a null transform!" ); - } - this->InternalInitialization( srtkComposite, compositeTransform ); - } - - /** \brief Construct a specific transformation - */ - Transform( unsigned int dimensions, TransformEnum type); - - virtual ~Transform( void ); - - /** \brief Copy constructor and assignment operator - * - * Performs a shallow copy of the internal ITK transform. A deep - * copy will be done if the transform in modified. - * @{ - */ - Transform &operator=( const Transform & ); - Transform( const Transform & ); - /**@}*/ - - - /** Get access to internal ITK data object. - * - * The return value should imediately be assigned to as - * itk::SmartPointer. - * - * In many cases the value may need to be dynamically casted to - * the the actual transform type. - * - * @{ - */ - itk::TransformBase* GetITKBase( void ); - const itk::TransformBase* GetITKBase( void ) const; - /**@}*/ - - /** Return the dimension of the Transform ( 2D or 3D ) - */ - unsigned int GetDimension( void ) const; - - // todo get transform type - - /** Set/Get Transform Parameter - * @{ - */ - void SetParameters ( const std::vector& parameters ); - std::vector GetParameters( void ) const ; - /**@}*/ - - /** Set/Get Fixed Transform Parameter - * @{ - */ - void SetFixedParameters ( const std::vector& parameters ); - std::vector GetFixedParameters( void ) const ; - /**@}*/ - - // Make composition - Transform &AddTransform( Transform t ); - - std::vector< double > TransformPoint( const std::vector< double > &point ) const; - - // write - void WriteTransform( const std::string &filename ) const; - - // todo set identity - - std::string ToString( void ) const; - - -protected: - - void MakeUniqueForWrite( void ); - -private: - - template< unsigned int VDimension> - void InternalInitialization( TransformEnum type, itk::TransformBase *base = NULL ); - - // As is the architecture of all SimpleRTK pimples, - // this pointer should never be null and should always point to a - // valid object - PimpleTransformBase *m_PimpleTransform; -}; - - -// read -SRTKCommon_EXPORT Transform ReadTransform( const std::string &filename ); - -// write -SRTKCommon_EXPORT void WriteTransform( const Transform &transform, const std::string &filename); - -} -} - -#endif // __srtkTransform_h diff --git a/utilities/SimpleRTK/Code/Common/include/srtkVersion.h b/utilities/SimpleRTK/Code/Common/include/srtkVersion.h deleted file mode 100644 index 2196b5d7b..000000000 --- a/utilities/SimpleRTK/Code/Common/include/srtkVersion.h +++ /dev/null @@ -1,55 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkVersion_h -#define __srtkVersion_h - -#include "srtkCommon.h" - -namespace rtk -{ - -namespace simple -{ - - /** \class Version - * \brief Version info for SimpleRTK - */ - class SRTKCommon_EXPORT Version - { - public: - static unsigned int MajorVersion(); - static unsigned int MinorVersion(); - static unsigned int PatchVersion(); - static unsigned int TweakVersion(); - static const std::string &VersionString(); - static const std::string &BuildDate(); - - - static unsigned int RTKMajorVersion(); - static unsigned int RTKMinorVersion(); - static unsigned int RTKPatchVersion(); - static const std::string &RTKVersionString(); - - static const std::string &ExtendedVersionString(); - std::string ToString() { return Version::ExtendedVersionString(); } - }; - -} -} - -#endif diff --git a/utilities/SimpleRTK/Code/Common/src/CMakeLists.txt b/utilities/SimpleRTK/Code/Common/src/CMakeLists.txt deleted file mode 100644 index e68cc83be..000000000 --- a/utilities/SimpleRTK/Code/Common/src/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ - set ( SimpleRTKCommonSource - srtkImage.cxx - srtkImageExplicit.cxx - srtkProcessObject.cxx - srtkTransform.cxx - srtkThreeDCircularProjectionGeometry.cxx - srtkCommand.cxx - srtkFunctionCommand.cxx - srtkPixelIDValues.cxx - srtkExceptionObject.cxx - srtkEvent.cxx - srtkInterpolator.cxx - srtkVersion.cxx - ../include/Ancillary/hl_md5.cxx - ../include/Ancillary/hl_sha1.cxx - ) - -set ( ITK_NO_IO_FACTORY_REGISTER_MANAGER 1 ) -include(${ITK_USE_FILE}) -include(${RTK_USE_FILE}) - -add_library ( SimpleRTKCommon ${SimpleRTKCommonSource} ${SimpleRTKAncillarySource} ) -target_link_libraries ( SimpleRTKCommon ${ITK_LIBRARIES} ${RTK_LIBRARIES}) -set_target_properties( SimpleRTKCommon PROPERTIES SKIP_BUILD_RPATH TRUE ) - -srtk_install_exported_target( SimpleRTKCommon ) - -# Add custom command that will delete java files which need to be rebuilt when changes -# are made to Common -if( WRAP_JAVA ) - add_custom_command( - TARGET SimpleRTKCommon - POST_BUILD - COMMENT "Cleaning java build..." - COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleRTK_BINARY_DIR}/Wrapping/org/rtk/simple/*.java - COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleRTK_BINARY_DIR}/Wrapping/build/org/rtk/simple/*.class - ) -endif() diff --git a/utilities/SimpleRTK/Code/Common/src/srtkCommand.cxx b/utilities/SimpleRTK/Code/Common/src/srtkCommand.cxx deleted file mode 100644 index afcd7857a..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkCommand.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include "srtkCommand.h" -#include "srtkProcessObject.h" - -namespace rtk -{ -namespace simple -{ - -Command::Command( ) - : m_OwnedByProcessObjects(false), - m_Name("Command") -{ -} - -Command::~Command( ) -{ - // tell the process object that we are being destroyed so that it - // can remove this as an observer - std::set::iterator i = m_ReferencedObjects.begin(); - while( i != m_ReferencedObjects.end() ) - { - (*i++)->onCommandDelete(this); - } -} - - -void Command::Execute(void) -{ -} - -size_t Command::AddProcessObject(rtk::simple::ProcessObject *o) -{ - // unique add process object to set - m_ReferencedObjects.insert(o); - return m_ReferencedObjects.size(); -} - -size_t Command::RemoveProcessObject(const rtk::simple::ProcessObject *co) -{ - ProcessObject *o = const_cast(co); - m_ReferencedObjects.erase(o); - const size_t ret = m_ReferencedObjects.size(); - if (ret==0 && m_OwnedByProcessObjects) - { - delete this; - } - return ret; -} - - -} // end namespace simple -} // end namespace itk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkConfigure.h.in b/utilities/SimpleRTK/Code/Common/src/srtkConfigure.h.in deleted file mode 100644 index d6f22bfd3..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkConfigure.h.in +++ /dev/null @@ -1,58 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkConfigure_h -#define __srtkConfigure_h - - -#cmakedefine SRTK_BUILD_SHARED_LIBS -#ifdef SRTK_BUILD_SHARED_LIBS -#define SRTKDLL -#else -#define SRTKSTATIC -#endif - - -// defined if the system has C++0x "static_assert" keyword -#cmakedefine SRTK_HAS_CXX11_STATIC_ASSERT -#cmakedefine SRTK_HAS_CXX11_FUNCTIONAL -#cmakedefine SRTK_HAS_CXX11_TYPE_TRAITS -#cmakedefine SRTK_HAS_CXX11_UNORDERED_MAP - -#cmakedefine SRTK_HAS_TR1_SUB_INCLUDE - -#cmakedefine SRTK_HAS_TR1_FUNCTIONAL -#cmakedefine SRTK_HAS_TR1_TYPE_TRAITS -#cmakedefine SRTK_HAS_TR1_UNORDERED_MAP - -#cmakedefine SRTK_INT64_PIXELIDS - -#cmakedefine SRTK_EXPRESS_INSTANTIATEDPIXELS - -#if defined(__clang__) -#define CLANG_TEMPLATE template -#else -#define CLANG_TEMPLATE -#endif - -// Include ITK version reported in CMake with SRTK prefix, so that -// SimpleRTK dosen't need ITK header in our headers. -#define SRTK_ITK_VERSION_MAJOR @ITK_VERSION_MAJOR@ -#define SRTK_ITK_VERSION_MINOR @ITK_VERSION_MINOR@ -#define SRTK_ITK_VERSION_PATCH @ITK_VERSION_PATCH@ - -#endif // __srtkConfigure_h diff --git a/utilities/SimpleRTK/Code/Common/src/srtkEvent.cxx b/utilities/SimpleRTK/Code/Common/src/srtkEvent.cxx deleted file mode 100644 index 7a8a88a6c..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkEvent.cxx +++ /dev/null @@ -1,44 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkEvent.h" - -#define srtkEventToStringCaseMacro(n) case srtk##n##Event: return ( os << #n << "Event" ) - -namespace rtk -{ -namespace simple -{ - -std::ostream& operator<<(std::ostream& os, const EventEnum k) -{ - switch (k) - { - srtkEventToStringCaseMacro(Any); - srtkEventToStringCaseMacro(Abort); - srtkEventToStringCaseMacro(Delete); - srtkEventToStringCaseMacro(End); - srtkEventToStringCaseMacro(Iteration); - srtkEventToStringCaseMacro(Progress); - srtkEventToStringCaseMacro(Start); - srtkEventToStringCaseMacro(User); - } - return os; -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkExceptionObject.cxx b/utilities/SimpleRTK/Code/Common/src/srtkExceptionObject.cxx deleted file mode 100644 index ace061083..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkExceptionObject.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkExceptionObject.h" -#include "itkMacro.h" - -#if defined(_MSC_VER) -#pragma warning ( disable : 4297 ) -#endif - - -namespace rtk -{ -namespace simple -{ - -GenericException::GenericException() throw() - : m_PimpleException( NULL ) -{} - -GenericException::GenericException( const GenericException &e ) throw() - - : std::exception( e ) -{ - try - { - if ( e.m_PimpleException != NULL ) - { - m_PimpleException = new itk::ExceptionObject( *e.m_PimpleException ); - } - } - catch(...) // prevent exception from leaving constructor - { - this->m_PimpleException = NULL; - } -} - -GenericException::GenericException(const char *file, unsigned int lineNumber) throw() -{ - try - { - m_PimpleException = new itk::ExceptionObject( file, lineNumber ); - } - catch(...) // prevent exception from leaving constructor - { - this->m_PimpleException = NULL; - } -} - -/** Constructor. Needed to ensure the exception object can be copied. */ -GenericException::GenericException(const std::string & file, unsigned int lineNumber) throw() -{ - try - { - m_PimpleException = new itk::ExceptionObject( file, lineNumber ); - } - catch(...) // prevent exception from leaving constructor - { - this->m_PimpleException = NULL; - } -} - -/** Constructor. Needed to ensure the exception object can be copied. */ -GenericException::GenericException(const std::string & file, - unsigned int lineNumber, - const std::string & desc) throw() -{ - try - { - m_PimpleException = new itk::ExceptionObject( file, lineNumber, desc ); - } - catch(...) // prevent exception from leaving constructor - { - this->m_PimpleException = NULL; - } -} - -GenericException::~GenericException() throw( ) -{ - delete this->m_PimpleException; -} - - -GenericException & GenericException::operator=(const GenericException & orig) -{ - if ( this != &orig ) - this->m_PimpleException = orig.m_PimpleException; - return *this; -} - -bool GenericException::operator==(const GenericException & orig) const -{ - if ( this->m_PimpleException && orig.m_PimpleException) - { - return this->m_PimpleException == orig.m_PimpleException; - } - else if ( this->m_PimpleException == NULL && - orig.m_PimpleException == NULL ) - { - return true; - } - return false; -} - -/** Return a description of the error */ -std::string GenericException::ToString() const -{ - if ( this->m_PimpleException ) - { - std::ostringstream out; - this->m_PimpleException->Print( out ); - return std::string(); - } - - return std::string("No pimple exception"); -} - -const char * GenericException::what() const throw() -{ - if ( this->m_PimpleException ) - return this->m_PimpleException->what(); - return "No pimple Exception!"; -} - - -const char * GenericException::GetNameOfClass() const -{ - return "GenericException"; -} - - -const char * GenericException::GetLocation() const -{ - if ( this->m_PimpleException ) - return this->m_PimpleException->GetLocation(); - return "No pimple Exception!"; -} - -const char * GenericException::GetDescription() const -{ - if ( this->m_PimpleException ) - return this->m_PimpleException->GetDescription(); - return "No pimple Exception!"; -} - -/** What file did the exception occur in? */ -const char * GenericException::GetFile() const -{ - if ( this->m_PimpleException ) - return this->m_PimpleException->GetFile(); - return "No pimple Exception!"; -} - -/** What line did the exception occur in? */ -unsigned int GenericException::GetLine() const -{ - if ( this->m_PimpleException ) - return this->m_PimpleException->GetLine(); - return 0; -} - -} -} diff --git a/utilities/SimpleRTK/Code/Common/src/srtkFunctionCommand.cxx b/utilities/SimpleRTK/Code/Common/src/srtkFunctionCommand.cxx deleted file mode 100644 index 55ded4cf1..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkFunctionCommand.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkFunctionCommand.h" -#include "srtkProcessObject.h" - -namespace rtk -{ -namespace simple -{ - -FunctionCommand::FunctionCommand( ) -{ - Command::SetName("FunctionCommand"); -} - -void FunctionCommand::Execute(void) -{ - if (bool(this->m_Function)) - { - return m_Function(); - } -} - -void FunctionCommand::SetCallbackFunction ( void(* pFunction )() ) - { - m_Function = pFunction; - } - -void FunctionCommand::SetCallbackFunction( void(* pFunction )(void *), void *clientData ) -{ - m_Function = nsstd::bind(pFunction, clientData); -} - - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkImage.cxx b/utilities/SimpleRTK/Code/Common/src/srtkImage.cxx deleted file mode 100644 index dba7adc82..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkImage.cxx +++ /dev/null @@ -1,731 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkImage.h" - -#include "itkMetaDataObject.h" -#include "itkDataObject.h" - -#include "srtkExceptionObject.h" -#include "srtkPimpleImageBase.h" -#include "srtkPixelIDTypeLists.h" - - -namespace rtk -{ - namespace simple - { - - Image::~Image( ) - { - delete this->m_PimpleImage; - this->m_PimpleImage = NULL; - } - - Image::Image( ) - : m_PimpleImage( NULL ) - { - Allocate ( 0, 0, 0, 0, srtkUInt8, 1 ); - } - - Image::Image( const Image &img ) - { - this->m_PimpleImage = img.m_PimpleImage->ShallowCopy(); - } - - Image& Image::operator=( const Image &img ) - { - // note: If img and this are this same, the following statement - // will still be safe. It is also exception safe. - nsstd::auto_ptr temp( img.m_PimpleImage->ShallowCopy() ); - delete this->m_PimpleImage; - this->m_PimpleImage = temp.release(); - return *this; - } - - Image::Image( unsigned int Width, unsigned int Height, PixelIDValueEnum ValueEnum ) - : m_PimpleImage( NULL ) - { - Allocate ( Width, Height, 0, 0, ValueEnum, 0 ); - } - - Image::Image( unsigned int Width, unsigned int Height, unsigned int Depth, PixelIDValueEnum ValueEnum ) - : m_PimpleImage( NULL ) - { - Allocate ( Width, Height, Depth, 0, ValueEnum, 0 ); - } - - Image::Image( const std::vector< unsigned int > &size, PixelIDValueEnum ValueEnum, unsigned int numberOfComponents ) - : m_PimpleImage( NULL ) - { - if ( size.size() == 2 ) - { - Allocate ( size[0], size[1], 0, 0, ValueEnum, numberOfComponents ); - } - else if ( size.size() == 3 ) - { - Allocate ( size[0], size[1], size[2], 0, ValueEnum, numberOfComponents ); - } - else if ( size.size() == 4 ) - { - Allocate ( size[0], size[1], size[2], size[3], ValueEnum, numberOfComponents ); - } - else - { - srtkExceptionMacro("Unsuported number of dimesions specified!"); - } - } - - itk::DataObject* Image::GetITKBase( void ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return m_PimpleImage->GetDataBase(); - } - - const itk::DataObject* Image::GetITKBase( void ) const - { - assert( m_PimpleImage ); - return m_PimpleImage->GetDataBase(); - } - - PixelIDValueType Image::GetPixelIDValue( void ) const - { - return this->GetPixelID(); - } - - PixelIDValueEnum Image::GetPixelID( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelID(); - } - - unsigned int Image::GetDimension( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetDimension(); - } - - unsigned int Image::GetNumberOfComponentsPerPixel( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetNumberOfComponentsPerPixel(); - } - - std::string Image::GetPixelIDTypeAsString( void ) const - { - return std::string( GetPixelIDValueAsString( this->GetPixelIDValue() ) ); - } - - std::string Image::ToString( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->ToString(); - } - - std::vector< unsigned int > Image::GetSize( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetSize(); - } - - unsigned int Image::GetWidth( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetWidth(); - } - - unsigned int Image::GetHeight( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetHeight(); - } - - unsigned int Image::GetDepth( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetDepth(); - } - - // Get Origin - std::vector< double > Image::GetOrigin( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetOrigin(); - } - - // Set Origin - void Image::SetOrigin( const std::vector &orgn ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetOrigin(orgn); - } - - // Get Spacing - std::vector< double > Image::GetSpacing( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetSpacing(); - } - - // Set Spacing - void Image::SetSpacing( const std::vector &spc ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetSpacing(spc); - } - - // Get Direction - std::vector< double > Image::GetDirection( void ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetDirection(); - } - - // Set Direction - void Image::SetDirection( const std::vector< double > &direction ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetDirection( direction ); - } - - void Image::CopyInformation( const Image & srcImage ) - { - // check that the dimension match - if ( this->GetDimension() != srcImage.GetDimension() ) - { - srtkExceptionMacro( "Source Image for information does not match this image's dimension." ); - } - - - // check that the image size's match - if ( this->GetSize() != srcImage.GetSize() ) - { - srtkExceptionMacro( "Source image size of " << srcImage.GetSize() - << " does not match this image's size of " << this->GetSize() << "!" ); - } - - this->SetOrigin( srcImage.GetOrigin() ); - this->SetSpacing( srcImage.GetSpacing() ); - this->SetDirection( srcImage.GetDirection() ); - } - - std::vector Image::GetMetaDataKeys( void ) const - { - assert( m_PimpleImage ); - const itk::MetaDataDictionary &mdd = this->m_PimpleImage->GetDataBase()->GetMetaDataDictionary(); - return mdd.GetKeys(); - } - - bool Image::HasMetaDataKey( const std::string &key ) const - { - assert( m_PimpleImage ); - const itk::MetaDataDictionary &mdd = this->m_PimpleImage->GetDataBase()->GetMetaDataDictionary(); - return mdd.HasKey(key); - } - - std::string Image::GetMetaData( const std::string &key ) const - { - assert( m_PimpleImage ); - const itk::MetaDataDictionary &mdd = this->m_PimpleImage->GetDataBase()->GetMetaDataDictionary(); - std::string value; - if (ExposeMetaData(mdd, key, value)) - { - return value; - } - - std::ostringstream ss; - mdd.Get(key)->Print(ss); - return ss.str(); - } - - void Image::SetMetaData( const std::string &key, const std::string &value) - { - assert( m_PimpleImage ); - this->MakeUnique(); - itk::MetaDataDictionary &mdd = this->m_PimpleImage->GetDataBase()->GetMetaDataDictionary(); - itk::EncapsulateMetaData(mdd, key, value); - } - - bool Image::EraseMetaData( const std::string &key ) - { - assert( m_PimpleImage ); - itk::MetaDataDictionary &mdd = this->m_PimpleImage->GetDataBase()->GetMetaDataDictionary(); - this->MakeUnique(); - return mdd.Erase(key); - } - - // Physical Point to Continuous Index - std::vector< int64_t > Image::TransformPhysicalPointToIndex( const std::vector< double > &pt ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->TransformPhysicalPointToIndex( pt ); - } - - // Index to Physical Point - std::vector< double > Image::TransformIndexToPhysicalPoint( const std::vector< int64_t > &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->TransformIndexToPhysicalPoint( idx ); - } - - // Physical Point to Continuous Index - std::vector< double > Image::TransformPhysicalPointToContinuousIndex( const std::vector< double > &pt ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->TransformPhysicalPointToContinuousIndex( pt ); - } - // Continuous Index to Physical Point - std::vector< double > Image::TransformContinuousIndexToPhysicalPoint( const std::vector< double > &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->TransformContinuousIndexToPhysicalPoint( idx ); - } - - int8_t Image::GetPixelAsInt8( const std::vector &idx) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsInt8( idx ); - } - - uint8_t Image::GetPixelAsUInt8( const std::vector &idx) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsUInt8( idx ); - } - - int16_t Image::GetPixelAsInt16( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsInt16( idx ); - } - - uint16_t Image::GetPixelAsUInt16( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsUInt16( idx ); - } - - int32_t Image::GetPixelAsInt32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsInt32( idx ); - } - - uint32_t Image::GetPixelAsUInt32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsUInt32( idx ); - } - - int64_t Image::GetPixelAsInt64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsInt64( idx ); - } - - uint64_t Image::GetPixelAsUInt64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsUInt64( idx ); - } - - float Image::GetPixelAsFloat( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsFloat( idx ); - } - - double Image::GetPixelAsDouble( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsDouble( idx ); - } - - std::vector Image::GetPixelAsVectorInt8( const std::vector &idx) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorInt8( idx ); - } - - std::vector Image::GetPixelAsVectorUInt8( const std::vector &idx) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorUInt8( idx ); - } - - std::vector Image::GetPixelAsVectorInt16( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorInt16( idx ); - } - - std::vector Image::GetPixelAsVectorUInt16( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorUInt16( idx ); - } - - std::vector Image::GetPixelAsVectorInt32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorInt32( idx ); - } - - std::vector Image::GetPixelAsVectorUInt32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorUInt32( idx ); - } - - std::vector Image::GetPixelAsVectorInt64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorInt64( idx ); - } - - std::vector Image::GetPixelAsVectorUInt64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorUInt64( idx ); - } - - std::vector Image::GetPixelAsVectorFloat32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorFloat32( idx ); - } - - std::vector Image::GetPixelAsVectorFloat64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsVectorFloat64( idx ); - } - - std::complex Image::GetPixelAsComplexFloat32( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsComplexFloat32( idx ); - } - - std::complex Image::GetPixelAsComplexFloat64( const std::vector &idx ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetPixelAsComplexFloat64( idx ); - } - - int8_t *Image::GetBufferAsInt8( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsInt8( ); - } - - uint8_t *Image::GetBufferAsUInt8( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsUInt8( ); - } - - int16_t *Image::GetBufferAsInt16( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsInt16( ); - } - - uint16_t *Image::GetBufferAsUInt16( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsUInt16( ); - } - - int32_t *Image::GetBufferAsInt32( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsInt32( ); - } - - uint32_t *Image::GetBufferAsUInt32( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsUInt32( ); - } - - int64_t *Image::GetBufferAsInt64( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsInt64( ); - } - - uint64_t *Image::GetBufferAsUInt64( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsUInt64( ); - } - - float *Image::GetBufferAsFloat( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsFloat( ); - } - - double *Image::GetBufferAsDouble( ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - return this->m_PimpleImage->GetBufferAsDouble( ); - } - - const int8_t *Image::GetBufferAsInt8( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsInt8( ); - } - - const uint8_t *Image::GetBufferAsUInt8( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsUInt8( ); - } - - const int16_t *Image::GetBufferAsInt16( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsInt16( ); - } - - const uint16_t *Image::GetBufferAsUInt16( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsUInt16( ); - } - - const int32_t *Image::GetBufferAsInt32( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsInt32( ); - } - - const uint32_t *Image::GetBufferAsUInt32( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsUInt32( ); - } - - const int64_t *Image::GetBufferAsInt64( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsInt64( ); - } - - const uint64_t *Image::GetBufferAsUInt64( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsUInt64( ); - } - - const float *Image::GetBufferAsFloat( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsFloat( ); - } - - const double *Image::GetBufferAsDouble( ) const - { - assert( m_PimpleImage ); - return this->m_PimpleImage->GetBufferAsDouble( ); - } - - void Image::SetPixelAsInt8( const std::vector &idx, int8_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsInt8( idx, v ); - } - - void Image::SetPixelAsUInt8( const std::vector &idx, uint8_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsUInt8( idx, v ); - } - - void Image::SetPixelAsInt16( const std::vector &idx, int16_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsInt16( idx, v ); - } - - void Image::SetPixelAsUInt16( const std::vector &idx, uint16_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsUInt16( idx, v ); - } - - void Image::SetPixelAsInt32( const std::vector &idx, int32_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsInt32( idx, v ); - } - - void Image::SetPixelAsUInt32( const std::vector &idx, uint32_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsUInt32( idx, v ); - } - - void Image::SetPixelAsInt64( const std::vector &idx, int64_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsInt64( idx, v ); - } - - void Image::SetPixelAsUInt64( const std::vector &idx, uint64_t v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsUInt64( idx, v ); - } - - void Image::SetPixelAsFloat( const std::vector &idx, float v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsFloat( idx, v ); - } - - void Image::SetPixelAsDouble( const std::vector &idx, double v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsDouble( idx, v ); - } - - void Image::SetPixelAsVectorInt8( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorInt8( idx, v ); - } - - void Image::SetPixelAsVectorUInt8( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorUInt8( idx, v ); - } - - void Image::SetPixelAsVectorInt16( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorInt16( idx, v ); - } - - void Image::SetPixelAsVectorUInt16( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorUInt16( idx, v ); - } - - void Image::SetPixelAsVectorInt32( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorInt32( idx, v ); - } - - void Image::SetPixelAsVectorUInt32( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorUInt32( idx, v ); - } - - void Image::SetPixelAsVectorInt64( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorInt64( idx, v ); - } - - void Image::SetPixelAsVectorUInt64( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorUInt64( idx, v ); - } - - void Image::SetPixelAsVectorFloat32( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorFloat32( idx, v ); - } - - void Image::SetPixelAsVectorFloat64( const std::vector &idx, const std::vector &v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsVectorFloat64( idx, v ); - } - - void Image::SetPixelAsComplexFloat32( const std::vector &idx, const std::complex v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsComplexFloat32( idx, v ); - } - - void Image::SetPixelAsComplexFloat64( const std::vector &idx, const std::complex v ) - { - assert( m_PimpleImage ); - this->MakeUnique(); - this->m_PimpleImage->SetPixelAsComplexFloat64( idx, v ); - } - - - void Image::MakeUnique( void ) - { - if ( this->m_PimpleImage->GetReferenceCountOfImage() > 1 ) - { - // note: care is take here to be exception safe with memory allocation - nsstd::auto_ptr temp( this->m_PimpleImage->DeepCopy() ); - delete this->m_PimpleImage; - this->m_PimpleImage = temp.release(); - } - - } - } // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkImage.hxx b/utilities/SimpleRTK/Code/Common/src/srtkImage.hxx deleted file mode 100644 index 066bd0ebb..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkImage.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImage_hxx -#define __srtkImage_hxx - -#include "srtkImage.h" - -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkVectorImage.h" -#include "itkLabelMap.h" -#include "itkLabelObject.h" - -#include "srtkExceptionObject.h" -#include "srtkPimpleImageBase.hxx" -#include "srtkPixelIDTypeLists.h" - - -namespace rtk -{ - namespace simple - { - - // this is a little specialization just to get the - // InternalInitialization method's PixelIDTpImageType lookup to get - // a valid void type, so it'll dispatch to the a specialized - // method. All this is just to instantiate something that will never - // be actually used. - template - struct PixelIDToImageType< typelist::NullType , VImageDimension > - { - typedef void ImageType; - }; - - // This method is explicitly instantiated, and in-turn implicitly - // instantates the PipleImage for all used image types. This method - // just dispatces to nother method, to aid in instantiating only the - // images requested. - template - void Image::InternalInitialization( typename PixelIDToImageType::Result, - VImageDimension>::ImageType *i ) - { - this->ConditionalInternalInitialization( i ); - } - - template - typename DisableIf::value>::Type - Image::ConditionalInternalInitialization( TImageType *image ) - { - // no need to check if null - delete this->m_PimpleImage; - this->m_PimpleImage = NULL; - - this->m_PimpleImage = new PimpleImage( image ); - } - - - template - typename EnableIf::Value>::Type - Image::AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int dim4, unsigned int numberOfComponents ) - { - if ( numberOfComponents != 1 && numberOfComponents != 0 ) - { - srtkExceptionMacro( "Specified number of components as " << numberOfComponents - << " but did not specify pixelID as a vector type!" ); - } - - typename TImageType::IndexType index; - typename TImageType::SizeType size; - typename TImageType::RegionType region; - - index.Fill ( 0 ); - size.Fill(1); - size[0] = Width; - size[1] = Height; - - if ( TImageType::ImageDimension > 2 ) - { - assert( Depth != 0 ); - size[2] = Depth; - } - - if ( TImageType::ImageDimension > 3 ) - { - assert( dim4 != 0 ); - size[3] = dim4; - } - - region.SetSize ( size ); - region.SetIndex ( index ); - - typename TImageType::Pointer image = TImageType::New(); - image->SetRegions ( region ); - image->Allocate(); - image->FillBuffer ( itk::NumericTraits::Zero ); - - delete this->m_PimpleImage; - this->m_PimpleImage = NULL; - m_PimpleImage = new PimpleImage( image ); - } - - template - typename EnableIf::Value>::Type - Image::AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int dim4, unsigned int numberOfComponents ) - { - if ( numberOfComponents == 0 ) - { - numberOfComponents = TImageType::ImageDimension; - } - - typename TImageType::IndexType index; - typename TImageType::SizeType size; - typename TImageType::RegionType region; - typename TImageType::PixelType zero; - - index.Fill ( 0 ); - size.Fill(1); - size[0] = Width; - size[1] = Height; - - if ( TImageType::ImageDimension > 2 ) - { - assert( Depth != 0 ); - size[2] = Depth; - } - - if ( TImageType::ImageDimension > 3 ) - { - assert( dim4 != 0 ); - size[3] = dim4; - } - - region.SetSize ( size ); - region.SetIndex ( index ); - - zero.SetSize( numberOfComponents ); - zero.Fill ( itk::NumericTraits::Zero ); - - typename TImageType::Pointer image = TImageType::New(); - image->SetRegions ( region ); - image->SetVectorLength( numberOfComponents ); - image->Allocate(); - image->FillBuffer ( zero ); - - delete this->m_PimpleImage; - this->m_PimpleImage = NULL; - - m_PimpleImage = new PimpleImage( image ); - } - - template - typename EnableIf::Value>::Type - Image::AllocateInternal ( unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int dim4, unsigned int numberOfComponents ) - { - if ( numberOfComponents != 1 && numberOfComponents != 0 ) - { - srtkExceptionMacro( "Specified number of components as " << numberOfComponents - << " but did not specify pixelID as a vector type!" ); - } - - typename TImageType::IndexType index; - typename TImageType::SizeType size; - typename TImageType::RegionType region; - - index.Fill ( 0 ); - size.Fill(1); - size[0] = Width; - size[1] = Height; - - if ( TImageType::ImageDimension > 2 ) - { - assert( Depth != 0 ); - size[2] = Depth; - } - - if ( TImageType::ImageDimension > 3 ) - { - assert( dim4 != 0 ); - size[3] = dim4; - } - - region.SetSize ( size ); - region.SetIndex ( index ); - - typename TImageType::Pointer image = TImageType::New(); - image->SetRegions ( region ); - image->Allocate(); - image->SetBackgroundValue( 0 ); - - delete this->m_PimpleImage; - this->m_PimpleImage = NULL; - - m_PimpleImage = new PimpleImage( image ); - } - - } -} - -#endif //__srtkImage_h diff --git a/utilities/SimpleRTK/Code/Common/src/srtkImageExplicit.cxx b/utilities/SimpleRTK/Code/Common/src/srtkImageExplicit.cxx deleted file mode 100644 index 5a51b7985..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkImageExplicit.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#if defined(_MSC_VER) && _MSC_VER == 1700 -// VS11 (Visual Studio 2012) has limited variadic argument support for -// std::bind, the following increases the number of supported -// arguments. -// https://connect.microsoft.com/VisualStudio/feedback/details/723448/very-few-function-arguments-for-std-bind - - #if defined(_VARIADIC_MAX) && _VARIADIC_MAX < 10 - #error "_VARIADIC_MAX already defined. Some STL classes may have insufficient number of template parameters." - #else - #define _VARIADIC_MAX 10 - #endif -#endif - - -#include "srtkImage.hxx" -#include "srtkMemberFunctionFactory.h" - -namespace rtk -{ - namespace simple - { - void Image::Allocate ( unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int dim4, PixelIDValueEnum ValueEnum, unsigned int numberOfComponents ) - { - // initialize member function factory for allocating images - - // The pixel IDs supported - typedef AllPixelIDTypeList PixelIDTypeList; - - typedef void ( Self::*MemberFunctionType )( unsigned int, unsigned int, unsigned int, unsigned int, unsigned int ); - - typedef AllocateMemberFunctionAddressor< MemberFunctionType > AllocateAddressor; - - detail::MemberFunctionFactory< MemberFunctionType > allocateMemberFactory( this ); - allocateMemberFactory.RegisterMemberFunctions< PixelIDTypeList, 2, AllocateAddressor > (); - allocateMemberFactory.RegisterMemberFunctions< PixelIDTypeList, 3, AllocateAddressor > (); - allocateMemberFactory.RegisterMemberFunctions< PixelIDTypeList, 4, AllocateAddressor > (); - - if ( ValueEnum == srtkUnknown ) - { - srtkExceptionMacro( "Unable to construct image of unsupported pixel type" ); - } - - if ( Depth == 0 ) - { - allocateMemberFactory.GetMemberFunction( ValueEnum, 2 )( Width, Height, Depth, dim4, numberOfComponents ); - } - else if ( dim4 == 0 ) - { - allocateMemberFactory.GetMemberFunction( ValueEnum, 3 )( Width, Height, Depth, dim4, numberOfComponents ); - } - else - { - allocateMemberFactory.GetMemberFunction( ValueEnum, 4 )( Width, Height, Depth, dim4, numberOfComponents ); - } - } - } -} - - -// -// There is only one templated function in the external interface -// which need to be instantiated, so that the itk::Image and the -// srtk::PimpleImage are completely encapsulated. That is the -// InternalInitialization method. The following uses a macro to -// explicitly instantiate for the expected image types. -// - -#define SRTK_TEMPLATE_InternalInitialization_D( _I, _D ) \ - namespace rtk { namespace simple { \ - template SRTKCommon_EXPORT void Image::InternalInitialization<_I,_D>( PixelIDToImageType< typelist::TypeAt::Result, \ - _D>::ImageType *i ); \ - } } - -#ifdef SRTK_4D_IMAGES -#define SRTK_TEMPLATE_InternalInitialization( _I ) SRTK_TEMPLATE_InternalInitialization_D( _I, 2 ) SRTK_TEMPLATE_InternalInitialization_D( _I, 3 ) SRTK_TEMPLATE_InternalInitialization_D( _I, 4 ) -#else -#define SRTK_TEMPLATE_InternalInitialization( _I ) SRTK_TEMPLATE_InternalInitialization_D( _I, 2 ) SRTK_TEMPLATE_InternalInitialization_D( _I, 3 ) -#endif - - -// Instantiate for all types in the lists -SRTK_TEMPLATE_InternalInitialization( 0 ); -SRTK_TEMPLATE_InternalInitialization( 1 ); -SRTK_TEMPLATE_InternalInitialization( 2 ); -SRTK_TEMPLATE_InternalInitialization( 3 ); -SRTK_TEMPLATE_InternalInitialization( 4 ); -SRTK_TEMPLATE_InternalInitialization( 5 ); -SRTK_TEMPLATE_InternalInitialization( 6 ); -SRTK_TEMPLATE_InternalInitialization( 7 ); -SRTK_TEMPLATE_InternalInitialization( 8 ); -SRTK_TEMPLATE_InternalInitialization( 9 ); -SRTK_TEMPLATE_InternalInitialization( 10 ); -SRTK_TEMPLATE_InternalInitialization( 11 ); -SRTK_TEMPLATE_InternalInitialization( 12 ); -SRTK_TEMPLATE_InternalInitialization( 13 ); -SRTK_TEMPLATE_InternalInitialization( 14 ); -SRTK_TEMPLATE_InternalInitialization( 15 ); -SRTK_TEMPLATE_InternalInitialization( 16 ); -SRTK_TEMPLATE_InternalInitialization( 17 ); -SRTK_TEMPLATE_InternalInitialization( 18 ); -SRTK_TEMPLATE_InternalInitialization( 19 ); -SRTK_TEMPLATE_InternalInitialization( 20 ); -SRTK_TEMPLATE_InternalInitialization( 21 ); -SRTK_TEMPLATE_InternalInitialization( 22 ); -SRTK_TEMPLATE_InternalInitialization( 23 ); -SRTK_TEMPLATE_InternalInitialization( 24 ); -SRTK_TEMPLATE_InternalInitialization( 25 ); -SRTK_TEMPLATE_InternalInitialization( 26 ); -SRTK_TEMPLATE_InternalInitialization( 27 ); -SRTK_TEMPLATE_InternalInitialization( 28 ); -SRTK_TEMPLATE_InternalInitialization( 29 ); - - -srtkStaticAssert( typelist::Length::Result < 30, "Number of explicitly instantiated pixel types is more then expected!" ); diff --git a/utilities/SimpleRTK/Code/Common/src/srtkInterpolator.cxx b/utilities/SimpleRTK/Code/Common/src/srtkInterpolator.cxx deleted file mode 100644 index 8f787dec8..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkInterpolator.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkInterpolator.h" - -#define srtkInterpolatorToStringCaseMacro(n) case srtk##n: return ( os << #n ) - -namespace rtk -{ -namespace simple -{ - -std::ostream& operator<<(std::ostream& os, const InterpolatorEnum i) -{ - switch (i) - { - srtkInterpolatorToStringCaseMacro(NearestNeighbor); - srtkInterpolatorToStringCaseMacro(Linear); - srtkInterpolatorToStringCaseMacro(BSpline); - srtkInterpolatorToStringCaseMacro(Gaussian); - srtkInterpolatorToStringCaseMacro(LabelGaussian); - srtkInterpolatorToStringCaseMacro(HammingWindowedSinc); - srtkInterpolatorToStringCaseMacro(CosineWindowedSinc); - srtkInterpolatorToStringCaseMacro(WelchWindowedSinc); - srtkInterpolatorToStringCaseMacro(LanczosWindowedSinc); - srtkInterpolatorToStringCaseMacro(BlackmanWindowedSinc); - } - return os; -} - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.h b/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.h deleted file mode 100644 index 694ac4ec7..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.h +++ /dev/null @@ -1,157 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPimpleImageBase_h -#define __srtkPimpleImageBase_h - -#include -#include "srtkPixelIDTokens.h" -#include "srtkTemplateFunctions.h" - -namespace rtk -{ - namespace simple - { - - /** \class PimpleImageBase - * \brief Private implementation idiom image base class - * - * We utilize the private implementation ( or PImple) - * programming idiom to modify the behavior of the simple image - * class based on the different image types. - * - * This class is designed to utilize the trivial copy, - * and assgnement operators - */ - class PimpleImageBase - { - public: - virtual ~PimpleImageBase( void ) { }; - - virtual PixelIDValueEnum GetPixelID(void) const = 0; - virtual unsigned int GetDimension( void ) const = 0; - virtual unsigned int GetNumberOfComponentsPerPixel( void ) const = 0; - - virtual PimpleImageBase *ShallowCopy(void) const = 0; - virtual PimpleImageBase *DeepCopy(void) const = 0; - virtual itk::DataObject* GetDataBase( void ) = 0; - virtual const itk::DataObject* GetDataBase( void ) const = 0; - - virtual unsigned int GetWidth( void ) const { return this->GetSize( 0 ); } - virtual unsigned int GetHeight( void ) const { return this->GetSize( 1 ); } - virtual unsigned int GetDepth( void ) const { return this->GetSize( 2 ); } - - virtual std::vector< unsigned int > GetSize( void ) const = 0; - virtual unsigned int GetSize( unsigned int dimension ) const = 0; - - virtual std::vector GetOrigin( void ) const = 0; - virtual void SetOrigin( const std::vector &orgn ) = 0; - virtual std::vector GetSpacing( void ) const = 0; - virtual void SetSpacing( const std::vector &spc ) = 0; - - virtual std::vector< double > GetDirection( void ) const = 0; - virtual void SetDirection( const std::vector< double > &direction ) = 0; - - virtual std::vector TransformPhysicalPointToIndex( const std::vector &pt) const = 0; - virtual std::vector TransformIndexToPhysicalPoint( const std::vector &idx) const = 0; - virtual std::vector TransformPhysicalPointToContinuousIndex( const std::vector &pt) const = 0; - virtual std::vector TransformContinuousIndexToPhysicalPoint( const std::vector &idx) const = 0; - - virtual std::string ToString() const = 0; - - - virtual int GetReferenceCountOfImage() const = 0; - - virtual int8_t GetPixelAsInt8( const std::vector &idx) const = 0; - virtual uint8_t GetPixelAsUInt8( const std::vector &idx) const = 0; - virtual int16_t GetPixelAsInt16( const std::vector &idx ) const = 0; - virtual uint16_t GetPixelAsUInt16( const std::vector &idx ) const = 0; - virtual int32_t GetPixelAsInt32( const std::vector &idx ) const = 0; - virtual uint32_t GetPixelAsUInt32( const std::vector &idx ) const = 0; - virtual int64_t GetPixelAsInt64( const std::vector &idx ) const = 0; - virtual uint64_t GetPixelAsUInt64( const std::vector &idx ) const = 0; - virtual float GetPixelAsFloat( const std::vector &idx ) const = 0; - virtual double GetPixelAsDouble( const std::vector &idx ) const = 0; - - virtual std::vector GetPixelAsVectorInt8( const std::vector &idx) const = 0; - virtual std::vector GetPixelAsVectorUInt8( const std::vector &idx) const = 0; - virtual std::vector GetPixelAsVectorInt16( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorUInt16( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorInt32( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorUInt32( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorInt64( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorUInt64( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorFloat32( const std::vector &idx ) const = 0; - virtual std::vector GetPixelAsVectorFloat64( const std::vector &idx ) const = 0; - - virtual std::complex GetPixelAsComplexFloat32( const std::vector &idx ) const = 0; - virtual std::complex GetPixelAsComplexFloat64( const std::vector &idx ) const = 0; - - virtual void SetPixelAsInt8( const std::vector &idx, int8_t v ) = 0; - virtual void SetPixelAsUInt8( const std::vector &idx, uint8_t v ) = 0; - virtual void SetPixelAsInt16( const std::vector &idx, int16_t v ) = 0; - virtual void SetPixelAsUInt16( const std::vector &idx, uint16_t v ) = 0; - virtual void SetPixelAsInt32( const std::vector &idx, int32_t v ) = 0; - virtual void SetPixelAsUInt32( const std::vector &idx, uint32_t v ) = 0; - virtual void SetPixelAsInt64( const std::vector &idx, int64_t v ) = 0; - virtual void SetPixelAsUInt64( const std::vector &idx, uint64_t v ) = 0; - virtual void SetPixelAsFloat( const std::vector &idx, float v ) = 0; - virtual void SetPixelAsDouble( const std::vector &idx, double v ) = 0; - - virtual void SetPixelAsVectorInt8( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorUInt8( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorInt16( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorUInt16( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorInt32( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorUInt32( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorInt64( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorUInt64( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorFloat32( const std::vector &idx, const std::vector &v ) = 0; - virtual void SetPixelAsVectorFloat64( const std::vector &idx, const std::vector &v ) = 0; - - virtual void SetPixelAsComplexFloat32( const std::vector &idx, const std::complex v ) = 0; - virtual void SetPixelAsComplexFloat64( const std::vector &idx, const std::complex v ) = 0; - - - virtual int8_t *GetBufferAsInt8( ) = 0; - virtual uint8_t *GetBufferAsUInt8( ) = 0; - virtual int16_t *GetBufferAsInt16( ) = 0; - virtual uint16_t *GetBufferAsUInt16( ) = 0; - virtual int32_t *GetBufferAsInt32( ) = 0; - virtual uint32_t *GetBufferAsUInt32( ) = 0; - virtual int64_t *GetBufferAsInt64( ) = 0; - virtual uint64_t *GetBufferAsUInt64( ) = 0; - virtual float *GetBufferAsFloat( ) = 0; - virtual double *GetBufferAsDouble( ) = 0; - - virtual const int8_t *GetBufferAsInt8( ) const = 0; - virtual const uint8_t *GetBufferAsUInt8( ) const = 0; - virtual const int16_t *GetBufferAsInt16( ) const = 0; - virtual const uint16_t *GetBufferAsUInt16( ) const = 0; - virtual const int32_t *GetBufferAsInt32( ) const = 0; - virtual const uint32_t *GetBufferAsUInt32( ) const = 0; - virtual const int64_t *GetBufferAsInt64( ) const = 0; - virtual const uint64_t *GetBufferAsUInt64( ) const = 0; - virtual const float *GetBufferAsFloat( ) const = 0; - virtual const double *GetBufferAsDouble( ) const = 0; - }; - - } // end namespace simple -} // end namespace rtk - - -#endif // __srtkPimpleImageBase_h diff --git a/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.hxx b/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.hxx deleted file mode 100644 index 21e9e0807..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkPimpleImageBase.hxx +++ /dev/null @@ -1,820 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkPimpleImageBase_hxx -#define __srtkPimpleImageBase_hxx - -#include "srtkPimpleImageBase.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkConditional.h" - -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkImage.h" -#include "itkVectorImage.h" -#include "itkLabelMap.h" -#include "itkImageDuplicator.h" - -namespace rtk -{ - namespace simple - { - -/// -/// Private name space for a concrete implementation of pimple image -/// for a specific image types with dimensions and pixel types -/// - namespace - { - - template - struct MakeDependentOn - : public U {}; - - template - class PimpleImage - : public PimpleImageBase - { - public: - typedef PimpleImage Self; - typedef TImageType ImageType; - typedef typename ImageType::Pointer ImagePointer; - typedef typename ImageType::IndexType IndexType; - typedef typename ImageType::PixelType PixelType; - - PimpleImage ( ImageType* image ) - : m_Image( image ) - { - srtkStaticAssert( ImageType::ImageDimension == 3 || ImageType::ImageDimension == 2, - "Image Dimension out of range" ); - srtkStaticAssert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown, - "invalid pixel type" ); - - if ( image == NULL ) - { - srtkExceptionMacro( << "Unable to initialize an image with NULL" ); - } - - if ( image->GetLargestPossibleRegion() != image->GetBufferedRegion() ) - { - srtkExceptionMacro( << "The image has a LargestPossibleRegion of " << image->GetLargestPossibleRegion() - << " while the buffered region is " << image->GetBufferedRegion() << std::endl - << "SimpleRTK does not support streamming or unbuffered regions!" ); - } - - const IndexType & idx = image->GetBufferedRegion().GetIndex(); - for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) - { - if ( idx[i] != 0 ) - { - srtkExceptionMacro( << "The image has a staring index of " << idx - << "SimpleRTK only supports images with a zero starting index!" ); - } - } - } - - virtual PimpleImageBase *ShallowCopy( void ) const { return new Self(this->m_Image.GetPointer()); } - virtual PimpleImageBase *DeepCopy( void ) const { return this->DeepCopy(); } - - template - typename DisableIf::Value, PimpleImageBase*>::Type - DeepCopy( void ) const - { - typedef itk::ImageDuplicator< ImageType > ImageDuplicatorType; - typename ImageDuplicatorType::Pointer dup = ImageDuplicatorType::New(); - - dup->SetInputImage( this->m_Image ); - dup->Update(); - ImagePointer output = dup->GetOutput(); - - return new Self( output.GetPointer() ); - } - template - typename EnableIf::Value, PimpleImageBase*>::Type - DeepCopy( void ) const - { - srtkExceptionMacro( "This method is not implemented yet" ); - return new Self( this->m_Image.GetPointer() ); - } - - virtual itk::DataObject* GetDataBase( void ) { return this->m_Image.GetPointer(); } - virtual const itk::DataObject* GetDataBase( void ) const { return this->m_Image.GetPointer(); } - - - PixelIDValueEnum GetPixelID(void) const throw() - { - // The constructor ensures that we have a valid image - // this maps the Image's pixel type to the array index - return static_cast(ImageTypeToPixelIDValue::Result); - } - - virtual unsigned int GetDimension( void ) const - { - return ImageType::ImageDimension; - } - - - virtual unsigned int GetNumberOfComponentsPerPixel( void ) const { return this->GetNumberOfComponentsPerPixel(); } - - template - typename DisableIf::Value, unsigned int>::Type - GetNumberOfComponentsPerPixel( void ) const - { - return 1; - } - template - typename EnableIf::Value, unsigned int>::Type - GetNumberOfComponentsPerPixel( void ) const - { - // This returns 1 for itk::Image, and the number of elements - // is the vectors of a VectorImage - return this->m_Image->GetNumberOfComponentsPerPixel(); - } - - - // Get Origin - virtual std::vector GetOrigin( void ) const - { - return srtkITKVectorToSTL( this->m_Image->GetOrigin() ); - } - - // Set Origin - virtual void SetOrigin( const std::vector & orgn ) - { - this->m_Image->SetOrigin( srtkSTLVectorToITK< typename ImageType::PointType> ( orgn ) ); - } - - // Get Spacing - virtual std::vector GetSpacing( void ) const - { - return srtkITKVectorToSTL( this->m_Image->GetSpacing() ); - } - - // Set Spacing - virtual void SetSpacing( const std::vector &spc ) - { - this->m_Image->SetSpacing( srtkSTLVectorToITK< typename ImageType::SpacingType> ( spc ) ); - } - - - // Get Direction - virtual std::vector< double > GetDirection( void ) const - { - const typename ImageType::DirectionType &d = this->m_Image->GetDirection(); - return std::vector< double >( d.GetVnlMatrix().begin(), d.GetVnlMatrix().end() ); - } - - // Set Direction - virtual void SetDirection( const std::vector< double > & in ) - { - if (in.size() != ImageType::ImageDimension*ImageType::ImageDimension) - { - srtkExceptionMacro("direction size mismatch"); - } - - typename ImageType::DirectionType d; - - std::copy( in.begin(), in.end(), d.GetVnlMatrix().begin() ); - - this->m_Image->SetDirection( d ); - } - - - // Physical Point to Index - virtual std::vector TransformPhysicalPointToIndex( const std::vector &pt ) const - { - if (pt.size() != ImageType::ImageDimension) - { - srtkExceptionMacro("vector dimension mismatch"); - } - - - typename ImageType::IndexType index; - this->m_Image->TransformPhysicalPointToIndex( srtkSTLVectorToITK< typename ImageType::PointType> ( pt ), index); - - return srtkITKVectorToSTL( index ); - } - - // Index to Physical Point - virtual std::vector TransformIndexToPhysicalPoint( const std::vector &idx ) const - { - - if (idx.size() != ImageType::ImageDimension) - { - srtkExceptionMacro("vector dimension mismatch"); - } - - typename ImageType::IndexType index; - for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) - { - index[i] = idx[i]; - } - - - typename ImageType::PointType point; - this->m_Image->TransformIndexToPhysicalPoint( index, point ); - return srtkITKVectorToSTL( point ); - } - - // Physical Point To Continuous Index - virtual std::vector TransformPhysicalPointToContinuousIndex( const std::vector &pt ) const - { - if (pt.size() != ImageType::ImageDimension) - { - srtkExceptionMacro("vector dimension mismatch"); - } - - typename itk::ContinuousIndex index; - this->m_Image->TransformPhysicalPointToContinuousIndex(srtkSTLVectorToITK< typename ImageType::PointType> ( pt ), index); - - return srtkITKVectorToSTL( index ); - } - - // Continuous Index to Physical Point - virtual std::vector TransformContinuousIndexToPhysicalPoint( const std::vector &idx ) const - { - if (idx.size() != ImageType::ImageDimension) - { - srtkExceptionMacro("vector dimension mismatch"); - } - - - typename itk::ContinuousIndex index; - for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) - { - index[i] = idx[i]; - } - - typename ImageType::PointType point; - this->m_Image->TransformContinuousIndexToPhysicalPoint(index, point); - - return srtkITKVectorToSTL( point ); - } - - virtual unsigned int GetSize( unsigned int dimension ) const - { - if ( dimension > ImageType::ImageDimension - 1 ) - { - return 0; - } - - typename ImageType::RegionType largestRegion = this->m_Image->GetLargestPossibleRegion(); - return largestRegion.GetSize(dimension); - } - - virtual std::vector GetSize( void ) const - { - typename ImageType::RegionType largestRegion = this->m_Image->GetLargestPossibleRegion(); - std::vector size( ImageType::ImageDimension ); - - return srtkITKVectorToSTL( largestRegion.GetSize() ); - } - - std::string ToString( void ) const - { - std::ostringstream out; - this->m_Image->Print ( out ); - return out.str(); - } - - virtual int GetReferenceCountOfImage() const - { - return this->m_Image->GetReferenceCount(); - } - - virtual int8_t GetPixelAsInt8( const std::vector &idx) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual uint8_t GetPixelAsUInt8( const std::vector &idx) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual int16_t GetPixelAsInt16( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual uint16_t GetPixelAsUInt16( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual int32_t GetPixelAsInt32( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual uint32_t GetPixelAsUInt32( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual int64_t GetPixelAsInt64( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual uint64_t GetPixelAsUInt64( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual float GetPixelAsFloat( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual double GetPixelAsDouble( const std::vector &idx ) const - { - if ( IsLabel::Value ) - return this->InternalGetPixel< LabelPixelID >( idx ); - return this->InternalGetPixel< BasicPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorInt8( const std::vector &idx) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorUInt8( const std::vector &idx) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorInt16( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorUInt16( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorInt32( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorUInt32( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorInt64( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorUInt64( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorFloat32( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::vector GetPixelAsVectorFloat64( const std::vector &idx ) const - { - return this->InternalGetPixel< VectorPixelID >( idx ); - } - virtual std::complex GetPixelAsComplexFloat32( const std::vector &idx ) const - { - return this->InternalGetPixel< BasicPixelID > >( idx ); - } - virtual std::complex GetPixelAsComplexFloat64( const std::vector &idx ) const - { - return this->InternalGetPixel< BasicPixelID > >( idx ); - } - - virtual int8_t *GetBufferAsInt8() - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual uint8_t *GetBufferAsUInt8() - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual int16_t *GetBufferAsInt16( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual uint16_t *GetBufferAsUInt16( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual int32_t *GetBufferAsInt32( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual uint32_t *GetBufferAsUInt32( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual int64_t *GetBufferAsInt64( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual uint64_t *GetBufferAsUInt64( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual float *GetBufferAsFloat( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - virtual double *GetBufferAsDouble( ) - { - if ( IsVector::Value ) - return this->InternalGetBuffer< VectorPixelID >( ); - return this->InternalGetBuffer< BasicPixelID >( ); - } - - virtual const int8_t *GetBufferAsInt8() const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const uint8_t *GetBufferAsUInt8() const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const int16_t *GetBufferAsInt16( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const uint16_t *GetBufferAsUInt16( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const int32_t *GetBufferAsInt32( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const uint32_t *GetBufferAsUInt32( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const int64_t *GetBufferAsInt64( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const uint64_t *GetBufferAsUInt64( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const float *GetBufferAsFloat( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - virtual const double *GetBufferAsDouble( ) const - { - if ( IsVector::Value ) - return const_cast(this)->InternalGetBuffer< VectorPixelID >( ); - return const_cast(this)->InternalGetBuffer< BasicPixelID >( ); - } - - virtual void SetPixelAsInt8( const std::vector &idx, int8_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsUInt8( const std::vector &idx, uint8_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsInt16( const std::vector &idx, int16_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsUInt16( const std::vector &idx, uint16_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsInt32( const std::vector &idx, int32_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsUInt32( const std::vector &idx, uint32_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsInt64( const std::vector &idx, int64_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsUInt64( const std::vector &idx, uint64_t v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsFloat( const std::vector &idx, float v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsDouble( const std::vector &idx, double v ) - { - if ( IsLabel::Value ) - return this->InternalSetPixel< LabelPixelID >( idx, v ); - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorInt8( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorUInt8( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorInt16( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorUInt16( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorInt32( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorUInt32( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorInt64( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorUInt64( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorFloat32( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsVectorFloat64( const std::vector &idx, const std::vector &v ) - { - this->InternalSetPixel >( idx, v ); - } - virtual void SetPixelAsComplexFloat32( const std::vector &idx, const std::complex v ) - { - this->InternalSetPixel > >( idx, v ); - } - virtual void SetPixelAsComplexFloat64( const std::vector &idx, const std::complex v ) - { - this->InternalSetPixel > >( idx, v ); - } - - - protected: - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && !IsVector::Value, - typename ImageType::PixelType >::Type - InternalGetPixel( const std::vector &idx ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - return this->m_Image->GetPixel( itkIdx ); - } - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && IsLabel::Value - && !IsVector::Value, - typename ImageType::PixelType >::Type - InternalGetPixel( const std::vector &idx ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - return this->m_Image->GetPixel( itkIdx ); - } - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && IsVector::Value, - std::vector::InternalPixelType> >::Type - InternalGetPixel( const std::vector &idx ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - const typename ImageType::PixelType px = this->m_Image->GetPixel( itkIdx ); - return std::vector(&px[0], &px[px.GetSize()]); - } - - template < typename TPixelIDType > - typename DisableIf::PixelIDType>::value, - typename Conditional< IsVector::Value, - std::vector< typename itk::NumericTraits::ImageType::PixelType >::ValueType >, - typename PixelIDToImageType::ImageType::PixelType >::Type >::Type - InternalGetPixel( const std::vector &idx ) const - { - Unused( idx ); - srtkExceptionMacro( << "The image is of type: " << GetPixelIDValueAsString( this->GetPixelID() ) - << " but the GetPixel access method requires type: " - << GetPixelIDValueAsString( PixelIDToPixelIDValue::Result ) - << "!" ); - } - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && !IsVector::Value, - typename ImageType::PixelType *>::Type - InternalGetBuffer( void ) - { - return this->m_Image->GetPixelContainer()->GetBufferPointer(); - } - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && IsLabel::Value - && !IsVector::Value, - typename ImageType::PixelType *>::Type - InternalGetBuffer( void ) - { - srtkExceptionMacro( "This method is not supported for LabelMaps." ) - } - - template < typename TPixelIDType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && IsVector::Value, - typename MakeDependentOn::InternalPixelType * >::Type - InternalGetBuffer( void ) - { - return this->m_Image->GetPixelContainer()->GetBufferPointer(); - } - - template < typename TPixelIDType > - typename DisableIf::PixelIDType>::value, - typename itk::NumericTraits::ImageType::PixelType>::ValueType *>::Type - InternalGetBuffer( void ) - { - srtkExceptionMacro( << "The image is of type: " << GetPixelIDValueAsString( this->GetPixelID() ) - << " but the GetBuffer access method requires type: " - << GetPixelIDValueAsString( PixelIDToPixelIDValue::Result ) - << "!" ); - } - - - template < typename TPixelIDType, typename TPixelType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && !IsVector::Value >::Type - InternalSetPixel( const std::vector &idx, const TPixelType v ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - this->m_Image->SetPixel( itkIdx, v ); - } - - template < typename TPixelIDType, typename TPixelType > - typename EnableIf::PixelIDType>::value - && IsLabel::Value - && !IsVector::Value >::Type - InternalSetPixel( const std::vector &idx, const TPixelType v ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - this->m_Image->SetPixel( itkIdx, v ); - } - - template < typename TPixelIDType, typename TPixelValueType > - typename EnableIf::PixelIDType>::value - && !IsLabel::Value - && IsVector::Value >::Type - InternalSetPixel( const std::vector &idx, const std::vector & v ) const - { - const IndexType itkIdx = srtkSTLVectorToITK( idx ); - if ( ! this->m_Image->GetLargestPossibleRegion().IsInside( itkIdx ) ) - { - srtkExceptionMacro( "index out of bounds" ); - } - - typename ImageType::PixelType px = this->m_Image->GetPixel( itkIdx ); - - if ( px.GetSize() != v.size() ) - { - srtkExceptionMacro(<<"Unable to convert vector to ITK pixel type\n" - << "Expected vector of length " << px.GetSize() - << " but only got " << v.size() << " elements." ); - } - - std::copy( v.begin(), v.end(), &px[0] ); - } - - - template < typename TPixelIDType, typename TPixelType > - typename DisableIf::PixelIDType>::value >::Type - InternalSetPixel( const std::vector &idx, const TPixelType &v ) const - { - Unused( idx ); - Unused( v ); - srtkExceptionMacro( << "The image is of type: " << GetPixelIDValueAsString( this->GetPixelID() ) - << " but the SetPixel access method requires type: " - << GetPixelIDValueAsString( PixelIDToPixelIDValue >::Result ) - << "!" ); - } - - private: - ImagePointer m_Image; - }; - - } - - } // end namespace simple -} // end namespace rtk - -#endif // __srtkPimpleImageBase_hxx diff --git a/utilities/SimpleRTK/Code/Common/src/srtkPixelIDValues.cxx b/utilities/SimpleRTK/Code/Common/src/srtkPixelIDValues.cxx deleted file mode 100644 index 2bbfa8579..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkPixelIDValues.cxx +++ /dev/null @@ -1,157 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkPixelIDValues.h" - -namespace rtk -{ -namespace simple -{ - - -const std::string GetPixelIDValueAsString( PixelIDValueEnum type ) -{ - return GetPixelIDValueAsString( static_cast(type) ); -} - -const std::string GetPixelIDValueAsString( PixelIDValueType type ) -{ - - if ( type == srtkUnknown ) - { - // Unknow must be first because other enums may be -1 if they are - // not instantiated - return "Unknown pixel id"; - } - else if ( type == srtkUInt8 ) - { - return "8-bit unsigned integer"; - } - else if ( type == srtkInt8 ) - { - return "8-bit signed integer"; - } - else if ( type == srtkUInt16 ) - { - return "16-bit unsigned integer"; - } - else if ( type == srtkInt16 ) - { - return "16-bit signed integer"; - } - else if ( type == srtkUInt32 ) - { - return "32-bit unsigned integer"; - } - else if ( type == srtkInt32 ) - { - return "32-bit signed integer"; - } - else if ( type == srtkUInt64 ) - { - return "64-bit unsigned integer"; - } - else if ( type == srtkInt64 ) - { - return "64-bit signed integer"; - } - else if ( type == srtkFloat32 ) - { - return "32-bit float"; - } - else if ( type == srtkFloat64 ) - { - return "64-bit float"; - } - else if ( type == srtkComplexFloat32 ) - { - return "complex of 32-bit float"; - } - else if ( type == srtkComplexFloat64 ) - { - return "complex of 64-bit float"; - } - else if ( type == srtkVectorUInt8 ) - { - return "vector of 8-bit unsigned integer"; - } - else if ( type == srtkVectorInt8 ) - { - return "vector of 8-bit signed integer"; - } - else if ( type == srtkVectorUInt16 ) - { - return "vector of 16-bit unsigned integer"; - } - else if ( type == srtkVectorInt16 ) - { - return "vector of 16-bit signed integer"; - } - else if ( type == srtkVectorUInt32 ) - { - return "vector of 32-bit unsigned integer"; - } - else if ( type == srtkVectorInt32 ) - { - return "vector of 32-bit signed integer"; - } - else if ( type == srtkVectorUInt64 ) - { - return "vector of 64-bit unsigned integer"; - } - else if ( type == srtkVectorInt64 ) - { - return "vector of 64-bit signed integer"; - } - else if ( type == srtkVectorFloat32 ) - { - return "vector of 32-bit float"; - } - else if ( type == srtkVectorFloat64 ) - { - return "vector of 64-bit float"; - } - else if ( type == srtkLabelUInt8 ) - { - return "label of 8-bit unsigned integer"; - } - else if ( srtkLabelUInt16 ) - { - return "label of 16-bit unsigned integer"; - } - else if ( srtkLabelUInt32 ) - { - return "label of 32-bit unsigned integer"; - } - else if ( srtkLabelUInt64 ) - { - return "label of 64-bit unsigned integer"; - } - else - { - return "ERRONEOUS PIXEL ID!"; - } -} - -std::ostream& operator<<(std::ostream& os, const PixelIDValueEnum id) -{ - return (os << GetPixelIDValueAsString(id)); -} - - -} -} diff --git a/utilities/SimpleRTK/Code/Common/src/srtkProcessObject.cxx b/utilities/SimpleRTK/Code/Common/src/srtkProcessObject.cxx deleted file mode 100644 index b5d80f588..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkProcessObject.cxx +++ /dev/null @@ -1,546 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include "srtkProcessObject.h" -#include "srtkCommand.h" - -#include "itkProcessObject.h" -#include "itkCommand.h" -#include "itkImageToImageFilter.h" - -#include -#include - -#include "nsstd/functional.h" - -namespace rtk { -namespace simple { - -namespace -{ -static bool GlobalDefaultDebug = false; - -static itk::AnyEvent eventAnyEvent; -static itk::AbortEvent eventAbortEvent; -static itk::DeleteEvent eventDeleteEvent; -static itk::EndEvent eventEndEvent;; -static itk::IterationEvent eventIterationEvent; -static itk::ProgressEvent eventProgressEvent; -static itk::StartEvent eventStartEvent; -static itk::UserEvent eventUserEvent; -static itk::MultiResolutionIterationEvent eventMultiResolutionIterationEvent; - - -// Local class to adapt a srtk::Command to ITK's command. -// It utilizes a raw pointer, and relies on the srtk -// ProcessObject<->Command reference to automatically remove it. -class SimpleAdaptorCommand - : public itk::Command -{ -public: - - typedef SimpleAdaptorCommand Self; - typedef itk::SmartPointer< Self > Pointer; - - itkNewMacro(Self); - - itkTypeMacro(SimpleAdaptorCommand, Command); - - void SetSimpleCommand( rtk::simple::Command *cmd ) - { - m_That=cmd; - } - - /** Invoke the member function. */ - virtual void Execute(itk::Object *, const itk::EventObject &) SRTK_OVERRIDE - { - if (m_That) - { - m_That->Execute(); - } - } - - /** Invoke the member function with a const object */ - virtual void Execute(const itk::Object *, const itk::EventObject &) SRTK_OVERRIDE - { - if ( m_That ) - { - m_That->Execute(); - } - } - -protected: - rtk::simple::Command * m_That; - SimpleAdaptorCommand():m_That(0) {} - virtual ~SimpleAdaptorCommand() {} - -private: - SimpleAdaptorCommand(const Self &); //purposely not implemented - void operator=(const Self &); //purposely not implemented -}; - -} // end anonymous namespace - -//---------------------------------------------------------------------------- - -// -// Default constructor that initializes parameters -// -ProcessObject::ProcessObject () - : m_Debug(ProcessObject::GetGlobalDefaultDebug()), - m_NumberOfThreads(ProcessObject::GetGlobalDefaultNumberOfThreads()), - m_ActiveProcess(NULL), - m_ProgressMeasurement(0.0) -{ -} - - -// -// Destructor -// -ProcessObject::~ProcessObject () -{ - // ensure to remove reference between srtk commands and process object - Self::RemoveAllCommands(); -} - -std::string ProcessObject::ToString() const -{ - std::ostringstream out; - - out << " Debug: "; - this->ToStringHelper(out, this->m_Debug) << std::endl; - - out << " NumberOfThreads: "; - this->ToStringHelper(out, this->m_NumberOfThreads) << std::endl; - - out << " Commands:" << (m_Commands.empty()?" (none)":"") << std::endl; - for( std::list::const_iterator i = m_Commands.begin(); - i != m_Commands.end(); - ++i) - { - assert( i->m_Command ); - out << " Event: " << i->m_Event << " Command: " << i->m_Command->GetName() << std::endl; - } - - out << " ProgressMeasurement: "; - this->ToStringHelper(out, this->m_ProgressMeasurement) << std::endl; - - out << " ActiveProcess:" << (this->m_ActiveProcess?"":" (none)") <m_ActiveProcess ) - { - this->m_ActiveProcess->Print(out, itk::Indent(4)); - } - - return out.str(); -} - - -std::ostream & ProcessObject::ToStringHelper(std::ostream &os, const char &v) -{ - os << int(v); - return os; -} - - -std::ostream & ProcessObject::ToStringHelper(std::ostream &os, const signed char &v) -{ - os << int(v); - return os; -} - - -std::ostream & ProcessObject::ToStringHelper(std::ostream &os, const unsigned char &v) -{ - os << int(v); - return os; -} - - -void ProcessObject::DebugOn() -{ - this->m_Debug = true; -} - - -void ProcessObject::DebugOff() -{ - this->m_Debug = false; -} - - -bool ProcessObject::GetDebug() const -{ - return this->m_Debug; -} - - -void ProcessObject::SetDebug(bool debugFlag) -{ - this->m_Debug = debugFlag; -} - - -void ProcessObject::GlobalDefaultDebugOn() -{ - GlobalDefaultDebug = true; -} - - -void ProcessObject::GlobalDefaultDebugOff() - -{ - GlobalDefaultDebug = false; -} - - -bool ProcessObject::GetGlobalDefaultDebug() -{ - return GlobalDefaultDebug; -} - - -void ProcessObject::SetGlobalDefaultDebug(bool debugFlag) -{ - GlobalDefaultDebug = debugFlag; -} - - -void ProcessObject::GlobalWarningDisplayOn() -{ - itk::Object::GlobalWarningDisplayOn(); -} - - -void ProcessObject::GlobalWarningDisplayOff() -{ - itk::Object::GlobalWarningDisplayOff(); -} - - -bool ProcessObject::GetGlobalWarningDisplay() -{ - return itk::Object::GetGlobalWarningDisplay(); -} - - -void ProcessObject::SetGlobalWarningDisplay(bool flag) -{ - itk::Object::SetGlobalWarningDisplay(flag); -} - - -double ProcessObject::GetGlobalDefaultCoordinateTolerance() -{ - return itk::ImageToImageFilterCommon::GetGlobalDefaultCoordinateTolerance(); -} - -void ProcessObject::SetGlobalDefaultCoordinateTolerance(double tolerance) -{ - return itk::ImageToImageFilterCommon::SetGlobalDefaultCoordinateTolerance(tolerance); -} - -double ProcessObject::GetGlobalDefaultDirectionTolerance() -{ - return itk::ImageToImageFilterCommon::GetGlobalDefaultDirectionTolerance(); -} - -void ProcessObject::SetGlobalDefaultDirectionTolerance(double tolerance) -{ - return itk::ImageToImageFilterCommon::SetGlobalDefaultDirectionTolerance(tolerance); -} - - -void ProcessObject::SetGlobalDefaultNumberOfThreads(unsigned int n) -{ - itk::MultiThreader::SetGlobalDefaultNumberOfThreads(n); -} - - -unsigned int ProcessObject::GetGlobalDefaultNumberOfThreads() -{ - return itk::MultiThreader::GetGlobalDefaultNumberOfThreads(); -} - - -void ProcessObject::SetNumberOfThreads(unsigned int n) -{ - m_NumberOfThreads = n; -} - - -unsigned int ProcessObject::GetNumberOfThreads() const -{ - return m_NumberOfThreads; -} - - -int ProcessObject::AddCommand(EventEnum event, Command &cmd) -{ - // add to our list of event, command pairs - m_Commands.push_back(EventCommand(event,&cmd)); - - // register ourselves with the command - cmd.AddProcessObject(this); - - if (this->m_ActiveProcess) - { - this->AddObserverToActiveProcessObject( m_Commands.back() ); - } - else - { - m_Commands.back().m_ITKTag = std::numeric_limits::max(); - } - - return 0; -} - - -void ProcessObject::RemoveAllCommands() -{ - // set's the m_Commands to an empty list via a swap - std::list oldCommands; - swap(oldCommands, m_Commands); - - // remove commands from active process object - std::list::iterator i = oldCommands.begin(); - while( i != oldCommands.end() && this->m_ActiveProcess ) - { - this->RemoveObserverFromActiveProcessObject(*i); - ++i; - } - - // we must only call RemoveProcessObject once for each command - // so make a unique list of the Commands. - oldCommands.sort(); - oldCommands.unique(); - i = oldCommands.begin(); - while( i != oldCommands.end() ) - { - // note: this may call onCommandDelete, but we have already copied - // this->m_Command will be empty - i++->m_Command->RemoveProcessObject(this); - } -} - - -bool ProcessObject::HasCommand( EventEnum event ) const -{ - std::list::const_iterator i = m_Commands.begin(); - while( i != m_Commands.end() ) - { - if (i->m_Event == event) - { - return true; - } - ++i; - } - return false; -} - - -float ProcessObject::GetProgress( ) const -{ - if ( this->m_ActiveProcess ) - { - return this->m_ActiveProcess->GetProgress(); - } - return m_ProgressMeasurement; -} - - -void ProcessObject::Abort() -{ - if ( this->m_ActiveProcess ) - { - this->m_ActiveProcess->AbortGenerateDataOn(); - } -} - - -void ProcessObject::PreUpdate(itk::ProcessObject *p) -{ - assert(p); - - // propagate number of threads - p->SetNumberOfThreads(this->GetNumberOfThreads()); - - try - { - this->m_ActiveProcess = p; - - // add command on active process deletion - itk::SimpleMemberCommand::Pointer onDelete = itk::SimpleMemberCommand::New(); - onDelete->SetCallbackFunction(this, &Self::OnActiveProcessDelete); - p->AddObserver(itk::DeleteEvent(), onDelete); - - // register commands - for (std::list::iterator i = m_Commands.begin(); - i != m_Commands.end(); - ++i) - { - this->AddObserverToActiveProcessObject(*i); - } - - } - catch (...) - { - this->m_ActiveProcess = NULL; - throw; - } - - if (this->GetDebug()) - { - std::cout << "Executing ITK filter:" << std::endl; - p->Print(std::cout); - } -} - - -unsigned long ProcessObject::AddITKObserver( const itk::EventObject &e, - itk::Command *c) -{ - assert(this->m_ActiveProcess); - return this->m_ActiveProcess->AddObserver(e,c); -} - - -void ProcessObject::RemoveITKObserver( EventCommand &e ) -{ - assert(this->m_ActiveProcess); - this->m_ActiveProcess->RemoveObserver(e.m_ITKTag); -} - - - -const itk::EventObject &ProcessObject::GetITKEventObject(EventEnum e) -{ - switch (e) - { - case srtkAnyEvent: - return eventAnyEvent; - case srtkAbortEvent: - return eventAbortEvent; - case srtkDeleteEvent: - return eventDeleteEvent; - case srtkEndEvent: - return eventEndEvent; - case srtkIterationEvent: - return eventIterationEvent; - case srtkProgressEvent: - return eventProgressEvent; - case srtkStartEvent: - return eventStartEvent; - case srtkUserEvent: - return eventUserEvent; - case srtkMultiResolutionIterationEvent: - return eventMultiResolutionIterationEvent; - default: - srtkExceptionMacro("LogicError: Unexpected event case!"); - } -} - - -itk::ProcessObject *ProcessObject::GetActiveProcess( ) -{ - if (this->m_ActiveProcess) - { - return this->m_ActiveProcess; - } - srtkExceptionMacro("No active process for \"" << this->GetName() << "\"!"); -} - - -void ProcessObject::OnActiveProcessDelete( ) -{ - if (this->m_ActiveProcess) - { - this->m_ProgressMeasurement = this->m_ActiveProcess->GetProgress(); - } - else - { - this->m_ProgressMeasurement = 0.0f; - } - - // clear registered command IDs - for (std::list::iterator i = m_Commands.begin(); - i != m_Commands.end(); - ++i) - { - i->m_ITKTag = std::numeric_limits::max(); - } - - this->m_ActiveProcess = NULL; -} - - -void ProcessObject::onCommandDelete(const rtk::simple::Command *cmd) throw() -{ - // remove command from m_Command book keeping list, and remove it - // from the ITK ProcessObject - std::list::iterator i = this->m_Commands.begin(); - while ( i != this->m_Commands.end() ) - { - if ( cmd == i->m_Command ) - { - if ( this->m_ActiveProcess ) - { - this->RemoveObserverFromActiveProcessObject( *i ); - } - this->m_Commands.erase(i++); - } - else - { - ++i; - } - - } -} - -unsigned long ProcessObject::AddObserverToActiveProcessObject( EventCommand &eventCommand ) -{ - assert( this->m_ActiveProcess ); - - if (eventCommand.m_ITKTag != std::numeric_limits::max()) - { - srtkExceptionMacro("Commands already registered to another process object!"); - } - - const itk::EventObject &itkEvent = GetITKEventObject(eventCommand.m_Event); - - // adapt srtk command to itk command - SimpleAdaptorCommand::Pointer itkCommand = SimpleAdaptorCommand::New(); - itkCommand->SetSimpleCommand(eventCommand.m_Command); - itkCommand->SetObjectName(eventCommand.m_Command->GetName()+" "+itkEvent.GetEventName()); - - return eventCommand.m_ITKTag = this->AddITKObserver( itkEvent, itkCommand ); -} - -void ProcessObject::RemoveObserverFromActiveProcessObject( EventCommand &e ) - { - assert( this->m_ActiveProcess ); - - if (e.m_ITKTag != std::numeric_limits::max() ) - { - this->RemoveITKObserver(e); - e.m_ITKTag = std::numeric_limits::max(); - } - - } - -} // end namespace simple -} // end namespace itk diff --git a/utilities/SimpleRTK/Code/Common/src/srtkThreeDCircularProjectionGeometry.cxx b/utilities/SimpleRTK/Code/Common/src/srtkThreeDCircularProjectionGeometry.cxx deleted file mode 100644 index 061c5027a..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkThreeDCircularProjectionGeometry.cxx +++ /dev/null @@ -1,395 +0,0 @@ - /*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkThreeDCircularProjectionGeometry.h" -#include "srtkTemplateFunctions.h" - -#include "rtkThreeDCircularProjectionGeometry.h" - -#include -#include "nsstd/type_traits.h" - - -namespace rtk -{ -namespace simple -{ -class PimpleThreeDCircularProjectionGeometry -{ -public: - typedef PimpleThreeDCircularProjectionGeometry Self; - typedef rtk::ThreeDCircularProjectionGeometry ProjectionGeometryType; - typedef ProjectionGeometryType::Pointer ProjectionGeometryPointer; - - PimpleThreeDCircularProjectionGeometry( ProjectionGeometryType * p) - { - this->m_ProjectionGeometry = p; - } - - PimpleThreeDCircularProjectionGeometry( ) - { - this->m_ProjectionGeometry = ProjectionGeometryType::New(); - } - - PimpleThreeDCircularProjectionGeometry( Self &s ) - : m_ProjectionGeometry( s.m_ProjectionGeometry ) - {} - - PimpleThreeDCircularProjectionGeometry &operator=( const PimpleThreeDCircularProjectionGeometry &s ) - { - m_ProjectionGeometry = s.m_ProjectionGeometry; - return *this; - } - - ProjectionGeometryType::Pointer GetProjectionGeometry( void ) { return this->m_ProjectionGeometry.GetPointer(); } - ProjectionGeometryType::ConstPointer GetProjectionGeometry( void ) const { return this->m_ProjectionGeometry.GetPointer(); } - - PimpleThreeDCircularProjectionGeometry *ShallowCopy( void ) const - { - return new Self( this->m_ProjectionGeometry.GetPointer() ); - } - - PimpleThreeDCircularProjectionGeometry *DeepCopy( void ) const - { - PimpleThreeDCircularProjectionGeometry *copy( new Self( this->m_ProjectionGeometry->Clone() ) ); - return copy; - } - - int GetReferenceCount( ) const - { - return this->m_ProjectionGeometry->GetReferenceCount(); - } - - std::string ToString( void ) const - { - std::ostringstream out; - this->GetProjectionGeometry()->Print ( out ); - return out.str(); - } - - /** Get projection parameters */ - const std::vector &GetGantryAngles() const - { - return this->m_ProjectionGeometry->GetGantryAngles(); - } - - const std::vector &GetOutOfPlaneAngles() const - { - return this->m_ProjectionGeometry->GetOutOfPlaneAngles(); - } - - const std::vector &GetInPlaneAngles() const - { - return this->m_ProjectionGeometry->GetInPlaneAngles(); - } - - const std::vector &GetSourceAngles() const - { - return this->m_ProjectionGeometry->GetSourceAngles(); - } - - const std::vector GetTiltAngles() const - { - return this->m_ProjectionGeometry->GetTiltAngles(); - } - - const std::vector &GetSourceToIsocenterDistances() const - { - return this->m_ProjectionGeometry->GetSourceToIsocenterDistances(); - } - - const std::vector &GetSourceOffsetsX() const - { - return this->m_ProjectionGeometry->GetSourceOffsetsX(); - } - - const std::vector &GetSourceOffsetsY() const - { - return this->m_ProjectionGeometry->GetSourceOffsetsY(); - } - - const std::vector &GetSourceToDetectorDistances() const - { - return this->m_ProjectionGeometry->GetSourceToDetectorDistances(); - } - - const std::vector &GetProjectionOffsetsX() const - { - return this->m_ProjectionGeometry->GetProjectionOffsetsX(); - } - - const std::vector &GetProjectionOffsetsY() const - { - return this->m_ProjectionGeometry->GetProjectionOffsetsY(); - } - - const std::vector GetSourcePosition( const unsigned int i ) const - { - return srtkITKVectorToSTL(this->m_ProjectionGeometry->GetSourcePosition(i)); - } - - const std::vector GetRotationMatrix( const unsigned int i ) const - { - const ProjectionGeometryType::ThreeDHomogeneousMatrixType &r = this->m_ProjectionGeometry->GetRotationMatrices()[i]; - return std::vector< double >( r.GetVnlMatrix().begin(), r.GetVnlMatrix().end() ); - } - - const std::vector GetMatrix( const unsigned int i ) const - { - const ProjectionGeometryType::MatrixType &m = this->m_ProjectionGeometry->GetMatrices()[i]; - return std::vector< double >( m.GetVnlMatrix().begin(), m.GetVnlMatrix().end() ); - } - - const std::vector GetProjectionCoordinatesToFixedSystemMatrix( const unsigned int i) const - { - const ProjectionGeometryType::ThreeDHomogeneousMatrixType &m = this->m_ProjectionGeometry->GetProjectionCoordinatesToFixedSystemMatrix(i); - return std::vector< double >( m.GetVnlMatrix().begin(), m.GetVnlMatrix().end() ); - } - - const double GetRadiusCylindricalDetector() - { - return this->m_ProjectionGeometry->GetRadiusCylindricalDetector(); - } - - void SetRadiusCylindricalDetector( const double radius ) - { - this->m_ProjectionGeometry->SetRadiusCylindricalDetector(radius); - } - - /** Add the projection */ - void AddProjection(float sid,float sdd,float angle,float isox=0.,float isoy=0., float oa=0., float ia=0., float sx=0., float sy=0.) - { - this->m_ProjectionGeometry->AddProjection(sid,sdd,angle,isox,isoy,oa,ia,sx,sy); - } - void AddProjectionInRadians(float sid,float sdd,float angle,float isox=0.,float isoy=0., float oa=0., float ia=0., float sx=0., float sy=0.) - { - this->m_ProjectionGeometry->AddProjectionInRadians(sid,sdd,angle,isox,isoy,oa,ia,sx,sy); - } - void AddProjection(const std::vector matrix) - { - ProjectionGeometryType::MatrixType itkMatrix; - std::copy( matrix.begin(), matrix.end(), itkMatrix.GetVnlMatrix().begin() ); - this->m_ProjectionGeometry->AddProjection(itkMatrix); - } - void AddProjection(const std::vector sourcePosition, const std::vector detectorPosition, const std::vector detectorRowVector, const std::vector detectorColumnVector) - { - ProjectionGeometryType::PointType source, detector; - ProjectionGeometryType::VectorType row, col; - for(int i=0; i<3; i++) - { - source[i] = sourcePosition[i]; - detector[i] = detectorPosition[i]; - row[i] = detectorRowVector[i]; - col[i] = detectorColumnVector[i]; - } - this->m_ProjectionGeometry->AddProjection(source,detector,row,col); - } - - /** Clears the geometry */ - void Clear() - { - this->m_ProjectionGeometry->Clear(); - } - -private: - - ProjectionGeometryPointer m_ProjectionGeometry; -}; - -// -// class ThreeDCircularProjectionGeometry -// - -ThreeDCircularProjectionGeometry::ThreeDCircularProjectionGeometry( ) - { - m_PimpleThreeDCircularProjectionGeometry = new PimpleThreeDCircularProjectionGeometry(); - } - - ThreeDCircularProjectionGeometry::~ThreeDCircularProjectionGeometry() - { - delete m_PimpleThreeDCircularProjectionGeometry; - this->m_PimpleThreeDCircularProjectionGeometry = NULL; - } - -ThreeDCircularProjectionGeometry::ThreeDCircularProjectionGeometry( const ThreeDCircularProjectionGeometry &txf ) - : m_PimpleThreeDCircularProjectionGeometry( NULL ) - { - m_PimpleThreeDCircularProjectionGeometry= txf.m_PimpleThreeDCircularProjectionGeometry->ShallowCopy(); - } - -ThreeDCircularProjectionGeometry& ThreeDCircularProjectionGeometry::operator=( const ThreeDCircularProjectionGeometry & txf ) - { - // note: if txf and this are the same,the following statements - // will be safe. It's also exception safe. - std::auto_ptr temp( txf.m_PimpleThreeDCircularProjectionGeometry->ShallowCopy() ); - delete this->m_PimpleThreeDCircularProjectionGeometry; - this->m_PimpleThreeDCircularProjectionGeometry = temp.release(); - return *this; - } - -rtk::ProjectionGeometry<3>* ThreeDCircularProjectionGeometry::GetRTKBase ( void ) - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetProjectionGeometry(); - } - -const rtk::ProjectionGeometry<3>* ThreeDCircularProjectionGeometry::GetRTKBase ( void ) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetProjectionGeometry(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetGantryAngles() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetGantryAngles(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetOutOfPlaneAngles() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetOutOfPlaneAngles(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetInPlaneAngles() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetInPlaneAngles(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetSourceAngles() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourceAngles(); - } - -const std::vector ThreeDCircularProjectionGeometry::GetTiltAngles() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetTiltAngles(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetSourceToIsocenterDistances() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourceToIsocenterDistances(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetSourceOffsetsX() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourceOffsetsX(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetSourceOffsetsY() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourceOffsetsY(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetSourceToDetectorDistances() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourceToDetectorDistances(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetProjectionOffsetsX() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetProjectionOffsetsX(); - } - -const std::vector &ThreeDCircularProjectionGeometry::GetProjectionOffsetsY() const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetProjectionOffsetsY(); - } - -const std::vector ThreeDCircularProjectionGeometry::GetSourcePosition( const unsigned int i ) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetSourcePosition(i); - } - -const std::vector ThreeDCircularProjectionGeometry::GetRotationMatrix( const unsigned int i) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetRotationMatrix(i); - } - -const std::vector ThreeDCircularProjectionGeometry::GetMatrix( const unsigned int i) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetMatrix(i); - } - -const std::vector ThreeDCircularProjectionGeometry::GetProjectionCoordinatesToFixedSystemMatrix( const unsigned int i) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetProjectionCoordinatesToFixedSystemMatrix(i); - } - -const double ThreeDCircularProjectionGeometry::GetRadiusCylindricalDetector() - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->GetRadiusCylindricalDetector(); - } - -void ThreeDCircularProjectionGeometry::SetRadiusCylindricalDetector( const double radius ) - { - this->m_PimpleThreeDCircularProjectionGeometry->SetRadiusCylindricalDetector(radius); - } - - -void ThreeDCircularProjectionGeometry::AddProjection(float sid,float sdd,float angle,float isox,float isoy, float oa, float ia, float sx, float sy) - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - this->m_PimpleThreeDCircularProjectionGeometry->AddProjection(sid,sdd,angle,isox,isoy,oa,ia,sx,sy); - } - -void ThreeDCircularProjectionGeometry::AddProjectionInRadians(float sid,float sdd,float angle,float isox,float isoy, float oa, float ia, float sx, float sy) - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - this->m_PimpleThreeDCircularProjectionGeometry->AddProjectionInRadians(sid,sdd,angle,isox,isoy,oa,ia,sx,sy); - } - -void ThreeDCircularProjectionGeometry::AddProjection(const std::vector matrix) - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - this->m_PimpleThreeDCircularProjectionGeometry->AddProjection(matrix); - } - -void ThreeDCircularProjectionGeometry::AddProjection(const std::vector sourcePosition, const std::vector detectorPosition, const std::vector detectorRowVector, const std::vector detectorColumnVector) - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - this->m_PimpleThreeDCircularProjectionGeometry->AddProjection(sourcePosition,detectorPosition,detectorRowVector,detectorColumnVector); - } - -void ThreeDCircularProjectionGeometry::Clear() - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - this->m_PimpleThreeDCircularProjectionGeometry->Clear(); - } - -std::string ThreeDCircularProjectionGeometry::ToString( void ) const - { - assert( m_PimpleThreeDCircularProjectionGeometry ); - return this->m_PimpleThreeDCircularProjectionGeometry->ToString(); - } - -} -} diff --git a/utilities/SimpleRTK/Code/Common/src/srtkTransform.cxx b/utilities/SimpleRTK/Code/Common/src/srtkTransform.cxx deleted file mode 100644 index 7e43e0932..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkTransform.cxx +++ /dev/null @@ -1,600 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkTransform.h" -#include "srtkTemplateFunctions.h" - -#include "itkTransformBase.h" -#include "itkTransformFactory.h" - -#include "itkIdentityTransform.h" -#include "itkTranslationTransform.h" -#include "itkScaleTransform.h" -#include "itkScaleLogarithmicTransform.h" -#include "itkSimilarity2DTransform.h" -#include "itkSimilarity3DTransform.h" -#include "itkEuler2DTransform.h" -#include "itkEuler3DTransform.h" -#include "itkQuaternionRigidTransform.h" -#include "itkVersorTransform.h" -#include "itkVersorRigid3DTransform.h" -#include "itkAffineTransform.h" -#include "itkCompositeTransform.h" - -#include "itkTransformFileReader.h" -#include "itkTransformFileWriter.h" - -#include - -#include "nsstd/type_traits.h" - -namespace -{ - -// -// Transform trait class to map to correct special transform type. -template -class TransformTraits -{ -public: - // undefined types for non-2D/3D -}; - -template -class TransformTraits -{ -public: - typedef itk::Euler2DTransform EulerTransformType; - typedef itk::Similarity2DTransform SimilarityTransformType; -}; - -template -class TransformTraits -{ -public: - typedef itk::Euler3DTransform EulerTransformType; - typedef itk::Similarity3DTransform SimilarityTransformType; -}; - - -} - -namespace rtk -{ -namespace simple -{ - -namespace -{ -template -bool RegisterMoreTransforms(void) -{ - typedef itk::MatrixOffsetTransformBase MatrixOffsetTransformType; - itk::TransformFactory::RegisterTransform(); - typedef itk::MatrixOffsetTransformBase MatrixOffsetTransformType; - itk::TransformFactory::RegisterTransform(); - return true; -} - -bool initialized = RegisterMoreTransforms<2>() && RegisterMoreTransforms<3>(); - -} - -// This is a base class of the private implementatino of the transform -// class. -// -// The interface provide virutal method and other generic methods to -// the concrete ITK transform type, there by provide encapsulation and -// a uniform interface -class PimpleTransformBase -{ -public: - virtual ~PimpleTransformBase( void ) {}; - - // Get Access to the internal ITK transform class - virtual itk::TransformBase::Pointer GetTransformBase( void ) = 0; - virtual itk::TransformBase::ConstPointer GetTransformBase( void ) const = 0; - - // general methods to get information about the internal class - virtual unsigned int GetInputDimension( void ) const = 0; - virtual unsigned int GetOutputDimension( void ) const = 0; - - // Set the fixed parameter for the transform, converting from the - // simpleRTK std::vector to the ITK's array. - void SetFixedParameters( const std::vector< double > &inParams ) - { - itk::TransformBase::ParametersType p( inParams.size() ); - - // todo check expected number of Fixed parameters - std::copy( inParams.begin(), inParams.end(), p.begin() ); - this->GetTransformBase()->SetFixedParameters( p ); - } - - // Get the fixed parameters form the transform - std::vector< double > GetFixedParameters( void ) const - { - const itk::TransformBase::ParametersType &p = this->GetTransformBase()->GetFixedParameters(); - return std::vector< double >( p.begin(), p.end() ); - } - - - unsigned int GetNumberOfParameters( void ) const { return this->GetTransformBase()->GetNumberOfParameters(); } - - - void SetParameters( const std::vector< double > &inParams ) - { - itk::TransformBase::ParametersType p( inParams.size() ); - - // todo check expected number of Parameters - std::copy( inParams.begin(), inParams.end(), p.begin() ); - this->GetTransformBase()->SetParameters( p ); - } - std::vector< double > GetParameters( void ) const - { - const itk::TransformBase::ParametersType &p = this->GetTransformBase()->GetParameters(); - return std::vector< double >( p.begin(), p.end() ); - } - - - virtual PimpleTransformBase *ShallowCopy( void ) const = 0; - virtual PimpleTransformBase *DeepCopy( void ) const = 0; - - virtual int GetReferenceCount( ) const = 0; - - std::string ToString( void ) const - { - std::ostringstream out; - this->GetTransformBase()->Print ( out ); - return out.str(); - } - - // note: the returned pointer needs to be externally managed and - // deleted - // Also the return pointer could be this - virtual PimpleTransformBase* AddTransform( Transform &t ) = 0; - - - virtual std::vector< double > TransformPoint( const std::vector< double > &t ) const = 0; - -protected: - -}; - -template< typename TTransformType > -class PimpleTransform - : public PimpleTransformBase -{ -public: - typedef PimpleTransform Self; - typedef TTransformType TransformType; - typedef typename TransformType::Pointer TransformPointer; - - typedef itk::CompositeTransform CompositeTransformType; - - static const unsigned int InputDimension = TTransformType::InputSpaceDimension; - static const unsigned int OutputDimension = TTransformType::OutputSpaceDimension; - - PimpleTransform( TransformType * p) - { - this->m_Transform = p; - } - - PimpleTransform( ) - { - this->m_Transform = TransformType::New(); - } - - PimpleTransform( Self &s ) - : m_Transform( s.m_Transform ) - {} - - PimpleTransform &operator=( const PimpleTransform &s ) - { - m_Transform = s.m_Transform; - } - - virtual itk::TransformBase::Pointer GetTransformBase( void ) { return this->m_Transform.GetPointer(); } - virtual itk::TransformBase::ConstPointer GetTransformBase( void ) const { return this->m_Transform.GetPointer(); } - - virtual unsigned int GetInputDimension( void ) const { return InputDimension; } - virtual unsigned int GetOutputDimension( void ) const { return OutputDimension; } - - - virtual PimpleTransformBase *ShallowCopy( void ) const - { - return new Self( this->m_Transform.GetPointer() ); - } - - virtual PimpleTransformBase *DeepCopy( void ) const - { - PimpleTransformBase *copy( new Self( this->m_Transform->Clone() ) ); - return copy; - } - - virtual int GetReferenceCount( ) const - { - return this->m_Transform->GetReferenceCount(); - } - - virtual PimpleTransformBase* AddTransform( Transform &t ) - { - if ( t.GetDimension() != TransformType::InputSpaceDimension ) - { - srtkExceptionMacro( "Transform argument has dimension " << t.GetDimension() - << " does not match this dimesion of " << TransformType::InputSpaceDimension ); - } - - typename CompositeTransformType::TransformType* base = - dynamic_cast< typename CompositeTransformType::TransformType*>( t.GetITKBase() ); - - return this->AddTransform( base, typename nsstd::is_same::type() ); - } - - PimpleTransformBase* AddTransform( typename CompositeTransformType::TransformType* t, nsstd::true_type isCompositeTransform ) - { - Unused( isCompositeTransform ); - assert( t->GetInputSpaceDimension() == TransformType::InputSpaceDimension ); - - m_Transform->AddTransform( t ); - return this; - } - - PimpleTransformBase* AddTransform( typename CompositeTransformType::TransformType* t, nsstd::false_type isNotCompositeTransform ) - { - Unused( isNotCompositeTransform ); - - typename CompositeTransformType::Pointer composite = CompositeTransformType::New(); - composite->AddTransform( this->m_Transform ); - composite->AddTransform( t ); - return new PimpleTransform( composite ); - } - - - - virtual std::vector< double > TransformPoint( const std::vector< double > &pt ) const - { - if (pt.size() != this->GetInputDimension() ) - { - srtkExceptionMacro("vector dimension mismatch"); - } - - typename TransformType::OutputPointType opt = - this->m_Transform->TransformPoint( srtkSTLVectorToITK< typename TransformType::InputPointType >(pt)); - - return srtkITKVectorToSTL( opt ); - } - -private: - - TransformPointer m_Transform; -}; - -// -// class Transform -// - -Transform::Transform( ) - : m_PimpleTransform( NULL ) - { - m_PimpleTransform = new PimpleTransform >(); - } - - Transform::Transform( unsigned int dimensions, TransformEnum type) - : m_PimpleTransform( NULL ) - { - if ( dimensions == 2 ) - { - this->InternalInitialization<2>(type); - } - else if ( dimensions == 3 ) - { - this->InternalInitialization<3>(type); - } - else - { - srtkExceptionMacro("Invalid dimension for transform"); - } - } - - Transform::~Transform() - { - delete m_PimpleTransform; - this->m_PimpleTransform = NULL; - } - - Transform::Transform( const Transform &txf ) - : m_PimpleTransform( NULL ) - { - m_PimpleTransform = txf.m_PimpleTransform->ShallowCopy(); - } - - Transform& Transform::operator=( const Transform & txf ) - { - // note: if txf and this are the same,the following statements - // will be safe. It's also exception safe. - std::auto_ptr temp( txf.m_PimpleTransform->ShallowCopy() ); - delete this->m_PimpleTransform; - this->m_PimpleTransform = temp.release(); - return *this; - } - -void Transform::MakeUniqueForWrite( void ) -{ - if ( this->m_PimpleTransform->GetReferenceCount() > 1 ) - { - std::auto_ptr temp( this->m_PimpleTransform->DeepCopy() ); - delete this->m_PimpleTransform; - this->m_PimpleTransform = temp.release(); - } -} - - template< unsigned int VDimension> - void Transform::InternalInitialization( TransformEnum type, itk::TransformBase *base ) - { - switch( type ) - { - - case srtkTranslation: - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkScale: - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkScaleLogarithmic: - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkEuler: - m_PimpleTransform = new PimpleTransform::EulerTransformType>(); - break; - case srtkSimilarity: - m_PimpleTransform = new PimpleTransform::SimilarityTransformType>(); - break; - case srtkQuaternionRigid: - if( VDimension != 3) - { - srtkExceptionMacro( "A srtkQuaternionRigid Transform only works for 3D!"); - } - - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkVersor: - if( VDimension != 3) - { - srtkExceptionMacro( "A srtkVersor Transform only works for 3D!"); - } - - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkVersorRigid: - if( VDimension != 3) - { - srtkExceptionMacro( "A srtkVersorRigid Transform only works for 3D!"); - } - - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkAffine: - m_PimpleTransform = new PimpleTransform >(); - break; - case srtkComposite: - { - typename itk::CompositeTransform::Pointer compositeTransform; - - if ( !base ) - { - compositeTransform = itk::CompositeTransform::New(); - } - else - { - compositeTransform = dynamic_cast*>( base ); - if ( !compositeTransform ) - { - srtkExceptionMacro("Unexpectedly unable to convert to CompositeTransform" ); - } - } - - if ( compositeTransform->IsTransformQueueEmpty() ) - { - - // Load an identity transform in case no transforms are loaded. - typedef itk::IdentityTransform IdentityTransformType; - typename IdentityTransformType::Pointer identityTransform = IdentityTransformType::New(); - - compositeTransform->AddTransform( identityTransform ); - } - m_PimpleTransform = new PimpleTransform >( compositeTransform ); - } - break; - case srtkIdentity: - default: - m_PimpleTransform = new PimpleTransform >(); - - } - } - - - itk::TransformBase* Transform::GetITKBase ( void ) - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->GetTransformBase(); - } - - const itk::TransformBase* Transform::GetITKBase ( void ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->GetTransformBase(); - } - - unsigned int Transform::GetDimension( void ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->GetInputDimension(); - } - - void Transform::SetParameters ( const std::vector& parameters ) - { - assert( m_PimpleTransform ); - this->MakeUniqueForWrite(); - this->m_PimpleTransform->SetParameters( parameters ); - } - - std::vector Transform::GetParameters( void ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->GetParameters(); - } - - void Transform::SetFixedParameters ( const std::vector& parameters ) - { - assert( m_PimpleTransform ); - this->MakeUniqueForWrite(); - this->m_PimpleTransform->SetFixedParameters( parameters ); - } - - std::vector Transform::GetFixedParameters( void ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->GetFixedParameters(); - } - - Transform &Transform::AddTransform( Transform t ) - { - assert( m_PimpleTransform ); - this->MakeUniqueForWrite(); - // this returns a pointer which may be the same or a new object - PimpleTransformBase *temp = this->m_PimpleTransform->AddTransform( t ); - if ( temp != this->m_PimpleTransform ) - { - delete this->m_PimpleTransform; - this->m_PimpleTransform = temp; - } - return *this; - } - - std::vector< double > Transform::TransformPoint( const std::vector< double > &point ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->TransformPoint( point ); - } - - std::string Transform::ToString( void ) const - { - assert( m_PimpleTransform ); - return this->m_PimpleTransform->ToString(); - } - - Transform ReadTransform( const std::string &filename ) - { - itk::TransformFileReader::Pointer reader = itk::TransformFileReader::New(); - reader->SetFileName(filename.c_str() ); - reader->Update(); - - itk::TransformFileReader::TransformListType *list = reader->GetTransformList(); - - if ( list->empty() ) - { - srtkExceptionMacro( "Read transform file: \"" << filename << "\", but there appears to be not transform in the file!" ); - } - - if( list->front()->GetInputSpaceDimension() == 3 - && list->front()->GetOutputSpaceDimension() == 3 ) - { - typedef itk::CompositeTransform CompositeTransformType; - typedef CompositeTransformType::TransformType TransformType; - - CompositeTransformType::Pointer comp; - - // check if transform is a composite - comp = dynamic_cast(list->front().GetPointer()); - if ( comp ) - { - return Transform( comp.GetPointer() ); - } - - if( list->size() != 1 ) - { - std::cerr << "Warning: There is more than one tranform in the file! Only using the first transform.\n"; - } - - - typedef itk::Transform TransformType; - TransformType* itktx = dynamic_cast(list->front().GetPointer()); - if (itktx) - { - comp = CompositeTransformType::New(); - comp->ClearTransformQueue(); - comp->AddTransform( itktx ); - return Transform( comp.GetPointer() ); - } - - } - - if( list->front()->GetInputSpaceDimension() == 2 - && list->front()->GetOutputSpaceDimension() == 2) - { - typedef itk::CompositeTransform CompositeTransformType; - - CompositeTransformType::Pointer comp; - - // check if transform is a composite - comp = dynamic_cast(list->front().GetPointer()); - if ( comp ) - { - return Transform( comp.GetPointer() ); - } - - if( list->size() != 1 ) - { - std::cerr << "Warning: There is more than one tranform in the file! Only using the first transform.\n"; - } - - typedef itk::Transform TransformType; - TransformType* itktx = dynamic_cast(list->front().GetPointer()); - - if (itktx) - { - comp = CompositeTransformType::New(); - comp->ClearTransformQueue(); - comp->AddTransform( itktx ); - return Transform( comp.GetPointer() ); - } - - } - - srtkExceptionMacro( "Unable to transform with InputSpaceDimension: " << list->front()->GetInputSpaceDimension() - << " and OutputSpaceDimension: " << list->front()->GetOutputSpaceDimension() << "." - << "Transform of type " << list->front()->GetNameOfClass() << "is not supported." ); - - } - - void Transform::WriteTransform( const std::string &filename ) const - { - rtk::simple::WriteTransform( *this, filename ); - } - - // write - void WriteTransform( const Transform &transform, const std::string &filename) - { - itk::TransformFileWriter::Pointer writer = itk::TransformFileWriter::New(); - writer->SetFileName(filename.c_str()); - writer->SetInput( transform.GetITKBase() ); - writer->Update(); - - } - -} -} diff --git a/utilities/SimpleRTK/Code/Common/src/srtkVersion.cxx b/utilities/SimpleRTK/Code/Common/src/srtkVersion.cxx deleted file mode 100644 index 93a8781d8..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkVersion.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkVersion.h" -#include "srtkVersionConfig.h" - -#include "rtkConfiguration.h" - -namespace -{ - -std::string MakeExtendedVersionString() -{ - std::ostringstream v; - v << "SimpleRTK Version: " << rtk::simple::Version::VersionString() - << " (RTK " << RTK_VERSION_STRING << ", ITK " << ITK_VERSION_STRING << ")" << std::endl - << "Compiled: " << rtk::simple::Version::BuildDate() << std::endl; - return v.str(); -} - -static const std::string rtkVersionString = RTK_VERSION_STRING; -static const std::string extendedVersionString = MakeExtendedVersionString(); - -} - -namespace rtk -{ - namespace simple - { - - unsigned int Version::MajorVersion() - { - return SimpleRTK_VERSION_MAJOR; - } - unsigned int Version::MinorVersion() - { - return SimpleRTK_VERSION_MINOR; - } - unsigned int Version::PatchVersion() - { - return SimpleRTK_VERSION_PATCH; - } - unsigned int Version::TweakVersion() - { - return 0; - } - const std::string &Version::VersionString() - { - static const std::string v( SimpleRTK_VERSION ); - return v; - } - const std::string &Version::BuildDate() - { - static const std::string v( __DATE__ " " __TIME__ ); - return v; - } - unsigned int Version::RTKMajorVersion() - { - return RTK_VERSION_MAJOR; - } - unsigned int Version::RTKMinorVersion() - { - return RTK_VERSION_MINOR; - } - unsigned int Version::RTKPatchVersion() - { - return RTK_VERSION_PATCH; - } - const std::string &Version::RTKVersionString() - { - return rtkVersionString; - } - const std::string &Version::ExtendedVersionString() - { - return extendedVersionString; - } - } -} diff --git a/utilities/SimpleRTK/Code/Common/src/srtkVersionConfig.h.in b/utilities/SimpleRTK/Code/Common/src/srtkVersionConfig.h.in deleted file mode 100644 index 6cf016201..000000000 --- a/utilities/SimpleRTK/Code/Common/src/srtkVersionConfig.h.in +++ /dev/null @@ -1,24 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - - -#define SimpleRTK_VERSION_MAJOR @SimpleRTK_VERSION_MAJOR@ -#define SimpleRTK_VERSION_MINOR @SimpleRTK_VERSION_MINOR@ -#define SimpleRTK_VERSION_PATCH @SimpleRTK_VERSION_PATCH@ -#define SimpleRTK_VERSION_TWEAK @SimpleRTK_VERSION_TWEAK@ -#define SimpleRTK_VERSION "@SimpleRTK_VERSION@" diff --git a/utilities/SimpleRTK/Code/IO/CMakeLists.txt b/utilities/SimpleRTK/Code/IO/CMakeLists.txt deleted file mode 100644 index d4fb65825..000000000 --- a/utilities/SimpleRTK/Code/IO/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory( src ) diff --git a/utilities/SimpleRTK/Code/IO/include/srtkIO.h b/utilities/SimpleRTK/Code/IO/include/srtkIO.h deleted file mode 100644 index 0a0076f6d..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkIO.h +++ /dev/null @@ -1,38 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkIO_h -#define __srtkIO_h - -#include "srtkMacro.h" - -#if defined( SRTKDLL ) - #ifdef SimpleRTKIO_EXPORTS - #define SRTKIO_EXPORT SRTK_ABI_EXPORT - #else - #define SRTKIO_EXPORT SRTK_ABI_IMPORT - #endif /* SimpleRTKIO_EXPORTS */ -#else - // Don't hide symbols in the static SimpleRTKIO library in case - // -fvisibility=hidden is used - #define SRTKIO_EXPORT - -#endif - -#define SRTKIO_HIDDEN SRTK_ABI_HIDDEN - -#endif // __srtkIO_h diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImageFileReader.h b/utilities/SimpleRTK/Code/IO/include/srtkImageFileReader.h deleted file mode 100644 index 0779a2e79..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImageFileReader.h +++ /dev/null @@ -1,77 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageFileReader_h -#define __srtkImageFileReader_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkImageReaderBase.h" -#include "srtkMemberFunctionFactory.h" - -namespace rtk { - namespace simple { - - /** \class ImageFileReader - * \brief Read a 2D or 3D image and return a smart pointer to a SimpleRTK - * image - * - * This reader handles scalar and vector images and returns an image with - * the same type as the file on disk. - * - * \sa rtk::simple::ReadImage for the procedural interface - */ - class SRTKIO_EXPORT ImageFileReader - : public ImageReaderBase - { - public: - typedef ImageFileReader Self; - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ImageFileReader"); } - - SRTK_RETURN_SELF_TYPE_HEADER SetFileName ( std::string fn ); - std::string GetFileName() const; - - Image Execute(); - - ImageFileReader(); - - protected: - - template Image ExecuteInternal ( itk::ImageIOBase * ); - - private: - - // function pointer type - typedef Image (Self::*MemberFunctionType)( itk::ImageIOBase * ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - nsstd::auto_ptr > m_MemberFactory; - - std::string m_FileName; - }; - - SRTKIO_EXPORT Image ReadImage ( std::string filename, PixelIDValueEnum outputPixelType = srtkUnknown ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImageFileWriter.h b/utilities/SimpleRTK/Code/IO/include/srtkImageFileWriter.h deleted file mode 100644 index 954588444..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImageFileWriter.h +++ /dev/null @@ -1,98 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageFileWriter_h -#define __srtkImageFileWriter_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkIO.h" -#include "srtkProcessObject.h" - -#include - -namespace rtk { - namespace simple { - - /** \class ImageFileWriter - * \brief Write out a SimpleRTK image to the specified file location - * - * This writer tries to write the image out using the image's type to the - * location specified in FileName. If writing fails, an ITK exception is - * thrown. - * - * \sa rtk::simple::WriteImage for the procedural interface - */ - class SRTKIO_EXPORT ImageFileWriter : - public ProcessObject - { - public: - typedef ImageFileWriter Self; - - // list of pixel types supported - typedef NonLabelPixelIDTypeList PixelIDTypeList; - - ImageFileWriter( void ); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ImageFileWriter"); } - - /** \brief Enable compression if available for file type. - * - * These methods Set/Get/Toggle the UseCompression flag which - * get's passed to image file's itk::ImageIO object. This is - * only a request as not all file formatts support compression. - * @{ */ - SRTK_RETURN_SELF_TYPE_HEADER SetUseCompression( bool UseCompression ); - bool GetUseCompression( void ) const; - - SRTK_RETURN_SELF_TYPE_HEADER UseCompressionOn( void ) { return this->SetUseCompression(true); } - SRTK_RETURN_SELF_TYPE_HEADER UseCompressionOff( void ) { return this->SetUseCompression(false); } - /** @} */ - - SRTK_RETURN_SELF_TYPE_HEADER SetFileName ( std::string fileName ); - std::string GetFileName() const; - - SRTK_RETURN_SELF_TYPE_HEADER Execute ( const Image& ); - SRTK_RETURN_SELF_TYPE_HEADER Execute ( const Image& , const std::string &inFileName, bool inUseCompression ); - - private: - - template Self& ExecuteInternal ( const Image& ); - - bool m_UseCompression; - std::string m_FileName; - - // function pointer type - typedef Self& (Self::*MemberFunctionType)( const Image& ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - - nsstd::auto_ptr > m_MemberFactory; - - }; - - SRTKIO_EXPORT void WriteImage ( const Image& image, const std::string &fileName, bool useCompression=false ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImageReaderBase.h b/utilities/SimpleRTK/Code/IO/include/srtkImageReaderBase.h deleted file mode 100644 index 6f3fc4d7b..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImageReaderBase.h +++ /dev/null @@ -1,109 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageReaderBase_h -#define __srtkImageReaderBase_h - -#include "srtkProcessObject.h" -#include "srtkPixelIDValues.h" -#include "srtkIO.h" - -namespace itk { - -// Forward decalaration for pointer -class ImageIOBase; - -template -class SmartPointer; -} - -namespace rtk { - namespace simple { - - /** \class ImageReaderBase - * \brief An abract base class for image readers - * - */ - class SRTKIO_EXPORT ImageReaderBase : - public ProcessObject - { - public: - typedef ImageReaderBase Self; - - ImageReaderBase(); - // The destructor will be implicitly declared as public. - - /** \brief Set/Get The output PixelType of the image. - * - * By default the value is sitkUnknown, which enable the output - * pixel type to be same as the file. If the pixel type is - * specified then the itk::ConvertPixelBuffer will be used to - * convert the pixels. - * @{ - */ - SRTK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueEnum pixelID ); - PixelIDValueEnum GetOutputPixelType( void ) const; - /* @} */ - - virtual Image Execute() = 0; - - virtual std::string ToString() const; - - /** \brief Set/Get loading private DICOM tags into Image's MetaData - * - * Unknown private tags may be encoded with Base64 encoding. - * @{ - */ - virtual Self& SetLoadPrivateTags(bool loadPrivateTags); - virtual bool GetLoadPrivateTags() const; - virtual void LoadPrivateTagsOn(); - virtual void LoadPrivateTagsOff(); - /* @} */ - - protected: - - itk::SmartPointer GetImageIOBase(const std::string &fileName); - - - void GetPixelIDFromImageIO( const std::string &fileName, - PixelIDValueType &outPixelType, - unsigned int & outDimensions); - void GetPixelIDFromImageIO( itk::ImageIOBase* iobase, - PixelIDValueType &outPixelType, - unsigned int & outDimensions); - - unsigned int GetDimensionFromImageIO( const std::string &fileName, unsigned int i); - unsigned int GetDimensionFromImageIO( itk::ImageIOBase* iobase, unsigned int i); - - private: - - PixelIDValueType ExecuteInternalReadScalar( int componentType ); - - PixelIDValueType ExecuteInternalReadVector( int componentType ); - - PixelIDValueType ExecuteInternalReadComplex( int componentType ); - - - PixelIDValueEnum m_OutputPixelType; - bool m_LoadPrivateTags; - - }; - } -} - - -#endif // __srtkImageReaderBase_h diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesReader.h b/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesReader.h deleted file mode 100644 index 73e96619e..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesReader.h +++ /dev/null @@ -1,129 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImageSeriesReader_h -#define __srtkImageSeriesReader_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkImageReaderBase.h" -#include "srtkMemberFunctionFactory.h" - -namespace rtk { - namespace simple { - - /** \class ImageSeriesReader - * \brief Read series of image into a SimpleRTK image - * - * \sa rtk::simple::ReadImage for the procedural interface - **/ - class SRTKIO_EXPORT ImageSeriesReader - : public ImageReaderBase - { - public: - typedef ImageSeriesReader Self; - - ImageSeriesReader(); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ImageSeriesReader"); } - - /** \brief Generate a sequence of filenames from a directory with a DICOM data set. - * - * This method generates a sequence of filenames whose filenames - * point to DICOM files. The ordering is based of one of - * several strategies, which will read all images in the - * directory ( assuming there is only one study/series ). - * - * \param directory Set the directory that contains the DICOM data set. - * \param recursive Recursively parse the input directory. - * \param useSeriesDetails Use additional series information such as ProtocolName and SeriesName to identify when a single SeriesUID contains multiple 3D volumes - as can occur with perfusion and DTI imaging. - * \param loadSequences Parse any sequences in the DICOM data set. Loading DICOM files is faster when sequences are not needed. - * \param loadPrivateTags Parse any private tags in the DICOM data set. Defaults to false to skip private tags. Loading DICOM files faster is when private tags are not needed. - * - * \sa itk::GDCMSeriesFileNames - **/ - static std::vector GetGDCMSeriesFileNames( const std::string &directory, - bool useSeriesDetails = false, - bool recursive = false, - bool loadSequences = false, - bool loadPrivateTags = false ) - { - return ImageSeriesReader::GetGDCMSeriesFileNames( directory, "", useSeriesDetails, recursive, loadSequences, loadPrivateTags ); - } - - - /** \brief Generate a sequence of filenames from a directory with a DICOM data set and a series ID. - * - * This method generates a sequence of filenames whose filenames - * point to DICOM files. The data set may contain multiple series. - * The seriesID string is used to select a specific series. The - * ordering of the filenames is based of one of several strategies, - * which will read all images in the directory ( assuming there is - * only one study/series ). - * - * \param directory Set the directory that contains the DICOM data set. - * \param recursive Recursively parse the input directory. - * \param seriesID Set the name that identifies a particular series. - * \param useSeriesDetails Use additional series information such as ProtocolName and SeriesName to identify when a single SeriesUID contains multiple 3D volumes - as can occur with perfusion and DTI imaging. - * \param loadSequences Parse any sequences in the DICOM data set. Loading DICOM files is faster when sequences are not needed. - * \param loadPrivateTags Parse any private tags in the DICOM data set. Defaults to false to skip private tags. Loading DICOM files is faster when private tags are not needed. - * - * \sa itk::GDCMSeriesFileNames - **/ - static std::vector GetGDCMSeriesFileNames( const std::string &directory, - const std::string &seriesID, - bool useSeriesDetails = false, - bool recursive = false, - bool loadSequences = false, - bool loadPrivateTags = false ); - - /** \brief Get all the seriesIDs from a DICOM data set - * - * \param directory The directory that contains the DICOM data set - * \sa itk::GDCMSeriesFileNames - **/ - static std::vector GetGDCMSeriesIDs( const std::string &directory ); - - SRTK_RETURN_SELF_TYPE_HEADER SetFileNames ( const std::vector &fileNames ); - const std::vector &GetFileNames() const; - - Image Execute(); - - protected: - - template Image ExecuteInternal ( itk::ImageIOBase * ); - - private: - - // function pointer type - typedef Image (Self::*MemberFunctionType)( itk::ImageIOBase * ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - nsstd::auto_ptr > m_MemberFactory; - - std::vector m_FileNames; - }; - SRTKIO_EXPORT Image ReadImage ( const std::vector &fileNames, PixelIDValueEnum outputPixelType=srtkUnknown ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesWriter.h b/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesWriter.h deleted file mode 100644 index b30854c6a..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImageSeriesWriter.h +++ /dev/null @@ -1,97 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __srtkImageSeriesWriter_h -#define __srtkImageSeriesWriter_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkProcessObject.h" -#include "srtkIO.h" -#include "srtkMemberFunctionFactory.h" - -namespace rtk { - namespace simple { - - /** \class ImageSeriesWriter - * \brief Writer series of image from a SimpleITK image. - * - * - * \sa itk::simple::WriteImage for the procedural interface - **/ - class SRTKIO_EXPORT ImageSeriesWriter - : public ProcessObject - { - public: - typedef ImageSeriesWriter Self; - - ImageSeriesWriter(); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ImageSeriesWriter"); } - - /** \brief Enable compression if available for file type. - * - * These methods Set/Get/Toggle the UseCompression flag which - * get's passed to image file's itk::ImageIO object. This is - * only a request as not all file formatts support compression. - * @{ */ - SRTK_RETURN_SELF_TYPE_HEADER SetUseCompression( bool UseCompression ); - bool GetUseCompression( void ) const; - - SRTK_RETURN_SELF_TYPE_HEADER UseCompressionOn(void) { return this->SetUseCompression(true); } - SRTK_RETURN_SELF_TYPE_HEADER UseCompressionOff(void) { return this->SetUseCompression(false); } - /** @} */ - - /** The filenames to where the image slices are written. - * - * The number of filenames must match the number of slices in - * the image. - * @{ */ - SRTK_RETURN_SELF_TYPE_HEADER SetFileNames(const std::vector &fileNames); - const std::vector &GetFileNames() const; - /** @} */ - - - SRTK_RETURN_SELF_TYPE_HEADER Execute(const Image&); - SRTK_RETURN_SELF_TYPE_HEADER Execute(const Image &image, const std::vector &inFileNames, bool inUseCompression); - - protected: - - template Self &ExecuteInternal ( const Image& inImage ); - - private: - - // function pointer type - typedef Self& (Self::*MemberFunctionType)( const Image& ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - nsstd::auto_ptr > m_MemberFactory; - - bool m_UseCompression; - std::vector m_FileNames; - }; - - SRTKIO_EXPORT void WriteImage ( const Image & image, const std::vector &fileNames, bool inUseCompression=false ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkImportImageFilter.h b/utilities/SimpleRTK/Code/IO/include/srtkImportImageFilter.h deleted file mode 100644 index 05e13d43c..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkImportImageFilter.h +++ /dev/null @@ -1,214 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkImportImageFilter_h -#define __srtkImportImageFilter_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkImageReaderBase.h" -#include "srtkMemberFunctionFactory.h" - -namespace rtk { - namespace simple { - - /** \class ImportImageFilter - * \brief Compose a 2D or 3D image and return a smart pointer to a SimpleRTK - * image - * - * This filter is intended to interface SimpleRTK to other image processing - * libraries and applications that may have their own representation of an - * image class. It creates a SimpleITK image which shares the bulk - * data buffer as what is set. SimpleITK will not responsible to - * delete the buffer afterwards, and it buffer must remain valid - * while in use. - * - * \sa rtk::simple::ImportAsInt8, rtk::simple::ImportAsUInt8, - * rtk::simple::ImportAsInt16, rtk::simple::ImportAsUInt16, - * rtk::simple::ImportAsInt32, rtk::simple::ImportAsUInt32, - * rtk::simple::ImportAsInt64, rtk::simple::ImportAsUInt64, - * rtk::simple::ImportAsFloat,rtk::simple::ImportAsDouble for the - * procedural interfaces. - */ - class SRTKIO_EXPORT ImportImageFilter - : public ImageReaderBase { - public: - typedef ImportImageFilter Self; - - ImportImageFilter(); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ImportImageFilter"); } - - SRTK_RETURN_SELF_TYPE_HEADER SetSize( const std::vector< unsigned int > &size ); - const std::vector< unsigned int > &GetSize( ) const; - - SRTK_RETURN_SELF_TYPE_HEADER SetSpacing( const std::vector< double > &spacing ); - const std::vector< double > &GetSpacing( ) const; - - SRTK_RETURN_SELF_TYPE_HEADER SetOrigin( const std::vector< double > &origin ); - const std::vector< double > &GetOrigin( ) const; - - SRTK_RETURN_SELF_TYPE_HEADER SetDirection( const std::vector< double > &direction ); - const std::vector< double > &GetDirection( ) const; - - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsInt8( int8_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt8( uint8_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsInt16( int16_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt16( uint16_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsInt32( int32_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt32( uint32_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsInt64( int64_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsUInt64( uint64_t * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsFloat( float * buffer, unsigned int numberOfComponents = 1 ); - SRTK_RETURN_SELF_TYPE_HEADER SetBufferAsDouble( double * buffer, unsigned int numberOfComponents = 1 ); - - Image Execute(); - - protected: - - // Internal method called the the template dispatch system - template Image ExecuteInternal ( void ); - - // If the output image type is a VectorImage then the number of - // components per pixel needs to be set, otherwise the method - // does not exist. This is done with the EnableIf Idiom. - template - typename DisableIf::Value>::Type - SetNumberOfComponentsOnImage( TImageType* ) {} - template - typename EnableIf::Value>::Type - SetNumberOfComponentsOnImage( TImageType* ); - - private: - - // function pointer type - typedef Image (Self::*MemberFunctionType)( void ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - nsstd::auto_ptr > m_MemberFactory; - - unsigned int m_NumberOfComponentsPerPixel; - PixelIDValueType m_PixelIDValue; - - std::vector< double > m_Origin; - std::vector< double > m_Spacing; - std::vector< unsigned int > m_Size; - std::vector< double > m_Direction; - - void * m_Buffer; - - }; - - Image SRTKIO_EXPORT ImportAsInt8( - int8_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsUInt8( - uint8_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsInt16( - int16_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsUInt16( - uint16_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsInt32( - int32_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsUInt32( - uint32_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsInt64( - int64_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsUInt64( - uint64_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsFloat( - float * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - Image SRTKIO_EXPORT ImportAsDouble( - double * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing = std::vector< double >( 3, 1.0 ), - const std::vector< double > &origin = std::vector< double >( 3, 0.0 ), - const std::vector< double > &direction = std::vector< double >(), - unsigned int numberOfComponents = 1 - ); - - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkProjectionsReader.h b/utilities/SimpleRTK/Code/IO/include/srtkProjectionsReader.h deleted file mode 100644 index cd19cfae0..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkProjectionsReader.h +++ /dev/null @@ -1,72 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkProjectionsReader_h -#define __srtkProjectionsReader_h - -#include "srtkMacro.h" -#include "srtkImage.h" -#include "srtkImageReaderBase.h" -#include "srtkMemberFunctionFactory.h" - -namespace rtk { - namespace simple { - - /** \class ProjectionsReader - * \brief Read and convert to attenuation serie of projections into a SimpleRTK image - * - * \sa rtk::simple::ReadProjections for the procedural interface - **/ - class SRTKIO_EXPORT ProjectionsReader - : public ImageReaderBase - { - public: - typedef ProjectionsReader Self; - - ProjectionsReader(); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ProjectionsReader"); } - - Self& SetFileNames ( const std::vector &fileNames ); - const std::vector &GetFileNames() const; - - Image Execute(); - - protected: - - template Image ExecuteInternal ( void ); - - private: - - // function pointer type - typedef Image (Self::*MemberFunctionType)( void ); - - // friend to get access to executeInternal member - friend struct detail::MemberFunctionAddressor; - std::auto_ptr > m_MemberFactory; - - std::vector m_FileNames; - }; - SRTKIO_EXPORT Image ReadProjections ( const std::vector &fileNames ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkShow.h b/utilities/SimpleRTK/Code/IO/include/srtkShow.h deleted file mode 100644 index a1246abaa..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkShow.h +++ /dev/null @@ -1,94 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkShow_h -#define __srtkShow_h - -#include "srtkImage.h" -#include "srtkIO.h" - -namespace rtk -{ -namespace simple -{ - - /** Display an image using ImageJ - * - * This function requires that ImageJ - * (http://rsb.info.nih.gov/ij/) be properly installed for Mac - * and Windows, and in the user's path for Linux. ImageJ must have - * a plugin for reading Nifti formatted files (http://www.loci.wisc.edu/bio-formats/imagej). - * - * Nifti is the default file format used to export images. A different - * format can by chosen by setting the SRTK_SHOW_EXTENSION environment variable. - * For example, set SRTK_SHOW_EXTENSION to ".png" to use PNG format. - * - * The user can specify an application other than ImageJ to view images via - * the SRTK_SHOW_COMMAND environment variable. - * - * The user can also select applications specifically for color images or 3D - * images using the SRTK_SHOW_COLOR_COMMAND and SRTK_SHOW_3D_COMMAND environment - * variables. - * - * SRTK_SHOW_COMMAND, SRTK_SHOW_COLOR_COMMAND and SRTK_SHOW_3D_COMMAND allow - * the following %tokens in their strings. - * - * \li \c "%a" for the ImageJ application - * \li \c "%f" for SimpleRTK's temporary image file - * - * For example, the default SRTK_SHOW_COMMAND string on Linux systems is: - * - * \code - * %a -o %f - * \endcode - * - * After token substitution it may become: - * - * \code - * ImageJ -o /tmp/Temp-65535-0.nii - * \endcode - * - * For another example, the default SRTK_SHOW_COLOR_COMMAND string on Mac OS X is: - * - * \code - * open -a %a -n --args -eval \'open(\"%f\"); run(\"Make Composite\", \"display=Composite\"); \' - * \endcode - * - * After token substitution the string may become: - * - * \code - * open -a ImageJ64 -n --args -eval 'open("/tmp/TempFile-20238-0.nii"); run("Make Composite", "display=Composite");' - * \endcode - * - * The string after \c "-eval" is an ImageJ macro the opens the file and runs ImageJ's Make Composite - * command to display the image in color. - * - * If the \c "%f" token is not found in the command string, the temporary file name is automatically - * appended to the command argument list. - * - * - * By default, for a 64-bit build of SimpleRTK on Macs, srtkShow searches for ImageJ64.app. - * For a 32-bit Mac build, srtkShow searches for ImageJ.app. If the user prefers a different - * version of ImageJ (or a different image viewer altogether), it can be specified using - * the SRTK_SHOW_COMMAND environment variable. - * - **/ - void SRTKIO_EXPORT Show ( const Image &image, const std::string title = "" ); -} -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h b/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h deleted file mode 100644 index e0fca7e15..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileReader.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkThreeDCircularProjectionGeometryXMLFileReader_h -#define __srtkThreeDCircularProjectionGeometryXMLFileReader_h - -#include "srtkMacro.h" -#include "srtkThreeDCircularProjectionGeometry.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkIO.h" -#include "srtkProcessObject.h" - -#include - -namespace rtk { - namespace simple { - - /** \class ThreeDCircularProjectionGeometryXMLFileReader - * \brief Reads in an RTK 3D circular geometry as XML - */ - class SRTKIO_EXPORT ThreeDCircularProjectionGeometryXMLFileReader : - public ProcessObject - { - public: - typedef ThreeDCircularProjectionGeometryXMLFileReader Self; - - // function pointer type - typedef Self& (Self::*MemberFunctionType)( const ThreeDCircularProjectionGeometry& ); - - ThreeDCircularProjectionGeometryXMLFileReader( void ); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ThreeDCircularProjectionGeometryXMLFileReader"); } - - Self& SetFileName ( std::string fileName ); - std::string GetFileName() const; - - ThreeDCircularProjectionGeometry Execute ( ); - ThreeDCircularProjectionGeometry Execute ( const std::string &inFileName ); - - private: - - std::string m_FileName; - ThreeDCircularProjectionGeometry m_Geometry; - }; - - SRTKIO_EXPORT ThreeDCircularProjectionGeometry ReadXML ( const std::string &fileName ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h b/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h deleted file mode 100644 index 3ab65b290..000000000 --- a/utilities/SimpleRTK/Code/IO/include/srtkThreeDCircularProjectionGeometryXMLFileWriter.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __srtkThreeDCircularProjectionGeometryXMLFileWriter_h -#define __srtkThreeDCircularProjectionGeometryXMLFileWriter_h - -#include "srtkMacro.h" -#include "srtkThreeDCircularProjectionGeometry.h" -#include "srtkMemberFunctionFactory.h" -#include "srtkIO.h" -#include "srtkProcessObject.h" - -#include - -namespace rtk { - namespace simple { - - /** \class ThreeDCircularProjectionGeometryXMLFileWriter - * \brief Write out an RTK 3D circular geometry as XML - */ - class SRTKIO_EXPORT ThreeDCircularProjectionGeometryXMLFileWriter : - public ProcessObject - { - public: - typedef ThreeDCircularProjectionGeometryXMLFileWriter Self; - - // function pointer type - typedef Self& (Self::*MemberFunctionType)( const ThreeDCircularProjectionGeometry& ); - - ThreeDCircularProjectionGeometryXMLFileWriter( void ); - - /** Print ourselves to string */ - virtual std::string ToString() const; - - /** return user readable name fo the filter */ - virtual std::string GetName() const { return std::string("ThreeDCircularProjectionGeometryXMLFileWriter"); } - - Self& SetFileName ( std::string fileName ); - std::string GetFileName() const; - - Self& Execute ( const ThreeDCircularProjectionGeometry& ); - Self& Execute ( const ThreeDCircularProjectionGeometry& , const std::string &inFileName ); - - private: - - std::string m_FileName; - - }; - - SRTKIO_EXPORT void WriteXML ( const ThreeDCircularProjectionGeometry& geometry, const std::string &fileName ); - } -} - -#endif diff --git a/utilities/SimpleRTK/Code/IO/src/CMakeLists.txt b/utilities/SimpleRTK/Code/IO/src/CMakeLists.txt deleted file mode 100644 index e573e0e91..000000000 --- a/utilities/SimpleRTK/Code/IO/src/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ - -set( SimpleRTKIOSource - srtkImageFileReader.cxx - srtkImageFileWriter.cxx - srtkImageReaderBase.cxx - srtkImageSeriesReader.cxx - srtkImageSeriesWriter.cxx - srtkImportImageFilter.cxx - srtkShow.cxx - srtkThreeDCircularProjectionGeometryXMLFileReader.cxx - srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx - srtkProjectionsReader.cxx - ) - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) - -include(${ITK_USE_FILE}) -include(${RTK_USE_FILE}) - -add_library ( SimpleRTKIO ${SimpleRTKIOSource} ) -target_link_libraries ( SimpleRTKIO ${ITK_LIBRARIES} SimpleRTKCommon ) -set_target_properties( SimpleRTKIO PROPERTIES SKIP_BUILD_RPATH TRUE ) - -srtk_install_exported_target( SimpleRTKIO ) - -# Add custom command that will delete java files which need to be rebuilt when changes -# are made to IO -if( WRAP_JAVA ) - add_custom_command( - TARGET SimpleRTKIO - POST_BUILD - COMMENT "Cleaning java build..." - COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleRTK_BINARY_DIR}/Wrapping/org/rtk/simple/*.java - COMMAND ${CMAKE_COMMAND} -E remove -f ${SimpleRTK_BINARY_DIR}/Wrapping/build/org/rtk/simple/*.class - ) -endif() diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImageFileReader.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImageFileReader.cxx deleted file mode 100644 index 30589425e..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImageFileReader.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifdef _MFC_VER -#pragma warning(disable:4996) -#endif - -#include "srtkImageFileReader.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include - - -namespace rtk { - namespace simple { - - Image ReadImage ( std::string filename, PixelIDValueEnum outputPixelType ) - { - ImageFileReader reader; - return reader.SetFileName ( filename ).SetOutputPixelType(outputPixelType).Execute(); - } - - ImageFileReader::ImageFileReader() - { - // list of pixel types supported - typedef NonLabelPixelIDTypeList PixelIDTypeList; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 4 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - } - - std::string ImageFileReader::ToString() const { - - std::ostringstream out; - out << "rtk::simple::ImageFileReader"; - out << std::endl; - out << " FileName: \""; - this->ToStringHelper(out, this->m_FileName) << "\"" << std::endl; - - out << ImageReaderBase::ToString(); - return out.str(); - } - - ImageFileReader& ImageFileReader::SetFileName ( std::string fn ) { - this->m_FileName = fn; - return *this; - } - - std::string ImageFileReader::GetFileName() const { - return this->m_FileName; - } - - Image ImageFileReader::Execute () { - - PixelIDValueType type = this->GetOutputPixelType(); - unsigned int dimension = 0; - - - itk::ImageIOBase::Pointer imageio = this->GetImageIOBase( this->m_FileName ); - if (type == srtkUnknown) - { - this->GetPixelIDFromImageIO( imageio, type, dimension ); - } - else - { - PixelIDValueType unused; - this->GetPixelIDFromImageIO( imageio, unused, dimension ); - } - -#ifdef SRTK_4D_IMAGES - if ( dimension != 2 && dimension != 3 && dimension != 4 ) -#else - if ( dimension != 2 && dimension != 3 ) -#endif - { - srtkExceptionMacro( "The file in the series have unsupported " << dimension - 1 << " dimensions." ); - } - - if ( !this->m_MemberFactory->HasMemberFunction( type, dimension ) ) - { - srtkExceptionMacro( << "PixelType is not supported!" << std::endl - << "Pixel Type: " - << GetPixelIDValueAsString( type ) << std::endl - << "Refusing to load! " << std::endl ); - } - - return this->m_MemberFactory->GetMemberFunction( type, dimension )(imageio.GetPointer()); - } - - template - Image - ImageFileReader::ExecuteInternal( itk::ImageIOBase *imageio ) - { - - typedef TImageType ImageType; - typedef itk::ImageFileReader Reader; - - // if the InstantiatedToken is correctly implemented this should - // not occour - assert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown ); - assert( imageio != SRTK_NULLPTR ); - typename Reader::Pointer reader = Reader::New(); - reader->SetImageIO( imageio ); - reader->SetFileName( this->m_FileName.c_str() ); - - this->PreUpdate( reader.GetPointer() ); - - reader->Update(); - - return Image( reader->GetOutput() ); - } - - } -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImageFileWriter.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImageFileWriter.cxx deleted file mode 100644 index 4f7865ae4..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImageFileWriter.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "srtkImageFileWriter.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include -#include - -namespace rtk { -namespace simple { - -void WriteImage ( const Image& image, const std::string &inFileName, bool inUseCompression ) - { - ImageFileWriter writer; - writer.Execute ( image, inFileName, inUseCompression ); - } - - -ImageFileWriter::ImageFileWriter() - { - this->m_UseCompression = false; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 4 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - - } - - -std::string ImageFileWriter::ToString() const - { - std::ostringstream out; - out << "rtk::simple::ImageFileWriter"; - out << std::endl; - - out << " UseCompression: "; - this->ToStringHelper(out, this->m_UseCompression); - out << std::endl; - - out << " FileName: \""; - this->ToStringHelper(out, this->m_FileName); - out << "\"" << std::endl; - - out << ProcessObject::ToString(); - return out.str(); - } - - ImageFileWriter::Self& - ImageFileWriter::SetUseCompression( bool UseCompression ) - { - this->m_UseCompression = UseCompression; - return *this; - } - - bool ImageFileWriter::GetUseCompression( void ) const - { - return this->m_UseCompression; - } - -ImageFileWriter& ImageFileWriter::SetFileName ( std::string fn ) - { - this->m_FileName = fn; - return *this; - } - -std::string ImageFileWriter::GetFileName() const - { - return this->m_FileName; - } - - ImageFileWriter& ImageFileWriter::Execute ( const Image& image, const std::string &inFileName, bool inUseCompression ) - { - this->SetFileName( inFileName ); - this->SetUseCompression( inUseCompression ); - return this->Execute( image ); - } - -ImageFileWriter& ImageFileWriter::Execute ( const Image& image ) - { - PixelIDValueType type = image.GetPixelIDValue(); - unsigned int dimension = image.GetDimension(); - - return this->m_MemberFactory->GetMemberFunction( type, dimension )( image ); - } - -//----------------------------------------------------------------------------- -template -ImageFileWriter& ImageFileWriter::ExecuteInternal( const Image& inImage ) - { - typename InputImageType::ConstPointer image = - dynamic_cast ( inImage.GetITKBase() ); - - typedef itk::ImageFileWriter Writer; - typename Writer::Pointer writer = Writer::New(); - writer->SetUseCompression( this->m_UseCompression ); - writer->SetFileName ( this->m_FileName.c_str() ); - writer->SetInput ( image ); - - this->PreUpdate( writer.GetPointer() ); - - writer->Update(); - - return *this; - } - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImageReaderBase.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImageReaderBase.cxx deleted file mode 100644 index 99b7f1b4b..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImageReaderBase.cxx +++ /dev/null @@ -1,383 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkImageReaderBase.h" -#include "srtkMacro.h" -#include "srtkExceptionObject.h" - - -// Include the Transform IO here, so that the IO factory registration -// will occour. -#include -#include - -#include - -#include - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include -#include -#include -#include - -namespace rtk { -namespace simple { - -ImageReaderBase -::ImageReaderBase() - : m_OutputPixelType(srtkUnknown), - m_LoadPrivateTags(false) -{ -} - -std::string -ImageReaderBase -::ToString() const -{ - std::ostringstream out; - out << " OutputPixelType: "; - this->ToStringHelper(out, this->m_OutputPixelType) << std::endl; - out << " LoadPrivateTags: "; - this->ToStringHelper(out, this->m_LoadPrivateTags) << std::endl; - out << ProcessObject::ToString(); - return out.str(); -} - -itk::SmartPointer -ImageReaderBase -::GetImageIOBase(const std::string &fileName) -{ - itk::ImageIOBase::Pointer iobase = - itk::ImageIOFactory::CreateImageIO( fileName.c_str(), itk::ImageIOFactory::ReadMode); - - - if ( iobase.IsNull() ) - { - if ( !itksys::SystemTools::FileExists( fileName.c_str() ) ) - { - srtkExceptionMacro( "The file \"" << fileName << "\" does not exist." ); - } - - if ( !bool(std::ifstream( fileName.c_str() )) ) - { - srtkExceptionMacro( "Unable to open \"" << fileName << "\" for reading." ); - } - - srtkExceptionMacro( "Unable to determine ImageIO reader for \"" << fileName << "\"" ); - } - - // Try additional parameters - itk::GDCMImageIO *ioGDCMImage = dynamic_cast(iobase.GetPointer()); - if (ioGDCMImage) - { - ioGDCMImage->SetLoadPrivateTags(this->m_LoadPrivateTags); - } - - // Read the image information - iobase->SetFileName( fileName ); - iobase->ReadImageInformation(); - - - return iobase; -} - -ImageReaderBase::Self& -ImageReaderBase -::SetOutputPixelType( PixelIDValueEnum pixelID ) -{ - this->m_OutputPixelType = pixelID; - return *this; -} - -PixelIDValueEnum -ImageReaderBase -::GetOutputPixelType( void ) const -{ - return this->m_OutputPixelType; -} - - -ImageReaderBase::Self& -ImageReaderBase -::SetLoadPrivateTags(bool loadPrivateTags) -{ - this->m_LoadPrivateTags = loadPrivateTags; - return *this; -} - -bool -ImageReaderBase -::GetLoadPrivateTags() const -{ - return this->m_LoadPrivateTags; -} - -void -ImageReaderBase -::LoadPrivateTagsOn() -{ - this->SetLoadPrivateTags(true); -} - -void -ImageReaderBase -::LoadPrivateTagsOff() -{ - this->SetLoadPrivateTags(false); -} - - -void -ImageReaderBase -::GetPixelIDFromImageIO( const std::string &fileName, - PixelIDValueType &outPixelType, - unsigned int & outDimensions ) -{ - itk::ImageIOBase::Pointer iobase = this->GetImageIOBase(fileName); - - - this->GetPixelIDFromImageIO(iobase, outPixelType, outDimensions); -} - -void -ImageReaderBase -::GetPixelIDFromImageIO( itk::ImageIOBase *iobase, - PixelIDValueType &outPixelType, - unsigned int & outDimensions ) -{ - - // get output information about input image - unsigned int dimension = iobase->GetNumberOfDimensions(); - itk::ImageIOBase::IOComponentType componentType = iobase->GetComponentType(); - itk::ImageIOBase::IOPixelType pixelType = iobase->GetPixelType(); - unsigned int numberOfComponents = iobase->GetNumberOfComponents(); - - outDimensions = dimension; - - - if (numberOfComponents == 1 && - ( pixelType == itk::ImageIOBase::SCALAR || pixelType == itk::ImageIOBase::COMPLEX ) ) - { - outPixelType = this->ExecuteInternalReadScalar( componentType ); - return; - } - // we try to load anything else into a VectorImage - else if (pixelType == itk::ImageIOBase::RGB || - pixelType == itk::ImageIOBase::RGBA || - pixelType == itk::ImageIOBase::VECTOR || - pixelType == itk::ImageIOBase::COVARIANTVECTOR || - pixelType == itk::ImageIOBase::FIXEDARRAY || - pixelType == itk::ImageIOBase::POINT || - pixelType == itk::ImageIOBase::OFFSET ) - { - outPixelType = this->ExecuteInternalReadVector( componentType ); - return; - } - else if ( pixelType == itk::ImageIOBase::COMPLEX ) - { - outPixelType = this->ExecuteInternalReadComplex( componentType ); - return; - } - else - { - srtkExceptionMacro( "Unknown PixelType: " << (int) componentType ); - } - - srtkExceptionMacro( "Unable to load image." ); -} - -unsigned int -ImageReaderBase -::GetDimensionFromImageIO( itk::ImageIOBase* iobase, unsigned int i) -{ - return iobase->GetDimensions(i); -} - - -unsigned int -ImageReaderBase -::GetDimensionFromImageIO(const std::string &filename, unsigned int i) -{ - itk::ImageIOBase::Pointer iobase = this->GetImageIOBase(filename); - - return this->GetDimensionFromImageIO(iobase.GetPointer(), i); -} - - -PixelIDValueType -ImageReaderBase -::ExecuteInternalReadScalar( int componentType ) -{ - const unsigned int UnusedDimension = 2; - -#ifdef RTK_USE_CUDA - switch(componentType) - { - case itk::ImageIOBase::CHAR: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::UCHAR: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::SHORT: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::USHORT: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::INT: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::UINT: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::LONG: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::ULONG: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::FLOAT: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; - case itk::ImageIOBase::DOUBLE: - return ImageTypeToPixelIDValue< itk::CudaImage >::Result; - break; -#else - switch(componentType) - { - case itk::ImageIOBase::CHAR: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::UCHAR: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::SHORT: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::USHORT: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::INT: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::UINT: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::LONG: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::ULONG: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::FLOAT: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; - case itk::ImageIOBase::DOUBLE: - return ImageTypeToPixelIDValue< itk::Image >::Result; - break; -#endif - case itk::ImageIOBase::UNKNOWNCOMPONENTTYPE: - default: - assert( false ); // should never get here unless we forgot a type - srtkExceptionMacro( "Logic error!" ); - } -} - - -PixelIDValueType -ImageReaderBase -::ExecuteInternalReadComplex( int componentType ) -{ - const unsigned int UnusedDimension = 2; - - switch(componentType) - { -#ifdef RTK_USE_CUDA - case itk::ImageIOBase::FLOAT: - return ImageTypeToPixelIDValue< itk::CudaImage, UnusedDimension> >::Result; - break; - case itk::ImageIOBase::DOUBLE: - return ImageTypeToPixelIDValue< itk::CudaImage, UnusedDimension> >::Result; - break; -#else - case itk::ImageIOBase::FLOAT: - return ImageTypeToPixelIDValue< itk::Image, UnusedDimension> >::Result; - break; - case itk::ImageIOBase::DOUBLE: - return ImageTypeToPixelIDValue< itk::Image, UnusedDimension> >::Result; - break; -#endif - case itk::ImageIOBase::UNKNOWNCOMPONENTTYPE: - default: - srtkExceptionMacro( "Only Complex image with float and double are supported!" ); - } -} - -PixelIDValueType -ImageReaderBase -::ExecuteInternalReadVector( int componentType ) -{ - const unsigned int UnusedDimension = 2; - - switch(componentType) - { - case itk::ImageIOBase::CHAR: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::UCHAR: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::SHORT: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::USHORT: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::INT: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::UINT: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::LONG: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::ULONG: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::FLOAT: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::DOUBLE: - return ImageTypeToPixelIDValue< itk::VectorImage >::Result; - break; - case itk::ImageIOBase::UNKNOWNCOMPONENTTYPE: - default: - assert( false ); // should never get here unless we forgot a type - srtkExceptionMacro( "Logic error!" ); - } -} - - -} -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesReader.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesReader.cxx deleted file mode 100644 index 1df87a568..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesReader.cxx +++ /dev/null @@ -1,188 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifdef _MFC_VER -#pragma warning(disable:4996) -#endif - -#include "srtkImageSeriesReader.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include - -#include "itkGDCMSeriesFileNames.h" - -namespace rtk { - namespace simple { - - Image ReadImage ( const std::vector &filenames, PixelIDValueEnum outputPixelType ) - { - ImageSeriesReader reader; - return reader.SetFileNames ( filenames ).SetOutputPixelType(outputPixelType).Execute(); - } - - - std::vector ImageSeriesReader::GetGDCMSeriesFileNames( const std::string &directory, - const std::string &seriesID, - bool useSeriesDetails, - bool recursive, - bool loadSequences, - bool loadPrivateTags ) - { - itk::GDCMSeriesFileNames::Pointer gdcmSeries = itk::GDCMSeriesFileNames::New(); - - gdcmSeries->SetInputDirectory( directory ); - gdcmSeries->SetUseSeriesDetails( useSeriesDetails ); - gdcmSeries->SetRecursive( recursive ); - gdcmSeries->SetLoadSequences( loadSequences ); - gdcmSeries->SetLoadPrivateTags( loadPrivateTags ); - - gdcmSeries->Update(); - - return gdcmSeries->GetFileNames(seriesID); - } - - std::vector ImageSeriesReader::GetGDCMSeriesIDs( const std::string &directory ) - { - itk::GDCMSeriesFileNames::Pointer gdcmSeries = itk::GDCMSeriesFileNames::New(); - - gdcmSeries->SetInputDirectory( directory ); - return gdcmSeries->GetSeriesUIDs(); - } - - ImageSeriesReader::ImageSeriesReader() - { - - // list of pixel types supported - typedef NonLabelPixelIDTypeList PixelIDTypeList; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - } - - std::string ImageSeriesReader::ToString() const { - - std::ostringstream out; - out << "itk::simple::ImageSeriesReader"; - out << std::endl; - - out << " FileNames:" << std::endl; - std::vector::const_iterator iter = m_FileNames.begin(); - while( iter != m_FileNames.end() ) - { - std::cout << " \"" << *iter << "\"" << std::endl; - ++iter; - } - - out << ImageReaderBase::ToString(); - return out.str(); - } - - ImageSeriesReader& ImageSeriesReader::SetFileNames ( const std::vector &filenames ) - { - this->m_FileNames = filenames; - return *this; - } - - const std::vector &ImageSeriesReader::GetFileNames() const - { - return this->m_FileNames; - } - - Image ImageSeriesReader::Execute () - { - if( this->m_FileNames.empty() ) - { - srtkExceptionMacro( "File names information is empty. Cannot read series." ); - } - - - PixelIDValueType type = this->GetOutputPixelType(); - unsigned int dimension = 0; - - - itk::ImageIOBase::Pointer imageio = this->GetImageIOBase( this->m_FileNames.front() ); - if (type == srtkUnknown) - { - this->GetPixelIDFromImageIO( imageio, type, dimension ); - } - else - { - PixelIDValueType unused; - this->GetPixelIDFromImageIO( imageio, unused, dimension ); - } - - // increment for series - ++dimension; - - if (dimension == 4) - { - unsigned int size = this->GetDimensionFromImageIO( imageio, 2); - if (size == 1) - { - --dimension; - } - } - - if ( dimension != 2 && dimension != 3 ) - { - srtkExceptionMacro( "The file in the series have unsupported " << dimension - 1 << " dimensions." ); - } - - if ( !this->m_MemberFactory->HasMemberFunction( type, dimension ) ) - { - srtkExceptionMacro( << "PixelType is not supported!" << std::endl - << "Pixel Type: " - << GetPixelIDValueAsString( type ) << std::endl - << "Refusing to load! " << std::endl ); - } - - return this->m_MemberFactory->GetMemberFunction( type, dimension )(imageio); - } - - template Image - ImageSeriesReader::ExecuteInternal( itk::ImageIOBase* imageio ) - { - - typedef TImageType ImageType; - typedef itk::ImageSeriesReader Reader; - - // if the IsInstantiated is correctly implemented this should - // not occur - assert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown ); - assert( imageio != SRTK_NULLPTR ); - typename Reader::Pointer reader = Reader::New(); - reader->SetImageIO( imageio ); - reader->SetFileNames( this->m_FileNames ); - // save some computation by not updating this unneeded data-structure - reader->MetaDataDictionaryArrayUpdateOff(); - - this->PreUpdate( reader.GetPointer() ); - - reader->Update(); - - return Image( reader->GetOutput() ); - } - - } -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesWriter.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesWriter.cxx deleted file mode 100644 index 4765a74c2..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImageSeriesWriter.cxx +++ /dev/null @@ -1,146 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ - -// suppress warning about using sprintf -#ifdef _MSC_VER - #define _CRT_SECURE_NO_WARNINGS -#endif - -#include "srtkImageSeriesWriter.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include - -namespace rtk { - namespace simple { - - void WriteImage ( const Image& inImage, const std::vector &filenames, bool inUseCompression ) - { - ImageSeriesWriter writer; - writer.Execute( inImage, filenames, inUseCompression ); - } - - ImageSeriesWriter::ImageSeriesWriter() - { - - this->m_UseCompression = false; - - // list of pixel types supported - typedef NonLabelPixelIDTypeList PixelIDTypeList; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - //this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - } - - std::string ImageSeriesWriter::ToString() const - { - - std::ostringstream out; - out << "itk::simple::ImageSeriesWriter"; - out << std::endl; - - out << " UseCompression: "; - this->ToStringHelper(out, this->m_UseCompression); - out << std::endl; - - out << " FileNames:" << std::endl; - std::vector::const_iterator iter = m_FileNames.begin(); - while( iter != m_FileNames.end() ) - { - std::cout << " \"" << *iter << "\"" << std::endl; - ++iter; - } - - return out.str(); - } - - - ImageSeriesWriter::Self& - ImageSeriesWriter::SetUseCompression( bool UseCompression ) - { - this->m_UseCompression = UseCompression; - return *this; - } - - bool ImageSeriesWriter::GetUseCompression( void ) const - { - return this->m_UseCompression; - } - - - ImageSeriesWriter& ImageSeriesWriter::SetFileNames ( const std::vector &filenames ) - { - this->m_FileNames = filenames; - return *this; - } - - const std::vector &ImageSeriesWriter::GetFileNames() const - { - return this->m_FileNames; - } - - - ImageSeriesWriter& ImageSeriesWriter::Execute ( const Image& image, const std::vector &inFileNames, bool inUseCompression ) - { - this->SetFileNames( inFileNames ); - this->SetUseCompression( inUseCompression ); - return this->Execute( image ); - } - - ImageSeriesWriter &ImageSeriesWriter::Execute ( const Image &image ) - { - - // check that the number of file names match the slice size - PixelIDValueType type = image.GetPixelIDValue(); - unsigned int dimension = image.GetDimension(); - - return this->m_MemberFactory->GetMemberFunction( type, dimension )( image ); - } - - template - ImageSeriesWriter & - ImageSeriesWriter::ExecuteInternal( const Image& inImage ) - { - // Define the input and output image types - typedef TImageType InputImageType; - - typename InputImageType::ConstPointer image = this->CastImageToITK( inImage ); - - typedef itk::ImageSeriesWriter::Type> Writer; - - typename Writer::Pointer writer = Writer::New(); - writer->SetUseCompression( this->m_UseCompression ); - writer->SetFileNames( this->m_FileNames ); - writer->SetInput( image ); - - this->PreUpdate( writer.GetPointer() ); - - writer->Update(); - - return *this; - } - - } -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkImportImageFilter.cxx b/utilities/SimpleRTK/Code/IO/src/srtkImportImageFilter.cxx deleted file mode 100644 index f212de0ca..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkImportImageFilter.cxx +++ /dev/null @@ -1,584 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifdef _MFC_VER -#pragma warning(disable:4996) -#endif - -#include "srtkImportImageFilter.h" -#include "srtkExceptionObject.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include - -#include - -// private namespace -namespace -{ -const unsigned int UnusedDimension = 2; -} - -namespace rtk { -namespace simple { - -Image ImportAsInt8( - int8_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsInt8( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsUInt8( - uint8_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsUInt8( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsInt16( - int16_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsInt16( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsUInt16( - uint16_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsUInt16( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsInt32( - int32_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsInt32( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsUInt32( - uint32_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsUInt32( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsInt64( - int64_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsInt64( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsUInt64( - uint64_t * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsUInt64( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsFloat( - float * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsFloat( buffer, numberOfComponents ); - return import.Execute(); -} - -Image ImportAsDouble( - double * buffer, - const std::vector< unsigned int > &size, - const std::vector< double > &spacing, - const std::vector< double > &origin, - const std::vector< double > &direction, - unsigned int numberOfComponents -) { - ImportImageFilter import; - import.SetSize( size ); - import.SetSpacing( spacing ); - import.SetOrigin( origin ); - import.SetDirection( direction ); - import.SetBufferAsDouble( buffer, numberOfComponents ); - return import.Execute(); -} - -ImportImageFilter::ImportImageFilter() -{ - m_NumberOfComponentsPerPixel = 0; - m_PixelIDValue = srtkUnknown; - m_Origin = std::vector( 3, 0.0 ); - m_Spacing = std::vector( 3, 1.0 ); - this->m_Buffer = NULL; - - // list of pixel types supported - typedef NonLabelPixelIDTypeList PixelIDTypeList; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 4 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - -} - -ImportImageFilter::Self& ImportImageFilter::SetSpacing( const std::vector< double > &spacing ) -{ - this->m_Spacing = spacing; - return *this; -} - -const std::vector< double > &ImportImageFilter::GetSpacing( ) const -{ - return this->m_Spacing; -} - -ImportImageFilter::Self& ImportImageFilter::SetOrigin( const std::vector< double > &origin ) -{ - this->m_Origin = origin; - return *this; -} - -const std::vector< double > &ImportImageFilter::GetOrigin( ) const -{ - return this->m_Origin; -} - -ImportImageFilter::Self& ImportImageFilter::SetSize( const std::vector< unsigned int > &size ) -{ - this->m_Size = size; - return *this; -} - -const std::vector< unsigned int > &ImportImageFilter::GetSize( ) const -{ - return this->m_Size; -} - -ImportImageFilter::Self& ImportImageFilter::SetDirection( const std::vector< double > &direction ) -{ - this->m_Direction = direction; - return *this; -} - -const std::vector< double > &ImportImageFilter::GetDirection( ) const -{ - return this->m_Direction; -} - -ImportImageFilter::Self& ImportImageFilter::SetBufferAsInt8( int8_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsUInt8( uint8_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsInt16( int16_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsUInt16( uint16_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsInt32( int32_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsUInt32( uint32_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsInt64( int64_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsUInt64( uint64_t * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} - -ImportImageFilter::Self& ImportImageFilter::SetBufferAsFloat( float * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} -ImportImageFilter::Self& ImportImageFilter::SetBufferAsDouble( double * buffer, unsigned int numberOfComponents ) -{ - this->m_Buffer = buffer; - this->m_NumberOfComponentsPerPixel = numberOfComponents; - if ( this->m_NumberOfComponentsPerPixel == 1 ) - { -#ifdef RTK_USE_CUDA - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::CudaImage >::Result; -#else - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::Image >::Result; -#endif - } - else - { - this->m_PixelIDValue = ImageTypeToPixelIDValue< itk::VectorImage >::Result; - } - return *this; -} - - -#define PRINT_IVAR_MACRO( VAR ) "\t" << #VAR << ": " << VAR << std::endl - -std::string ImportImageFilter::ToString() const -{ - std::ostringstream out; - - out << "rtk::simple::ImportImageFilter\n" - << PRINT_IVAR_MACRO( m_NumberOfComponentsPerPixel ) - << PRINT_IVAR_MACRO( m_PixelIDValue ) - << PRINT_IVAR_MACRO( m_Origin ) - << PRINT_IVAR_MACRO( m_Spacing ) - << PRINT_IVAR_MACRO( m_Size ) - << PRINT_IVAR_MACRO( m_Direction ) - << PRINT_IVAR_MACRO( m_Buffer ); - return out.str(); -} - -Image ImportImageFilter::Execute () -{ - unsigned int imageDimension = this->m_Size.size(); - - // perform sanity check on some parameters - if ( this->m_NumberOfComponentsPerPixel == 0 || this->m_PixelIDValue == srtkUnknown ) - { - srtkExceptionMacro( << "PixelType or NumberOfComponentsPerPixel are invalid!" ); - } - - - if ( imageDimension != 3 && imageDimension != 2 ) - { - srtkExceptionMacro(<< "The length of size is invalid! " - << "Only image of dimension 2 or 3 are supported." ); - } - - if ( !this->m_MemberFactory->HasMemberFunction( this->m_PixelIDValue, imageDimension ) ) - { - srtkExceptionMacro( << "PixelType is not supported!" << std::endl - << "Pixel Type: " - << GetPixelIDValueAsString( this->m_PixelIDValue ) << std::endl - << "Refusing to load! " << std::endl ); - } - - return this->m_MemberFactory->GetMemberFunction( this->m_PixelIDValue, imageDimension )(); -} - - -template -Image ImportImageFilter::ExecuteInternal( ) -{ - - typedef TImageType ImageType; - const unsigned int Dimension = ImageType::ImageDimension; - - // if the InstantiatedToken is correctly implemented this should - // not occur - assert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown ); - - typename ImageType::Pointer image = ImageType::New(); - - - - - // - // Origin - // - typename ImageType::PointType origin = srtkSTLVectorToITK< typename ImageType::PointType >( this->m_Origin ); - image->SetOrigin( origin ); - - // - // Spacing - // - typename ImageType::SpacingType spacing = srtkSTLVectorToITK< typename ImageType::SpacingType >( this->m_Spacing ); - image->SetSpacing( spacing ); - - // - // Size and Region - // - typename ImageType::RegionType region; - typename ImageType::SizeType size = srtkSTLVectorToITK< typename ImageType::SizeType >( this->m_Size ); - region.SetSize(size); - // set the size and region to the ITK image. - image->SetRegions( region ); - - // - // Direction, if m_Direction is not set, use ITK's default which is - // an identity. - // - if (this->m_Direction.size() != 0 ) - { - image->SetDirection( srtkSTLToITKDirection( this->m_Direction ) ); - } - - - size_t numberOfElements = m_NumberOfComponentsPerPixel; - for(unsigned int si = 0; si < Dimension; si++ ) - { - numberOfElements *= size[si]; - } - - const bool TheContainerWillTakeCareOfDeletingTheMemoryBuffer = false; - - // Set the image's pixel container to import the pointer provided. - image->GetPixelContainer()->SetImportPointer(static_cast(m_Buffer), numberOfElements, - TheContainerWillTakeCareOfDeletingTheMemoryBuffer); - - - // - // Meta-programmed method to set the number of components if a - // vector image - // - this->SetNumberOfComponentsOnImage( image.GetPointer() ); - - // This line must be the last line in the function to prevent a deep - // copy caused by a implicit srtk::MakeUnique - return Image( image ); -} - -template -typename EnableIf::Value>::Type -ImportImageFilter::SetNumberOfComponentsOnImage ( TFilterType*image ) -{ - image->SetNumberOfComponentsPerPixel( m_NumberOfComponentsPerPixel ); -} - -} -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkProjectionsReader.cxx b/utilities/SimpleRTK/Code/IO/src/srtkProjectionsReader.cxx deleted file mode 100644 index 69d889ba3..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkProjectionsReader.cxx +++ /dev/null @@ -1,130 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifdef _MFC_VER -#pragma warning(disable:4996) -#endif - -#include "srtkProjectionsReader.h" - -#include -#ifdef RTK_USE_CUDA -# include -#endif -#include -#include - -namespace rtk { - namespace simple { - - Image ReadProjections ( const std::vector &filenames ) - { - ProjectionsReader reader; - return reader.SetFileNames ( filenames ).Execute(); - } - - - ProjectionsReader::ProjectionsReader() - { - - // list of pixel types supported - typedef RealPixelIDTypeList PixelIDTypeList; - - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > (); - } - - std::string ProjectionsReader::ToString() const { - - std::ostringstream out; - out << "rtk::simple::ProjectionsReader"; - out << std::endl; - - out << " FileNames: " << std::endl; - std::vector::const_iterator iter = m_FileNames.begin(); - while( iter != m_FileNames.end() ) - { - std::cout << " \"" << *iter << "\"" << std::endl; - ++iter; - } - - return out.str(); - } - - ProjectionsReader& ProjectionsReader::SetFileNames ( const std::vector &filenames ) - { - this->m_FileNames = filenames; - return *this; - } - - const std::vector &ProjectionsReader::GetFileNames() const - { - return this->m_FileNames; - } - - Image ProjectionsReader::Execute () - { - // todo check if filename does not exits for robust error handling - assert( !this->m_FileNames.empty() ); - - PixelIDValueType type = rtk::simple::srtkFloat32; - unsigned int dimension = 3; - - return this->m_MemberFactory->GetMemberFunction( type, dimension )(); - } - - template Image - ProjectionsReader::ExecuteInternal( void ) - { - - typedef TImageType ImageType; - typedef rtk::ProjectionsReader Reader; - - // if the IsInstantiated is correctly implemented this should - // not occour - assert( ImageTypeToPixelIDValue::Result != (int)srtkUnknown ); - typename Reader::Pointer reader = Reader::New(); - reader->SetFileNames( this->m_FileNames ); - - this->PreUpdate( reader.GetPointer() ); - - reader->Update(); - - // We must change the output to ensure that there is a 0 index - typename ImageType::RegionType lpr = reader->GetOutput()->GetLargestPossibleRegion(); - typename ImageType::RegionType::IndexType idx = lpr.GetIndex(); - typename ImageType::PointType newOrig; - reader->GetOutput()->TransformIndexToPhysicalPoint(idx, newOrig); - typename ImageType::RegionType::OffsetType offset; - for(unsigned int i=0; i ChangeInformationType; - typename ChangeInformationType::Pointer changeInfo = ChangeInformationType::New(); - changeInfo->SetInput( reader->GetOutput() ); - changeInfo->ChangeOriginOn(); - changeInfo->SetOutputOrigin(newOrig); - changeInfo->ChangeRegionOn(); - changeInfo->SetOutputOffset(offset); - changeInfo->Update(); - - return Image( changeInfo->GetOutput() ); - } - } -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkShow.cxx b/utilities/SimpleRTK/Code/IO/src/srtkShow.cxx deleted file mode 100644 index 05ee44d0c..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkShow.cxx +++ /dev/null @@ -1,588 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkShow.h" -#include "srtkMacro.h" -#include "srtkImageFileWriter.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#else -#include -#endif - -namespace rtk -{ - namespace simple - { - - static int ShowImageCount = 0; - - // time to wait in milli-seconds before we check if the process is OK - const unsigned int ProcessDelay = 500; - - -#if defined(_WIN32) - static std::string ShowImageCommand = "%a -o %f -eval \"rename(\'%t\'); \""; - static std::string ShowColorImageCommand = "%a -eval " - "\"open(\'%f\'); run(\'Make Composite\', \'display=Composite\'); rename(\'%t\'); \""; - -#elif defined(__APPLE__) - // The "-n" flag tells OSX to launch a new instance of ImageJ, even if one is already running. - // We do this because otherwise the macro command line argument is not correctly passed to - // a previously running instance of ImageJ. - static std::string ShowImageCommand = "open -a %a -n --args -eval " - "\'open(\"%f\"); rename(\"%t\"); \'"; - static std::string ShowColorImageCommand = "open -a %a -n --args -eval " - "\'open(\"%f\"); run(\"Make Composite\", \"display=Composite\"); rename(\"%t\"); \'"; - -#else - // linux and other systems - static std::string ShowImageCommand = "%a -e \'open(\"%f\"); rename(\"%t\"); \'"; - static std::string ShowColorImageCommand = "%a -e " - "\'open(\"%f\"); run(\"Make Composite\", \"display=Composite\"); rename(\"%t\"); \'"; -#endif - - - // Function to replace %tokens in a string. The tokens are %a and %f for - // application and file name respectively. %% will send % to the output string. - // Multiple occurances of a token are allowed. - // - static std::string ReplaceWords(std::string command, std::string app, std::string filename, std::string title, bool& fileFlag) - { - std::string result; - - unsigned int i=0; - while (i ConvertCommand(std::string command, std::string app, std::string filename, std::string title="") - { - - if (title == "") - { - title = filename; - } - - bool fileFlag=false; - std::string new_command = ReplaceWords(command, app, filename, title, fileFlag); - std::istringstream iss(new_command); - std::vector result; - std::vector quoteStack; - std::string word; - unsigned int i=0; - - //std::cout << new_command << std::endl; - - while (i paths; - std::string ExecutableName=name; - -#ifdef _WIN32 - - std::string ProgramFiles; - if ( itksys::SystemTools::GetEnv ( "PROGRAMFILES", ProgramFiles ) ) - { - paths.push_back ( ProgramFiles + "\\ImageJ\\" ); - } - - if ( itksys::SystemTools::GetEnv ( "PROGRAMFILES(x86)", ProgramFiles ) ) - { - paths.push_back ( ProgramFiles + "\\ImageJ\\" ); - } - - if ( itksys::SystemTools::GetEnv ( "PROGRAMW6432", ProgramFiles ) ) - { - paths.push_back ( ProgramFiles + "\\ImageJ\\" ); - } - - - // Find the executable - ExecutableName = itksys::SystemTools::FindFile ( ExecutableName.c_str(), paths ); - -#elif defined(__APPLE__) - - // Common places on the Mac to look - paths.push_back("/Applications"); - paths.push_back("/Applications/ImageJ"); - paths.push_back("/Developer"); - paths.push_back("/opt/ImageJ"); - paths.push_back("/usr/local/ImageJ"); - - ExecutableName = itksys::SystemTools::FindDirectory( name.c_str(), paths ); - -#else - - // linux and other systems - ExecutableName = itksys::SystemTools::FindFile ( name.c_str() ); - -#endif - - return ExecutableName; - } - - - /** - * This function take a list of command line arguments, and runs a - * process based on it. It waits for a fraction of a second before - * checking it's state, to verify it was launched OK. - */ - static void ExecuteShow( const std::vector & cmdLine ) - { - -#ifndef NDEBUG - std::copy( cmdLine.begin(), cmdLine.end(), std::ostream_iterator( std::cout, "\n" ) ); - std::cout << std::endl; -#endif - - std::vector cmd( cmdLine.size() + 1, NULL ); - - for ( unsigned int i = 0; i < cmdLine.size(); ++i ) - { - cmd[i] = cmdLine[i].c_str(); - } - - itksysProcess *kp = itksysProcess_New(); - - itksysProcess_SetCommand( kp, &cmd[0] ); - - itksysProcess_SetOption( kp, itksysProcess_Option_Detach, 1 ); - - // For detached processes, this appears not to be the default - itksysProcess_SetPipeShared( kp, itksysProcess_Pipe_STDERR, 1); - itksysProcess_SetPipeShared( kp, itksysProcess_Pipe_STDOUT, 1); - - itksysProcess_Execute( kp ); - - // Wait one second then check to see if we launched ok. - // N.B. Because the launched process may spawn a child process for - // the acutal application we want, this methods is needed to be - // called before the GetState, so that we get more then the - // imediate result of the initial execution. - double timeout = ProcessDelay; - itksysProcess_WaitForExit( kp, &timeout ); - - - switch (itksysProcess_GetState(kp)) - { - case itksysProcess_State_Executing: - // This first case is what we expect if everything went OK. - - // We want the other process to continue going - itksysProcess_Delete( kp ); // implicitly disowns - break; - - case itksysProcess_State_Exited: - { - int exitValue = itksysProcess_GetExitValue(kp); - if ( exitValue != 0 ) - { - srtkExceptionMacro ( << "Process returned " << exitValue << "." ); - } - } - break; - - case itksysProcess_State_Killed: - itksysProcess_Delete( kp ); - srtkExceptionMacro ( << "Child was killed by parent." ); - break; - - case itksysProcess_State_Exception: - { - std::string exceptionString = itksysProcess_GetExceptionString(kp); - itksysProcess_Delete( kp ); - srtkExceptionMacro ( << "Child terminated abnormally: " << exceptionString );; - } - break; - - case itksysProcess_State_Error: - { - std::string errorString = itksysProcess_GetErrorString(kp); - itksysProcess_Delete( kp ); - srtkExceptionMacro ( << "Error in administrating child process: [" << errorString << "]" ); - } - break; - - // these states should not occour, because they are the result - // from actions we don't take - case itksysProcess_State_Expired: - case itksysProcess_State_Disowned: - case itksysProcess_State_Starting: - default: - itksysProcess_Delete( kp ); - srtkExceptionMacro ( << "Unexpected process state!" ); - }; - - } - - void Show( const Image &image, const std::string title) - { - // Try to find ImageJ, write out a file and open - std::string ExecutableName; - std::string Command, Command3D; - std::string TempFile = ""; - std::string Macro = ""; - std::vector CommandLine; - - - TempFile = BuildFullFileName(title); - //std::cout << "Full file name:\t" << TempFile << std::endl; - - // write out the image - WriteImage ( image, TempFile ); - - - bool colorFlag = false; - - - // If the image is 3 channel, 8 or 16 bit, assume it's a color image. - // - colorFlag = ( (image.GetNumberOfComponentsPerPixel() == 3) - && ((image.GetPixelIDValue()==srtkVectorUInt8) || (image.GetPixelIDValue()==srtkVectorUInt16)) ); - - - - // check for user-defined environment variables - // - if (colorFlag) - { - itksys::SystemTools::GetEnv ( "SRTK_SHOW_COLOR_COMMAND", Command ); - if (!Command.length()) - { - itksys::SystemTools::GetEnv ( "SRTK_SHOW_COMMAND", Command ); - } - if (!Command.length()) - { - Command = ShowColorImageCommand; - } - } - else - { - itksys::SystemTools::GetEnv ( "SRTK_SHOW_COMMAND", Command ); - if (!Command.length()) - { - Command = ShowImageCommand; - } - } - itksys::SystemTools::GetEnv ( "SRTK_SHOW_3D_COMMAND", Command3D ); - if (!Command3D.length()) - { - Command3D = Command; - } - - if (image.GetDimension() == 3) - { - Command = Command3D; - } - - - // Find the ImageJ executable - // - -#if defined(_WIN32) - - // Windows - ExecutableName = FindApplication("ImageJ.exe"); - -#elif defined(__APPLE__) - -# if defined(__x86_64__) - - // Mac 64-bit - ExecutableName = FindApplication( "ImageJ64.app" ); - if (!ExecutableName.length()) - { - ExecutableName = "ImageJ64.app"; - } - -# else - - // Mac 32-bit - ExecutableName = FindApplication( "ImageJ.app" ); - if (!ExecutableName.length()) - { - ExecutableName = "ImageJ.app"; - } -# endif // __x86_64__ - -#else - - // Linux and other systems - ExecutableName = FindApplication("ImageJ"); - if (!ExecutableName.length()) - { - ExecutableName = FindApplication("imagej"); - } -#endif - - - // Replace the string tokens and split the command string into seperate words. - CommandLine = ConvertCommand(Command, ExecutableName, TempFile, title); - - // run the compiled command-line in a process which will detach - ExecuteShow( CommandLine ); - } - - } // namespace simple -} diff --git a/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx b/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx deleted file mode 100644 index 33c82ed83..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileReader.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkThreeDCircularProjectionGeometryXMLFileReader.h" -#include - -namespace rtk { -namespace simple { - -ThreeDCircularProjectionGeometry ReadXML ( const std::string &inFileName ) - { - ThreeDCircularProjectionGeometryXMLFileReader reader; - return reader.Execute ( inFileName ); - } - - -ThreeDCircularProjectionGeometryXMLFileReader::ThreeDCircularProjectionGeometryXMLFileReader() - { - // This is probably not needed - //this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - } - -std::string ThreeDCircularProjectionGeometryXMLFileReader::ToString() const - { - std::ostringstream out; - out << "rtk::simple::ThreeDCircularProjectionGeometryXMLFileReader"; - out << std::endl; - - out << " FileName: \""; - this->ToStringHelper(out, this->m_FileName); - out << "\"" << std::endl; - - return out.str(); - } - -ThreeDCircularProjectionGeometryXMLFileReader& ThreeDCircularProjectionGeometryXMLFileReader::SetFileName ( std::string fn ) - { - this->m_FileName = fn; - return *this; - } - -std::string ThreeDCircularProjectionGeometryXMLFileReader::GetFileName() const - { - return this->m_FileName; - } - -ThreeDCircularProjectionGeometry ThreeDCircularProjectionGeometryXMLFileReader -::Execute ( const std::string &inFileName ) - { - this->SetFileName( inFileName ); - return this->Execute(); - } - -ThreeDCircularProjectionGeometry ThreeDCircularProjectionGeometryXMLFileReader -::Execute () - { - typedef rtk::ThreeDCircularProjectionGeometryXMLFileReader Reader; - Reader::Pointer reader = Reader::New(); - reader->SetFilename ( this->m_FileName.c_str() ); - reader->GenerateOutputInformation(); - m_Geometry.Clear(); - for(unsigned int i=0; iGetOutputObject()->GetGantryAngles().size(); i++) - m_Geometry.AddProjectionInRadians( - reader->GetOutputObject()->GetSourceToIsocenterDistances()[i], - reader->GetOutputObject()->GetSourceToDetectorDistances()[i], - reader->GetOutputObject()->GetGantryAngles()[i], - reader->GetOutputObject()->GetProjectionOffsetsX()[i], - reader->GetOutputObject()->GetProjectionOffsetsY()[i], - reader->GetOutputObject()->GetOutOfPlaneAngles()[i], - reader->GetOutputObject()->GetInPlaneAngles()[i], - reader->GetOutputObject()->GetSourceOffsetsX()[i], - reader->GetOutputObject()->GetSourceOffsetsY()[i]); - return m_Geometry; - } - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx b/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx deleted file mode 100644 index 879f7c931..000000000 --- a/utilities/SimpleRTK/Code/IO/src/srtkThreeDCircularProjectionGeometryXMLFileWriter.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/*========================================================================= - * - * Copyright RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "srtkThreeDCircularProjectionGeometryXMLFileWriter.h" -#include - -namespace rtk { -namespace simple { - -void WriteXML ( const ThreeDCircularProjectionGeometry& geometry, const std::string &inFileName ) - { - ThreeDCircularProjectionGeometryXMLFileWriter writer; - writer.Execute ( geometry, inFileName ); - } - - -ThreeDCircularProjectionGeometryXMLFileWriter::ThreeDCircularProjectionGeometryXMLFileWriter() - { - // This is probably not needed - //this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - } - -std::string ThreeDCircularProjectionGeometryXMLFileWriter::ToString() const - { - std::ostringstream out; - out << "rtk::simple::ThreeDCircularProjectionGeometryXMLFileWriter"; - out << std::endl; - - out << " FileName: \""; - this->ToStringHelper(out, this->m_FileName); - out << "\"" << std::endl; - - return out.str(); - } - -ThreeDCircularProjectionGeometryXMLFileWriter& ThreeDCircularProjectionGeometryXMLFileWriter::SetFileName ( std::string fn ) - { - this->m_FileName = fn; - return *this; - } - -std::string ThreeDCircularProjectionGeometryXMLFileWriter::GetFileName() const - { - return this->m_FileName; - } - -ThreeDCircularProjectionGeometryXMLFileWriter& ThreeDCircularProjectionGeometryXMLFileWriter -::Execute ( const ThreeDCircularProjectionGeometry& geometry, const std::string &inFileName ) - { - this->SetFileName( inFileName ); - return this->Execute( geometry ); - } - -ThreeDCircularProjectionGeometryXMLFileWriter& ThreeDCircularProjectionGeometryXMLFileWriter -::Execute ( const ThreeDCircularProjectionGeometry& geometry ) - { - typedef rtk::ThreeDCircularProjectionGeometryXMLFileWriter Writer; - Writer::Pointer writer = Writer::New(); - writer->SetFilename ( this->m_FileName.c_str() ); - - writer->SetObject ( const_cast(dynamic_cast (geometry.GetRTKBase())) ); - writer->WriteFile(); - - return *this; - } - -} // end namespace simple -} // end namespace rtk diff --git a/utilities/SimpleRTK/Examples/CMakeLists.txt b/utilities/SimpleRTK/Examples/CMakeLists.txt deleted file mode 100644 index f5a407226..000000000 --- a/utilities/SimpleRTK/Examples/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(SimpleRTKExamples) - -# Add individual cxx executables -add_executable ( RTKFirstReconstruction RTKFirstReconstruction.cxx ) -target_link_libraries ( RTKFirstReconstruction ${SimpleRTK_LIBRARIES} ) - diff --git a/utilities/SimpleRTK/Examples/RTKFirstCudaReconstruction.py b/utilities/SimpleRTK/Examples/RTKFirstCudaReconstruction.py deleted file mode 100644 index 0876de3dc..000000000 --- a/utilities/SimpleRTK/Examples/RTKFirstCudaReconstruction.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function -import SimpleRTK as srtk -import sys -import os -import matplotlib.pyplot as plt -import matplotlib.cm as cm -import time - -if len ( sys.argv ) < 3: - print( "Usage: RTKFirstReconstruction " ) - sys.exit ( 1 ) - -# Defines the RTK geometry object -geometry = srtk.ThreeDCircularProjectionGeometry() -numberOfProjections = 360 -firstAngle = 0 -angularArc = 360 -sid = 600 # source to isocenter distance in mm -sdd = 1200 # source to detector distance in mm -isox = 0 # X coordinate on the projection image of isocenter -isoy = 0 # Y coordinate on the projection image of isocenter -for x in range(0,numberOfProjections): - angle = firstAngle + x * angularArc / numberOfProjections - geometry.AddProjection(sid,sdd,angle,isox,isoy) - -# Writing the geometry -geometrywriter = srtk.ThreeDCircularProjectionGeometryXMLFileWriter() -geometrywriter.SetFileName ( sys.argv[2] ) -geometrywriter.Execute ( geometry ); - -constantImageSource = srtk.ConstantImageSource() -origin = [ -127.5, -127.5, 0. ] -sizeOutput = [ 256, 256, numberOfProjections ] -spacing = [ 1.0, 1.0, 1.0 ] -constantImageSource.SetOrigin( origin ) -constantImageSource.SetSpacing( spacing ) -constantImageSource.SetSize( sizeOutput ) -constantImageSource.SetConstant(0.0) -source = constantImageSource.Execute() - -rei = srtk.RayEllipsoidIntersectionImageFilter() -semiprincipalaxis = [ 50, 50, 50] -center = [ 0, 0, 0] -# Set GrayScale value, axes, center... -rei.SetDensity(20) -rei.SetAngle(0) -rei.SetCenter(center) -rei.SetAxis(semiprincipalaxis) -rei.SetGeometry( geometry ) -reiImage = rei.Execute(source) - -# Create reconstructed image -constantImageSource2 = srtk.ConstantImageSource() -origin = [ -63.5, -63.5, -63.5 ] -sizeOutput = [ 128, 128, 128 ] -constantImageSource2.SetOrigin( origin ) -constantImageSource2.SetSpacing( spacing ) -constantImageSource2.SetSize( sizeOutput ) -constantImageSource2.SetConstant(0.0) -source2 = constantImageSource2.Execute() - -print("Performing reconstruction") -feldkamp = srtk.CudaFDKConeBeamReconstructionFilter() -feldkamp.SetGeometry( geometry ); -feldkamp.SetTruncationCorrection(0.0); -feldkamp.SetHannCutFrequency(0.0); - -start = time.time() -image = feldkamp.Execute(source2,reiImage) -end = time.time() -print("Reconstruction took %f" %(end-start)) - -plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r) -plt.show() - -pixelID = image.GetPixelIDValue() -caster = srtk.CastImageFilter() -caster.SetOutputPixelType( pixelID ) -image = caster.Execute( image ) - -writer = srtk.ImageFileWriter() -writer.SetFileName ( sys.argv[1] ) -writer.Execute ( image ); - diff --git a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cs b/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cs deleted file mode 100644 index de44b1513..000000000 --- a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cs +++ /dev/null @@ -1,111 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -using System; -using rtk.simple; - -namespace rtk.simple.examples { - class RTKFirstReconstruction { - static void Main(string[] args) { - try { - if (args.Length < 1) { - Console.WriteLine("Usage: RTKFirstReconstruction "); - return; - } - - // Defines the RTK geometry object - ThreeDCircularProjectionGeometry geometry = new ThreeDCircularProjectionGeometry(); - uint numberOfProjections = 360; - float firstAngle = 0; - float angularArc = 360; - float sid = 600; // source to isocenter distance in mm - float sdd = 1200; // source to detector distance in mm - float isox = 0; // X coordinate on the projection image of isocenter - float isoy = 0; // Y coordinate on the projection image of isocenter - for (int x = 0; x < numberOfProjections; x++) - { - float angle = firstAngle + x * angularArc / numberOfProjections; - geometry.AddProjection(sid, sdd, angle, isox, isoy); - } - ConstantImageSource constantImageSource = new ConstantImageSource(); - VectorDouble origin = new VectorDouble(3); - origin.Add(-127.0); - origin.Add(-127.0); - origin.Add(-127.0); - VectorUInt32 sizeOutput = new VectorUInt32(3); - sizeOutput.Add(256); - sizeOutput.Add(256); - sizeOutput.Add(numberOfProjections); - VectorDouble spacing = new VectorDouble(3); - spacing.Add(1.0); - spacing.Add(1.0); - spacing.Add(1.0); - - constantImageSource.SetOrigin(origin); - constantImageSource.SetSpacing(spacing); - constantImageSource.SetSize(sizeOutput); - constantImageSource.SetConstant(0.0); - Image source = constantImageSource.Execute(); - - RayEllipsoidIntersectionImageFilter rei = new RayEllipsoidIntersectionImageFilter(); - VectorDouble semiprincipalaxis = new VectorDouble(3); - semiprincipalaxis.Add(50.0); - semiprincipalaxis.Add(50.0); - semiprincipalaxis.Add(50.0); - - VectorDouble center = new VectorDouble(3); - center.Add(0.0); - center.Add(0.0); - center.Add(0.0); - // Set GrayScale value, axes, center... - rei.SetDensity(20); - rei.SetAngle(0); - rei.SetCenter(center); - rei.SetAxis(semiprincipalaxis); - rei.SetGeometry(geometry); - Image reiImage = rei.Execute(source); - - - // Create reconstructed image - ConstantImageSource constantImageSource2 = new ConstantImageSource(); - VectorUInt32 sizeOutput2 = new VectorUInt32(3); - sizeOutput2.Add(256); - sizeOutput2.Add(256); - sizeOutput2.Add(256); - constantImageSource2.SetOrigin(origin); - constantImageSource2.SetSpacing(spacing); - constantImageSource2.SetSize(sizeOutput2); - constantImageSource2.SetConstant(0.0); - Image source2 = constantImageSource2.Execute(); - - Console.WriteLine("Performing reconstruction"); - FDKConeBeamReconstructionFilter feldkamp = new FDKConeBeamReconstructionFilter(); - feldkamp.SetGeometry(geometry); - feldkamp.SetTruncationCorrection(0.0); - feldkamp.SetHannCutFrequency(0.0); - Image image = feldkamp.Execute(source2, reiImage); - - ImageFileWriter writer = new ImageFileWriter(); - writer.SetFileName(args[0]); - writer.Execute(image); - - } catch (Exception ex) { - Console.WriteLine(ex); - } - } - } -} diff --git a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cxx b/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cxx deleted file mode 100644 index 6715ca08a..000000000 --- a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/*========================================================================= -* -* Copyright RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ - -// This one header will include all SimpleRTK filters and external -// objects. -#include -#include -#include - -// create convenient namespace alias -namespace srtk = rtk::simple; - -int main ( int argc, char* argv[] ) { - - if ( argc < 2 ) { - std::cerr << "Usage: " << argv[0] << " \n"; - return 1; - } - - // Defines the RTK geometry object - srtk::ThreeDCircularProjectionGeometry geometry; - unsigned int numberOfProjections = 360; - float firstAngle = 0; - float angularArc = 360; - float sid = 600; // source to isocenter distance in mm - float sdd = 1200; // source to detector distance in mm - float isox = 0; // X coordinate on the projection image of isocenter - float isoy = 0; // Y coordinate on the projection image of isocenter - for (unsigned int x = 0; x < numberOfProjections; x++) - { - float angle = firstAngle + x * angularArc / numberOfProjections; - geometry.AddProjection(sid, sdd, angle, isox, isoy); - } - srtk::ConstantImageSource constantImageSource; - std::vector origin(3,-127.0); - std::vector sizeOutput(3); - sizeOutput[0]=256; - sizeOutput[1]=256; - sizeOutput[2]=numberOfProjections; - std::vector spacing(3,1.0); - constantImageSource.SetOrigin(origin); - constantImageSource.SetSpacing(spacing); - constantImageSource.SetSize(sizeOutput); - constantImageSource.SetConstant(0.0); - srtk::Image source = constantImageSource.Execute(); - - srtk::RayEllipsoidIntersectionImageFilter rei; - std::vector semiprincipalaxis(3,50.0); - std::vector center(3,0.0); - // Set GrayScale value, axes, center... - rei.SetDensity(20); - rei.SetAngle(0); - rei.SetCenter(center); - rei.SetAxis(semiprincipalaxis); - rei.SetGeometry( &geometry ); - srtk::Image reiImage = rei.Execute(source); - - // Create reconstructed image - srtk::ConstantImageSource constantImageSource2; - std::vector sizeOutput2(3,256); - constantImageSource2.SetOrigin( origin ); - constantImageSource2.SetSpacing( spacing ); - constantImageSource2.SetSize( sizeOutput2 ); - constantImageSource2.SetConstant(0.0); - srtk::Image source2 = constantImageSource2.Execute(); - - std::cout << "Performing reconstruction" << std::endl; - srtk::FDKConeBeamReconstructionFilter feldkamp; - feldkamp.SetGeometry( &geometry ); - feldkamp.SetTruncationCorrection(0.0); - feldkamp.SetHannCutFrequency(0.0); - srtk::Image image = feldkamp.Execute(source2,reiImage); - - srtk::ImageFileWriter writer; - writer.SetFileName(argv[1]); - writer.Execute(image); - return 0; -} diff --git a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.py b/utilities/SimpleRTK/Examples/RTKFirstReconstruction.py deleted file mode 100644 index d38d97d55..000000000 --- a/utilities/SimpleRTK/Examples/RTKFirstReconstruction.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function -import SimpleRTK as srtk -import sys -import os -import matplotlib.pyplot as plt -import matplotlib.cm as cm -import time - -if len ( sys.argv ) < 3: - print( "Usage: RTKFirstReconstruction " ) - sys.exit ( 1 ) - -# Defines the RTK geometry object -geometry = srtk.ThreeDCircularProjectionGeometry() -numberOfProjections = 360 -firstAngle = 0 -angularArc = 360 -sid = 600 # source to isocenter distance in mm -sdd = 1200 # source to detector distance in mm -isox = 0 # X coordinate on the projection image of isocenter -isoy = 0 # Y coordinate on the projection image of isocenter -for x in range(0,numberOfProjections): - angle = firstAngle + x * angularArc / numberOfProjections - geometry.AddProjection(sid,sdd,angle,isox,isoy) - -# Writing the geometry -geometrywriter = srtk.ThreeDCircularProjectionGeometryXMLFileWriter() -geometrywriter.SetFileName ( sys.argv[2] ) -geometrywriter.Execute ( geometry ); - -constantImageSource = srtk.ConstantImageSource() -origin = [ -127.5, -127.5, 0. ] -sizeOutput = [ 256, 256, numberOfProjections ] -spacing = [ 1.0, 1.0, 1.0 ] -constantImageSource.SetOrigin( origin ) -constantImageSource.SetSpacing( spacing ) -constantImageSource.SetSize( sizeOutput ) -constantImageSource.SetConstant(0.0) -source = constantImageSource.Execute() - -rei = srtk.RayEllipsoidIntersectionImageFilter() -semiprincipalaxis = [ 50, 50, 50] -center = [ 0, 0, 0] -# Set GrayScale value, axes, center... -rei.SetDensity(20) -rei.SetAngle(0) -rei.SetCenter(center) -rei.SetAxis(semiprincipalaxis) -rei.SetGeometry( geometry ) -reiImage = rei.Execute(source) - -# Create reconstructed image -constantImageSource2 = srtk.ConstantImageSource() -origin = [ -63.5, -63.5, -63.5 ] -sizeOutput = [ 128, 128, 128 ] -constantImageSource2.SetOrigin( origin ) -constantImageSource2.SetSpacing( spacing ) -constantImageSource2.SetSize( sizeOutput ) -constantImageSource2.SetConstant(0.0) -source2 = constantImageSource2.Execute() - -print("Performing reconstruction") -feldkamp = srtk.FDKConeBeamReconstructionFilter() -feldkamp.SetGeometry( geometry ); -feldkamp.SetTruncationCorrection(0.0); -feldkamp.SetHannCutFrequency(0.0); - -start = time.time() -image = feldkamp.Execute(source2,reiImage) -end = time.time() -print("Reconstruction took %f" %(end-start)) - -plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r) -plt.show() - -pixelID = image.GetPixelIDValue() -caster = srtk.CastImageFilter() -caster.SetOutputPixelType( pixelID ) -image = caster.Execute( image ) - -writer = srtk.ImageFileWriter() -writer.SetFileName ( sys.argv[1] ) -writer.Execute ( image ); - diff --git a/utilities/SimpleRTK/SimpleRTKConfig.cmake.in b/utilities/SimpleRTK/SimpleRTKConfig.cmake.in deleted file mode 100644 index dad177294..000000000 --- a/utilities/SimpleRTK/SimpleRTKConfig.cmake.in +++ /dev/null @@ -1,54 +0,0 @@ -#----------------------------------------------------------------------------- -# -# SimpleRTKConfig.cmake - SimpleRTK CMake configuration file for external -# projects. -# -# This file is configured by SimpleRTK, imported into client projects by -# find_package(SimpleRTK), and provides values for UseSimpleRTK.cmake. - -# This SimpleRTKConfig file is configured for the @SimpleRTKConfig_TREE@ tree - -# Compute this installation's prefix from this file's location: -get_filename_component(_SimpleRTKConfig_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -@SimpleRTKConfig_CODE@ -# The C and C++ flags added by SimpleRTK to the cmake-configured flags. -set(SimpleRTK_REQUIRED_C_FLAGS "@SimpleRTK_REQUIRED_C_FLAGS@") -set(SimpleRTK_REQUIRED_CXX_FLAGS "@SimpleRTK_REQUIRED_CXX_FLAGS@") -set(SimpleRTK_REQUIRED_LINK_FLAGS "@SimpleRTK_REQUIRED_LINK_FLAGS@") - -# The SimpleRTK include file directories. -set(SimpleRTK_INCLUDE_DIRS "@SimpleRTKConfig_INCLUDE_DIRS@") - -# The SimpleRTK library directories. -set(ITK_LIBRARY_DIRS "@ITK_LIBRARY_DIRS@") -set(SimpleRTK_LIBRARY_DIRS "${ITK_LIBRARY_DIRS}") - -# The location of the UseITK.cmake file. -set(SimpleRTK_USE_FILE "${_SimpleRTKConfig_DIR}/UseSimpleRTK.cmake") - -# Find the ITKTargets.cmake file (fallback code that needs to stay here only -# temporarily - eventually ITK will export this value and this chunk can -# disappear...) -set(ITK_CONFIG_TARGETS_FILE "@ITK_CONFIG_TARGETS_FILE@") -if(NOT ITK_CONFIG_TARGETS_FILE) - if(EXISTS "@ITK_DIR@/ITKTargets.cmake") - set(ITK_CONFIG_TARGETS_FILE "@ITK_DIR@/ITKTargets.cmake") - endif() -endif() - -# Import ITK targets. -if(NOT ITK_TARGETS_IMPORTED) - set(ITK_TARGETS_IMPORTED 1) - include("${ITK_CONFIG_TARGETS_FILE}") -endif() - -# Import SimpleRTK targets. -set(SimpleRTK_TARGETS_FILE "${_SimpleRTKConfig_DIR}/SimpleRTKTargets.cmake") -if(NOT SimpleRTK_TARGETS_IMPORTED) - set(SimpleRTK_TARGETS_IMPORTED 1) - include("${SimpleRTK_TARGETS_FILE}") -endif() - -# A list of all libraries for SimpleRTK. Those listed here should -# automatically pull in their dependencies via imported targets. -set(SimpleRTK_LIBRARIES "@SimpleRTK_LIBRARIES@") diff --git a/utilities/SimpleRTK/SimpleRTKConfigVersion.cmake.in b/utilities/SimpleRTK/SimpleRTKConfigVersion.cmake.in deleted file mode 100644 index f56679749..000000000 --- a/utilities/SimpleRTK/SimpleRTKConfigVersion.cmake.in +++ /dev/null @@ -1,6 +0,0 @@ -if(NOT "${PACKAGE_FIND_VERSION}" VERSION_GREATER "@SimpleRTK_VERSION@") - set(PACKAGE_VERSION_COMPATIBLE 1) # compatible with older - if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") - set(PACKAGE_VERSION_EXACT 1) # exact match for this version - endif() -endif() diff --git a/utilities/SimpleRTK/SimpleRTKWithSwig.cmake b/utilities/SimpleRTK/SimpleRTKWithSwig.cmake deleted file mode 100644 index 79d24ff8a..000000000 --- a/utilities/SimpleRTK/SimpleRTKWithSwig.cmake +++ /dev/null @@ -1,181 +0,0 @@ -cmake_minimum_required ( VERSION 2.8.11 ) - -#includes the language options -set(CMAKE_MODULE_PATH - ${CMAKE_CURRENT_LIST_DIR}/CMake - ${CMAKE_BINARY_DIR}/CMake - ${CMAKE_CURRENT_LIST_DIR}/Wrapping - ${CMAKE_CURRENT_LIST_DIR}/SuperBuild - ${CMAKE_MODULE_PATH} - ) - -include(srtkPreventInSourceBuilds) -include(srtkPreventInBuildInstalls) -include(VariableList) -include(srtkExternalData) -include(ExternalProject) - -add_custom_target( SuperBuildSimpleRTKSource ) - -# -# srtkSourceDownload( ) -# -# A function to get a filename for an ExternalData source file used in -# a superbuild. Adds a target which downloads all source code -# needed for superbuild projects. The source file is cached with in -# the build tree, and can be locally cache with other ExternalData -# controlled environment variables. -# -# The "SuperBuildSimpleRTKSource" target needs to be manually added as -# a dependencies to the ExternalProject. -# -# add_dependencies( PROJ "SuperBuildSimpleRTKSource" ) -# -# Note: Hash files are created under the SOURCE directory in the -# .ExternalSource sub-directory during configuration. -# -function(srtkSourceDownload outVar filename hash) - set(link_file "${CMAKE_CURRENT_SOURCE_DIR}/.ExternalSource/${filename}") - file(WRITE "${link_file}.md5" ${hash} ) - ExternalData_Expand_arguments( - SuperBuildSimpleRTKSourceReal - link - DATA{${link_file}} - ) - set(${outVar} "${link}" PARENT_SCOPE) -endfunction() - -function(srtkSourceDownloadDependency proj) - if (CMAKE_VERSION VERSION_LESS 3.2) - add_dependencies(${proj} "SuperBuildSimpleRTKSource") - else() - ExternalProject_Add_StepDependencies(${proj} download "SuperBuildSimpleRTKSource") - endif() -endfunction() - -include(srtkLanguageOptions) - -#------------------------------------------------------------------------------ -# Lua -#------------------------------------------------------------------------------ -option ( USE_SYSTEM_LUA "Use a pre-compiled version of LUA 5.1 previously configured for your system" OFF ) -mark_as_advanced(USE_SYSTEM_LUA) -if ( USE_SYSTEM_LUA ) - find_package( LuaInterp REQUIRED 5.1 ) - set( SRTK_LUA_EXECUTABLE ${LUA_EXECUTABLE} CACHE PATH "Lua executable used for code generation." ) - mark_as_advanced( SRTK_LUA_EXECUTABLE ) - unset( LUA_EXECUTABLE CACHE ) -else() - include(External_Lua) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES Lua) - set( SRTK_LUA_EXECUTABLE ${SRTK_LUA_EXECUTABLE} CACHE PATH "Lua executable used for code generation." ) - mark_as_advanced( SRTK_LUA_EXECUTABLE ) - list(APPEND SimpleRTK_VARS SRTK_LUA_EXECUTABLE) -endif() - -#------------------------------------------------------------------------------ -# Swig -#------------------------------------------------------------------------------ -option ( USE_SYSTEM_SWIG "Use a pre-compiled version of SWIG 2.0 previously configured for your system" OFF ) -mark_as_advanced(USE_SYSTEM_SWIG) -if(USE_SYSTEM_SWIG) - find_package ( SWIG 2 REQUIRED ) - include ( UseSWIGLocal ) -else() - include(${CMAKE_CURRENT_LIST_DIR}/SuperBuild/External_Swig.cmake) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES Swig) -endif() - -#------------------------------------------------------------------------------ -# Google Test -#------------------------------------------------------------------------------ -option( USE_SYSTEM_GTEST "Use a pre-compiled version of GoogleTest. " OFF ) -mark_as_advanced(USE_SYSTEM_GTEST) -if ( BUILD_TESTING ) - if (USE_SYSTEM_GTEST) - find_package( GTest REQUIRED ) - list(APPEND SimpleRTK_VARS GTEST_LIBRARIES GTEST_INCLUDE_DIRS GTEST_MAIN_LIBRARIES) - else() - include(External_GTest) - set( GTEST_ROOT ${GTEST_ROOT} ) - list(APPEND SimpleRTK_VARS GTEST_ROOT) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES GTest) - endif() -endif() - -# We need python virtualenv -#------------------------------------------------------------------------------ -# Python virtualenv -#------------------------------------------------------------------------------ -option( USE_SYSTEM_VIRTUALENV "Use a system version of Python's virtualenv. " OFF ) -mark_as_advanced(USE_SYSTEM_VIRTUALENV) -if( NOT DEFINED SRTK_PYTHON_USE_VIRTUALENV OR SRTK_PYTHON_USE_VIRTUALENV ) - if ( USE_SYSTEM_VIRTUALENV ) - find_package( PythonVirtualEnv REQUIRED) - else() - include(External_virtualenv) - if ( WRAP_PYTHON ) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES virtualenv) - endif() - endif() - list(APPEND SimpleRTK_VARS PYTHON_VIRTUALENV_SCRIPT) -endif() - - -VariableListToCache( SimpleRTK_VARS ep_simplertk_cache ) -VariableListToArgs( SimpleRTK_VARS ep_simplertk_args ) -VariableListToCache( SRTK_LANGUAGES_VARS ep_languages_cache ) -VariableListToArgs( SRTK_LANGUAGES_VARS ep_languages_args ) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SimpleRTK-build/CMakeCacheInit.txt" "${ep_simplertk_cache}${ep_common_cache}\n${ep_languages_cache}" ) - -set(proj SimpleRTK) -ExternalProject_Add(${proj} - DOWNLOAD_COMMAND "" - SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} - BINARY_DIR SimpleRTK-build -# INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${CMAKE_CURRENT_BINARY_DIR}/SimpleRTK-build/CMakeCacheInit.txt" - ${ep_simplertk_args} - ${ep_common_args} - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ ${CXX_ADDITIONAL_WARNING_FLAGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=/lib - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=/lib - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=/bin - -DCMAKE_BUNDLE_OUTPUT_DIRECTORY:PATH=/bin - ${ep_languages_args} - # ITK - -DITK_DIR:PATH=${ITK_DIR} - # RTK - -DRTK_DIR:PATH=${RTK_DIR} - -DSRTK_4D_IMAGES:BOOL=ON - # Swig - -DSWIG_DIR:PATH=${SWIG_DIR} - -DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE} - -DBUILD_TESTING:BOOL=${BUILD_TESTING} - -DWRAP_LUA:BOOL=${WRAP_LUA} - -DWRAP_PYTHON:BOOL=${WRAP_PYTHON} - -DWRAP_RUBY:BOOL=${WRAP_RUBY} - -DWRAP_JAVA:BOOL=${WRAP_JAVA} - -DWRAP_TCL:BOOL=${WRAP_TCL} - -DWRAP_CSHARP:BOOL=${WRAP_CSHARP} - -DWRAP_R:BOOL=${WRAP_R} - -DBUILD_EXAMPLES:BOOL=${BUILD_TESTING} - -DSimpleRTK_PYTHON_WHEEL=1 - DEPENDS ${${CMAKE_PROJECT_NAME}_DEPENDENCIES} RTK -) - - - -if(COMMAND ExternalData_Add_Target) - ExternalData_Add_Target(SuperBuildSimpleRTKSourceReal) - add_dependencies(SuperBuildSimpleRTKSource SuperBuildSimpleRTKSourceReal) -endif() - - diff --git a/utilities/SimpleRTK/SuperBuild/CMakeLists.txt b/utilities/SimpleRTK/SuperBuild/CMakeLists.txt deleted file mode 100644 index 80252e86e..000000000 --- a/utilities/SimpleRTK/SuperBuild/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ - -#----------------------------------------------------------------------------- -# Override defaults set in initial "project" call, allow user to -# override from command line -#----------------------------------------------------------------------------- - - -# SimpleRTK Addition: install to the common library -# directory, so that all libs/include etc ends up -# in one common tree -if( NOT DEFINED CMAKE_INSTALL_PREFIX ) - set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Where all the prerequisite libraries go") -endif() - -cmake_minimum_required ( VERSION 3.0 ) -project ( SuperBuildSimpleRTK ) - -#----------------------------------------------------------------------------- -# Superbuild script -#----------------------------------------------------------------------------- - -# Actually run the super build script -set(${CMAKE_PROJECT_NAME}_DEPENDENCIES "") #Dependancies will be determined during superbuild stage. -include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake") - - diff --git a/utilities/SimpleRTK/SuperBuild/CTestConfig.cmake b/utilities/SimpleRTK/SuperBuild/CTestConfig.cmake deleted file mode 100644 index c1aaf30d6..000000000 --- a/utilities/SimpleRTK/SuperBuild/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set(CTEST_PROJECT_NAME "SuperBuildSimpleRTK") -set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=RTK") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/utilities/SimpleRTK/SuperBuild/External_GTest.cmake b/utilities/SimpleRTK/SuperBuild/External_GTest.cmake deleted file mode 100644 index 05e8a9caf..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_GTest.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -set(proj GTest) - -set(GTEST_TARGET_VERSION 1.7.0) -set(GTEST_DOWNLOAD_SOURCE_HASH "2d6ec8ccdf5c46b05ba54a9fd1d130d7") - -# follow the standard EP_PREFIX locations -set(GTEST_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}-prefix/src/${proj}-build) -set(GTEST_source_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}-prefix/src/${proj}) -set(GTEST_install_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}) - -srtkSourceDownload(GTEST_URL "gtest-${GTEST_TARGET_VERSION}.zip" ${GTEST_DOWNLOAD_SOURCE_HASH}) - -file(WRITE "${GTEST_binary_dir}/CMakeCacheInit.txt" "${ep_common_cache}" ) - -set(${proj}_ARCHIVE_OUTPUT_DIRECTORY "/lib") -if (CMAKE_GENERATOR MATCHES "Visual Studio") - set(${proj}_ARCHIVE_OUTPUT_DIRECTORY "/lib/$") -endif() - -set(ep_extra_args) -if(MSVC_VERSION EQUAL 1700) - # Tuples are limited by _VARIADIC_MAX in VS11. The variadic - # templates are not deep enough by default. We are not currently - # using the GTest features which require tuple, so just disable them - # and hope that upstream premanetly addresses the problem, with out - # required more CMake core for compiler issues. - set(ep_extra_args ${ep_extra_args} -D CMAKE_CXX_FLAGS=-DGTEST_HAS_TR1_TUPLE=0 ${CMAKE_CXX_FLAGS}) -endif() - -if(MSVC) - set(ep_extra_args ${ep_extra_args} -D gtest_force_shared_crt:BOOL=ON) -endif() - - -ExternalProject_Add(${proj} - URL "${GTEST_URL}" - URL_MD5 ${GTEST_DOWNLOAD_SOURCE_HASH} - INSTALL_DIR ${GTEST_install_dir} - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${GTEST_binary_dir}/CMakeCacheInit.txt" - ${ep_common_args} - ${ep_extra_args} - -D BUILD_SHARED_LIBS:BOOL=OFF - -D CMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=/lib - -D gtest_disable_pthreads:BOOL=ON - INSTALL_COMMAND - ${CMAKE_COMMAND} -E copy_directory ${${proj}_ARCHIVE_OUTPUT_DIRECTORY} /lib - COMMAND - ${CMAKE_COMMAND} -E copy_directory /include /include -) - -srtkSourceDownloadDependency(${proj}) - -set(GTEST_ROOT ${GTEST_install_dir}) diff --git a/utilities/SimpleRTK/SuperBuild/External_ITK.cmake b/utilities/SimpleRTK/SuperBuild/External_ITK.cmake deleted file mode 100644 index 822f0237a..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_ITK.cmake +++ /dev/null @@ -1,104 +0,0 @@ - -#----------------------------------------------------------------------------- -# Get and build itk - -# Determine if we need to set to use 64BITS_IDS for windows64 -if(CMAKE_CL_64) - option(ITK_USE_64BITS_IDS "When ON, ITK will use 64 bits integers to -index pixels. This is needed for managing images larger than 4Gb in -some platforms." - ON) - mark_as_advanced(ITK_USE_64BITS_IDS) -endif() - -get_cmake_property( _varNames VARIABLES ) - -foreach (_varName ${_varNames}) - if(_varName MATCHES "^ITK_" OR _varName MATCHES "FFTW" OR _varName MATCHES "^Module_ITK") - message( STATUS "Passing variable \"${_varName}=${${_varName}}\" to ITK external project.") - list(APPEND ITK_VARS ${_varName}) - endif() -endforeach() - -list(APPEND ITK_VARS - PYTHON_EXECUTABLE - PYTHON_INCLUDE_DIR - PYTHON_LIBRARY - PYTHON_DEBUG_LIBRARY - ) - -VariableListToCache( ITK_VARS ep_itk_cache ) -VariableListToArgs( ITK_VARS ep_itk_args ) - - -set(proj ITK) ## Use ITK convention of calling it ITK -if(NOT DEFINED ITK_REPOSITORY) - set(ITK_REPOSITORY "${git_protocol}://itk.org/ITK.git") -endif() - -set(ITK_USE_GIT_PROTOCOL 0) -if("${git_protocol}" STREQUAL "git") - set(ITK_USE_GIT_PROTOCOL 1) -endif() - -# NOTE: it is very important to update the ITK_DIR path with the ITK version -set(ITK_TAG_COMMAND GIT_TAG 80178ae516db87aa50d2883c4e090da92c4a502d ) # just before 4.10.1 release - -if(${ITK_WRAPPING} OR ${BUILD_SHARED_LIBS}) - set( ITK_BUILD_SHARED_LIBS ON ) -else() - set( ITK_BUILD_SHARED_LIBS OFF ) - list( APPEND ep_itk_args"-DCMAKE_C_VISIBILITY_PRESET:BOOL=hidden" "-DCMAKE_CXX_VISIBILITY_PRESET:BOOL=hidden" ) -endif() - - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" "${ep_itk_cache}\n${ep_common_cache}" ) - -ExternalProject_Add(${proj} - GIT_REPOSITORY ${ITK_REPOSITORY} - ${ITK_TAG_COMMAND} - UPDATE_COMMAND "" - SOURCE_DIR ${proj} - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" - ${ep_itk_args} - ${ep_common_args} - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_VISIBILITY_INLINES_HIDDEN:BOOL=ON - -DBUILD_EXAMPLES:BOOL=OFF - -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=${ITK_BUILD_SHARED_LIBS} - -DCMAKE_SKIP_RPATH:BOOL=ON - -DCMAKE_INSTALL_PREFIX:PATH= - -DITK_LEGACY_REMOVE:BOOL=ON - -DITK_BUILD_DEFAULT_MODULES:BOOL=ON - -DModule_ITKReview:BOOL=ON - -DITK_USE_GIT_PROTOCOL:BOOL=${ITK_USE_GIT_PROTOCOL} - -DITK_WRAP_float:BOOL=ON - -DITK_WRAP_unsigned_char:BOOL=ON - -DITK_WRAP_signed_short:BOOL=ON - -DITK_WRAP_unsigned_short:BOOL=ON - -DITK_WRAP_complex_float:BOOL=ON - -DITK_WRAP_vector_float:BOOL=ON - -DITK_WRAP_covariant_vector_float:BOOL=ON - -DITK_WRAP_rgb_signed_short:BOOL=ON - -DITK_WRAP_rgb_unsigned_char:BOOL=ON - -DITK_WRAP_rgb_unsigned_short:BOOL=ON - -DITK_WRAP_PYTHON:BOOL=${ITK_WRAPPING} - # Required as to not install into system - -DINSTALL_WRAP_ITK_COMPATIBILITY:BOOL=OFF - # Swig - -DSWIG_DIR:PATH=${SWIG_DIR} - -DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE} - BUILD_COMMAND ${BUILD_COMMAND_STRING} - DEPENDS - ${ITK_DEPENDENCIES} - ) - - -ExternalProject_Get_Property(ITK install_dir) -set(ITK_DIR "${install_dir}/lib/cmake/ITK-4.10" ) -set(WrapITK_DIR "${ITK_DIR}/WrapITK") diff --git a/utilities/SimpleRTK/SuperBuild/External_Lua.cmake b/utilities/SimpleRTK/SuperBuild/External_Lua.cmake deleted file mode 100644 index 81d6a7185..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_Lua.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -set(proj Lua) - -set(lua_TARGET_VERSION 5.1.5) -set(lua_DOWNLOAD_SOURCE_HASH "2e115fe26e435e33b0d5c022e4490567") - - -# follow the standard EP_PREFIX locations -set(lua_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}-prefix/src/${proj}-build) -set(lua_source_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}-prefix/src/${proj}) -set(lua_install_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}) - -srtkSourceDownload(lua_URL "lua-${lua_TARGET_VERSION}.tar.gz" ${lua_DOWNLOAD_SOURCE_HASH}) - -file(WRITE "${lua_binary_dir}/CMakeCacheInit.txt" "${ep_common_cache}" ) - -set(lua_PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_LIST_DIR}/lua.cmake - ${lua_source_dir}/CMakeLists.txt -) - -ExternalProject_Add(Lua - URL "${lua_URL}" - URL_MD5 "${lua_DOWNLOAD_SOURCE_HASH}" - PATCH_COMMAND ${lua_PATCH_COMMAND} - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${lua_binary_dir}/CMakeCacheInit.txt" - ${ep_common_args} - -D BUILD_SHARED_LIBS:BOOL=OFF - -D CMAKE_INSTALL_PREFIX:PATH=${lua_install_dir} -) - -srtkSourceDownloadDependency(Lua) - - -set(SRTK_LUA_EXECUTABLE "${lua_install_dir}/bin/lua") diff --git a/utilities/SimpleRTK/SuperBuild/External_PCRE.cmake b/utilities/SimpleRTK/SuperBuild/External_PCRE.cmake deleted file mode 100644 index 8cebdc5cb..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_PCRE.cmake +++ /dev/null @@ -1,48 +0,0 @@ - -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -# Sanity checks -if(DEFINED PCRE_DIR AND NOT EXISTS ${PCRE_DIR}) - message(FATAL_ERROR "PCRE_DIR variable is defined but corresponds to non-existing directory") -endif() - -# Set dependency list -set(PCRE_DEPENDENCIES "") - -if(NOT PCRE_DIR) - # - # PCRE (Perl Compatible Regular Expressions) - # - - set(PCRE_TARGET_VERSION 8.37) - set(PCRE_DOWNLOAD_SOURCE_HASH "6e0cc6d1bdac7a4308151f9b3571b86e") - srtkSourceDownload(PCRE_URL "pcre-${PCRE_TARGET_VERSION}.tar.gz" ${PCRE_DOWNLOAD_SOURCE_HASH}) - - - # follow the standard EP_PREFIX locations - set(pcre_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE-prefix/src/PCRE-build) - set(pcre_source_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE-prefix/src/PCRE) - set(pcre_install_dir ${CMAKE_CURRENT_BINARY_DIR}/PCRE) - - configure_file( - ${CMAKE_CURRENT_LIST_DIR}/pcre_configure_step.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/pcre_configure_step.cmake - @ONLY) - - set ( pcre_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/pcre_configure_step.cmake ) - - ExternalProject_add(PCRE - URL "${PCRE_URL}" - URL_MD5 "${PCRE_DOWNLOAD_SOURCE_HASH}" - CONFIGURE_COMMAND ${pcre_CONFIGURE_COMMAND} - DEPENDS "${PCRE_DEPENDENCIES}" - ) - - srtkSourceDownloadDependency(PCRE) - -endif(NOT PCRE_DIR) diff --git a/utilities/SimpleRTK/SuperBuild/External_RTK.cmake b/utilities/SimpleRTK/SuperBuild/External_RTK.cmake deleted file mode 100644 index 9e306acc2..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_RTK.cmake +++ /dev/null @@ -1,66 +0,0 @@ - -#----------------------------------------------------------------------------- -# Get and build RTK - -get_cmake_property( _varNames VARIABLES ) - -foreach (_varName ${_varNames}) - if(_varName MATCHES "^RTK_" OR _varName MATCHES "FFTW") - message( STATUS "Passing variable \"${_varName}=${${_varName}}\" to RTK external project.") - list(APPEND RTK_VARS ${_varName}) - endif() -endforeach() - -list(APPEND RTK_VARS - PYTHON_EXECUTABLE - PYTHON_INCLUDE_DIR - PYTHON_LIBRARY - PYTHON_DEBUG_LIBRARY - ) - -VariableListToCache( RTK_VARS ep_rtk_cache ) -VariableListToArgs( RTK_VARS ep_rtk_args ) - - -set(proj RTK) ## Use RTK convention of calling it RTK -set(RTK_REPOSITORY git://github.com/SimonRit/RTK) - -# NOTE: it is very important to update the RTK_DIR path with the RTK version -# For now using master/head -#set(RTK_TAG_COMMAND GIT_TAG v4.5.1) - -if( ${BUILD_SHARED_LIBS} ) - set( RTK_BUILD_SHARED_LIBS ON ) -else() - set( RTK_BUILD_SHARED_LIBS OFF ) -endif() - - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" "${ep_rtk_cache}\n${ep_common_cache}" ) - -ExternalProject_Add(${proj} - GIT_REPOSITORY ${RTK_REPOSITORY} - ${RTK_TAG_COMMAND} - UPDATE_COMMAND "" - SOURCE_DIR ${proj} - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" - ${ep_rtk_args} - ${ep_common_args} - -DRTK_DIR:PATH=${RTK_DIR} - -DBUILD_APPLICATIONS:BOOL=OFF - -DBUILD_EXAMPLES:BOOL=OFF - -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=${RTK_BUILD_SHARED_LIBS} - -DCMAKE_SKIP_RPATH:BOOL=ON - -DCMAKE_INSTALL_PREFIX:PATH= - BUILD_COMMAND ${BUILD_COMMAND_STRING} - DEPENDS - ${RTK_DEPENDENCIES} - ) - -ExternalProject_Get_Property(RTK install_dir) -set(RTK_DIR "${install_dir}/lib/cmake/RTK-Master" ) diff --git a/utilities/SimpleRTK/SuperBuild/External_SimpleRTKExamples.cmake b/utilities/SimpleRTK/SuperBuild/External_SimpleRTKExamples.cmake deleted file mode 100644 index 85cf36bee..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_SimpleRTKExamples.cmake +++ /dev/null @@ -1,28 +0,0 @@ -set(proj SimpleRTKExamples) - -# Set dependency list -set(SimpleRTKExamples_DEPENDENCIES "SimpleRTK") - -if (${BUILD_EXAMPLES} ) - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" "${ep_common_cache}" ) - - ExternalProject_Add(${proj} - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../Examples - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" - ${ep_common_args} - -DSimpleRTK_DIR:PATH=${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SimpleRTK-0.11/ - -DCMAKE_SKIP_RPATH:BOOL=ON - -DCMAKE_INSTALL_PREFIX:PATH= - BUILD_COMMAND ${BUILD_COMMAND_STRING} - INSTALL_COMMAND "" - DEPENDS "${SimpleRTKExamples_DEPENDENCIES}" - ) - -endif() diff --git a/utilities/SimpleRTK/SuperBuild/External_Swig.cmake b/utilities/SimpleRTK/SuperBuild/External_Swig.cmake deleted file mode 100644 index 062c9ca48..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_Swig.cmake +++ /dev/null @@ -1,122 +0,0 @@ -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -# Sanity checks -if(DEFINED Swig_DIR AND NOT EXISTS ${Swig_DIR}) - message(FATAL_ERROR "Swig_DIR variable is defined but corresponds to non-existing directory") -endif() - -if(NOT SWIG_DIR) - - if (NOT MSVC) - option(USE_SWIG_FROM_GIT "Use a version of swig pulled from the git repo. This will require automake tools and does not work under windows." OFF ) - - mark_as_advanced(USE_SWIG_FROM_GIT) - endif() - - if( USE_SWIG_FROM_GIT ) - set(SWIG_GIT_REPOSITORY "${git_protocol}://github.com/swig/swig.git" CACHE STRING "URL of swig git repo") - set(SWIG_GIT_TAG "rel-3.0.10" CACHE STRING "Tag in swig git repo") - mark_as_advanced(SWIG_GIT_REPO) - mark_as_advanced(SWIG_GIT_TAG) - endif() - - set(SWIG_TARGET_VERSION "3.0.10" ) - set(SWIG_DOWNLOAD_SOURCE_HASH "bb4ab8047159469add7d00910e203124") - set(SWIGWIN_DOWNLOAD_HASH "f229724fe856aa78df6128ecfefe6e0a") - set(SWIGWIN_URL "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIGWIN_DOWNLOAD_HASH}&name=swigwin-${SWIG_TARGET_VERSION}.zip") - set(SWIG_URL "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${SWIG_DOWNLOAD_SOURCE_HASH}&name=swig-${SWIG_TARGET_VERSION}.tar.gz") - - - if(WIN32) - # binary SWIG for windows - #------------------------------------------------------------------------------ - - srtkSourceDownload(SWIGWIN_URL "swigwin-${SWIG_TARGET_VERSION}.zip" ${SWIGWIN_DOWNLOAD_HASH}) - - set(swig_source_dir ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}) - - # swig.exe available as pre-built binary on Windows: - ExternalProject_Add(Swig - URL "${SWIGWIN_URL}" - URL_MD5 ${SWIGWIN_DOWNLOAD_HASH} - SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - ) - add_dependencies(Swig "SuperBuildSimpleRTKSource") - - set(SWIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}) # path specified as source in ep - set(SWIG_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${SWIG_TARGET_VERSION}/swig.exe) - - else() - # compiled SWIG for others - #------------------------------------------------------------------------------ - - # Set dependency list - set(Swig_DEPENDENCIES "PCRE") - - # - # PCRE (Perl Compatible Regular Expressions) - # - include(External_PCRE) - - - # - # SWIG - # - - # swig uses bison find it by cmake and pass it down - if(USE_SWIG_FROM_GIT) - set(BISON_REQUIRED "REQUIRED") - endif() - find_package(BISON ${BISON_REQUIRED}) - set(BISON_FLAGS "-y" CACHE STRING "Flags used by bison") - mark_as_advanced(BISON_FLAGS) - - - # follow the standard EP_PREFIX locations - set(swig_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig-prefix/src/Swig-build) - set(swig_source_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig-prefix/src/Swig) - set(swig_install_dir ${CMAKE_CURRENT_BINARY_DIR}/Swig) - - # configure step - configure_file( - ${CMAKE_CURRENT_LIST_DIR}/swig_configure_step.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/swig_configure_step.cmake - @ONLY) - set(swig_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/swig_configure_step.cmake) - - if(USE_SWIG_FROM_GIT) - set(SWIG_DOWNLOAD_STEP - GIT_REPOSITORY "${SWIG_GIT_REPOSITORY}" - GIT_TAG "${SWIG_GIT_TAG}" - ) - else() - srtkSourceDownload(${proj}_URL "swig-${SWIG_TARGET_VERSION}.tar.gz" ${SWIG_DOWNLOAD_SOURCE_HASH}) - set(SWIG_DOWNLOAD_STEP - URL "${SWIG_URL}" - URL_MD5 "${SWIG_DOWNLOAD_SOURCE_HASH}" - ) - endif() - - ExternalProject_add(Swig - ${SWIG_DOWNLOAD_STEP} - CONFIGURE_COMMAND ${swig_CONFIGURE_COMMAND} - DEPENDS "${Swig_DEPENDENCIES}" - ) - - if(NOT USE_SWIG_FROM_GIT) - srtkSourceDownloadDependency(Swig) - endif() - - set(SWIG_DIR ${swig_install_dir}/share/swig/${SWIG_TARGET_VERSION}) - set(SWIG_EXECUTABLE ${swig_install_dir}/bin/swig) - - endif() -endif(NOT SWIG_DIR) diff --git a/utilities/SimpleRTK/SuperBuild/External_virtualenv.cmake b/utilities/SimpleRTK/SuperBuild/External_virtualenv.cmake deleted file mode 100644 index 5bf968d4c..000000000 --- a/utilities/SimpleRTK/SuperBuild/External_virtualenv.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -set(proj virtualenv) - -set(${proj}_TARGET_VERSION 15.0.2) -set(${proj}_DOWNLOAD_SOURCE_HASH "0ed59863994daf1292827ffdbba80a63") - -# based on the standard EP_PREFIX locations, but since we don't build -# or install, then standards install directory is also the source -set(${proj}_binary_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}-prefix/src/${proj}-build) -set(${proj}_source_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}) -set(${proj}_install_dir ${CMAKE_CURRENT_BINARY_DIR}/${proj}) -set(${proj}_URL "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${${proj}_DOWNLOAD_SOURCE_HASH}&name=virtualenv-${${proj}_TARGET_VERSION}.tar.gz") - -srtkSourceDownload(${proj}_URL "virtualenv-${${proj}_TARGET_VERSION}.tar.gz" ${${proj}_DOWNLOAD_SOURCE_HASH}) - -ExternalProject_Add(${proj} - URL "${${proj}_URL}" - URL_MD5 ${${proj}_DOWNLOAD_SOURCE_HASH} - SOURCE_DIR ${${proj}_source_dir} - BINARY_DIR ${${proj}_binary_dir} - INSTALL_DIR ${${proj}_install_dir} - UPDATE_COMMAND "" - PATCH_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) - -srtkSourceDownloadDependency(${proj}) - - -set(${proj}_ROOT ${${proj}_source_dir}) -set(PYTHON_VIRTUALENV_SCRIPT ${${proj}_source_dir}/virtualenv.py) \ No newline at end of file diff --git a/utilities/SimpleRTK/SuperBuild/SuperBuild.cmake b/utilities/SimpleRTK/SuperBuild/SuperBuild.cmake deleted file mode 100644 index 98b47586b..000000000 --- a/utilities/SimpleRTK/SuperBuild/SuperBuild.cmake +++ /dev/null @@ -1,481 +0,0 @@ -#----------------------------------------------------------------------------- -# CTest Related Settings -#----------------------------------------------------------------------------- -set(BUILDNAME "NoBuldNameGiven") -set(SITE "NoSiteGiven") -set(BUILD_TESTING_DEFAULT ON) -if(CMAKE_VERSION VERSION_LESS 2.8.11) - set(BUILD_TESTING_DEFAULT OFF) -endif() -option( BUILD_TESTING "Turn on Testing for SimpleRTK" ${BUILD_TESTING_DEFAULT} ) - -# 2.8.11 required for ExternalData.cmake. -if( BUILD_TESTING AND CMAKE_VERSION VERSION_LESS 2.8.11 ) - message( FATAL_ERROR "BUILD_TESTING ON requires CMake 2.8.11 or newer." ) -endif() - -if(CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_VERSION VERSION_LESS 3.2 ) - message( FATAL_ERROR "Using \"Ninja\" generator requires CMake 3.2.0 or newer." ) -endif() - -configure_file(../CMake/CTestCustom.cmake.in CTestCustom.cmake) - - -enable_language(C) -enable_language(CXX) - -#----------------------------------------------------------------------------- -# Platform check -#----------------------------------------------------------------------------- -set(PLATFORM_CHECK true) -if(PLATFORM_CHECK) - # See CMake/Modules/Platform/Darwin.cmake) - # 6.x == Mac OSX 10.2 (Jaguar) - # 7.x == Mac OSX 10.3 (Panther) - # 8.x == Mac OSX 10.4 (Tiger) - # 9.x == Mac OSX 10.5 (Leopard) - # 10.x == Mac OSX 10.6 (Snow Leopard) - if (DARWIN_MAJOR_VERSION LESS "9") - message(FATAL_ERROR "Only Mac OSX >= 10.5 are supported !") - endif() -endif() - -#----------------------------------------------------------------------------- -# Update CMake module path -#------------------------------------------------------------------------------ - -set(CMAKE_MODULE_PATH - ${CMAKE_SOURCE_DIR}/CMake - ${CMAKE_SOURCE_DIR}/SuperBuild - ${CMAKE_BINARY_DIR}/CMake - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../CMake # CMake directory - ${CMAKE_CURRENT_SOURCE_DIR}/../Wrapping - ${CMAKE_MODULE_PATH} - ) - -include(srtkPreventInSourceBuilds) -include(srtkPreventInBuildInstalls) -include(VariableList) -include(srtkExternalData) - - -add_custom_target( SuperBuildSimpleRTKSource ) - -# -# srtkSourceDownload( ) -# -# A function to get a filename for an ExternalData source file used in -# a superbuild. Adds a target which downloads all source code -# needed for superbuild projects. The source file is cached with in -# the build tree, and can be locally cache with other ExternalData -# controlled environment variables. -# -# The "SuperBuildSimpleRTKSource" target needs to be manually added as -# a dependencies to the ExternalProject. -# -# add_dependencies( PROJ "SuperBuildSimpleRTKSource" ) -# -# Note: Hash files are created under the SOURCE directory in the -# .ExternalSource sub-directory during configuration. -# -function(srtkSourceDownload outVar filename hash) - set(link_file "${CMAKE_CURRENT_SOURCE_DIR}/.ExternalSource/${filename}") - file(WRITE "${link_file}.md5" ${hash} ) - ExternalData_Expand_arguments( - SuperBuildSimpleRTKSourceReal - link - DATA{${link_file}} - ) - set(${outVar} "${link}" PARENT_SCOPE) -endfunction() - -function(srtkSourceDownloadDependency proj) - if (CMAKE_VERSION VERSION_LESS 3.2) - add_dependencies(${proj} "SuperBuildSimpleRTKSource") - else() - ExternalProject_Add_StepDependencies(${proj} download "SuperBuildSimpleRTKSource") - endif() -endfunction() - -#----------------------------------------------------------------------------- -# Prerequisites -#------------------------------------------------------------------------------ -# - -# Compute -G arg for configuring external projects with the same CMake generator: -if(CMAKE_EXTRA_GENERATOR) - set(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") -else() - set(gen "${CMAKE_GENERATOR}") -endif() - -#----------------------------------------------------------------------------- -# Use GIT protocol -#------------------------------------------------------------------------------ -find_package(Git) -set(SRTK_GIT_PROTOCOL_default "https") -if (GIT_VERSION_STRING VERSION_LESS "1.7.10") - # minimum version for https support - set(SRTK_GIT_PROTOCOL_default "git") -endif() -set(SRTK_GIT_PROTOCOL ${SRTK_GIT_PROTOCOL_default} CACHE STRING "If behind a firewall turn set this to 'https' or 'http'." ) -mark_as_advanced(SRTK_GIT_PROTOCOL) -set_property(CACHE SRTK_GIT_PROTOCOL PROPERTY STRINGS "https;http;git") -set(git_protocol ${SRTK_GIT_PROTOCOL}) - - -#----------------------------------------------------------------------------- -# SimpleRTK options -#------------------------------------------------------------------------------ - -option( BUILD_EXAMPLES "Enable Building of the SimpleRTK Examples as a separate project." ON ) - -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() - -# Default to build shared libraries off -option(BUILD_SHARED_LIBS "Build SimpleRTK RTK with shared libraries. This does not effect wrapped languages." OFF) - -# as this option does not robustly work across platforms it will be marked as advanced -mark_as_advanced( FORCE BUILD_SHARED_LIBS ) - -option( SRTK_4D_IMAGES "Add Image and I/O support for four spatial dimensions." OFF ) -mark_as_advanced( SRTK_4D_IMAGES ) - -#----------------------------------------------------------------------------- -# Setup build type -#------------------------------------------------------------------------------ - -# By default, let's build as Debug -if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Debug") -endif() - -# let a dashboard override the default. -if(CTEST_BUILD_CONFIGURATION) - set(CMAKE_BUILD_TYPE "${CTEST_BUILD_CONFIGURATION}") -endif() - -#------------------------------------------------------------------------- -# augment compiler flags -#------------------------------------------------------------------------- -include(srtkCheckRequiredFlags) -set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimpleRTK_REQUIRED_CXX_FLAGS}" ) - -#------------------------------------------------------------------------------ -# BuildName used for dashboard reporting -#------------------------------------------------------------------------------ -if(NOT BUILDNAME) - set(BUILDNAME "Unknown-build" CACHE STRING "Name of build to report to dashboard") -endif() - - -#------------------------------------------------------------------------------ -# WIN32 /bigobj is required for windows builds because of the size of -#------------------------------------------------------------------------------ -if (MSVC) - # some object files (CastImage for instance) - set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" ) - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) - # Avoid some warnings - add_definitions ( -D_SCL_SECURE_NO_WARNINGS ) -endif() - -#------------------------------------------------------------------------------ -# Setup build locations. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Common Build Options to pass to all subsequent tools -#------------------------------------------------------------------------------ -list( APPEND ep_common_list - MAKECOMMAND - CMAKE_BUILD_TYPE - CMAKE_MAKE_PROGRAM - - CMAKE_C_COMPILER - CMAKE_C_COMPILER_ARG1 - - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_RELWITHDEBINFO - - CMAKE_CXX_COMPILER - CMAKE_CXX_COMPILER_ARG1 - - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO - - CMAKE_LINKER - - CMAKE_EXE_LINKER_FLAGS - CMAKE_EXE_LINKER_FLAGS_DEBUG - CMAKE_EXE_LINKER_FLAGS_MINSIZEREL - CMAKE_EXE_LINKER_FLAGS_RELEASE - CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_MODULE_LINKER_FLAGS - CMAKE_MODULE_LINKER_FLAGS_DEBUG - CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL - CMAKE_MODULE_LINKER_FLAGS_RELEASE - CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO - CMAKE_SHARED_LINKER_FLAGS - CMAKE_SHARED_LINKER_FLAGS_DEBUG - CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL - CMAKE_SHARED_LINKER_FLAGS_RELEASE - CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO - - CMAKE_STRIP - - CMAKE_PREFIX_PATH - CMAKE_FRAMEWORK_PATH - CMAKE_SYSTEM_PREFIX_PATH - CMAKE_SYSTEM_INCLUDE_PATH - CMAKE_SYSTEM_LIBRARY_PATH - CMAKE_SYSTEM_PROGRAM_PATH - CMAKE_SYSTEM_IGNORE_PATH - - - CMAKE_GENERATOR - CMAKE_EXTRA_GENERATOR - MEMORYCHECK_COMMAND_OPTIONS - MEMORYCHECK_SUPPRESSIONS_FILE - MEMORYCHECK_COMMAND - SITE - BUILDNAME ) - -if( APPLE ) - list( APPEND ep_common_list - CMAKE_OSX_SYSROOT - CMAKE_OSX_DEPLOYMENT_TARGET ) -endif() - -if( DEFINED CMAKE_STRIP_FLAGS ) - list( APPEND ep_common_list - CMAKE_STRIP_FLAGS ) -endif() - -VariableListToArgs( ep_common_list ep_common_args ) - -if( APPLE ) - list( APPEND ep_common_list CMAKE_OSX_ARCHITECTURES ) -endif() -VariableListToCache( ep_common_list ep_common_cache ) - -# -# Use CMake file which present options for wrapped languages, and finds languages as needed -# -include(srtkLanguageOptions) - - -#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -include(ExternalProject) - -#------------------------------------------------------------------------------ -# Lua -#------------------------------------------------------------------------------ -option ( USE_SYSTEM_LUA "Use a pre-compiled version of LUA 5.1 previously configured for your system" OFF ) -mark_as_advanced(USE_SYSTEM_LUA) -if ( USE_SYSTEM_LUA ) - find_package( LuaInterp REQUIRED 5.1 ) - set( SRTK_LUA_EXECUTABLE ${LUA_EXECUTABLE} CACHE PATH "Lua executable used for code generation." ) - mark_as_advanced( SRTK_LUA_EXECUTABLE ) - unset( LUA_EXECUTABLE CACHE ) -else() - include(External_Lua) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES Lua) - set( SRTK_LUA_EXECUTABLE ${SRTK_LUA_EXECUTABLE} CACHE PATH "Lua executable used for code generation." ) - mark_as_advanced( SRTK_LUA_EXECUTABLE ) -endif() - -#------------------------------------------------------------------------------ -# Swig -#------------------------------------------------------------------------------ -option ( USE_SYSTEM_SWIG "Use a pre-compiled version of SWIG 2.0 previously configured for your system" OFF ) -mark_as_advanced(USE_SYSTEM_SWIG) -if(USE_SYSTEM_SWIG) - find_package ( SWIG 2 REQUIRED ) -else() - include(External_Swig) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES Swig) -endif() - -#------------------------------------------------------------------------------ -# Google Test -#------------------------------------------------------------------------------ -option( USE_SYSTEM_GTEST "Use a pre-compiled version of GoogleTest. " OFF ) -mark_as_advanced(USE_SYSTEM_GTEST) -if ( BUILD_TESTING ) - if (USE_SYSTEM_GTEST) - find_package( GTest REQUIRED ) - list(APPEND SimpleRTK_VARS GTEST_LIBRARIES GTEST_INCLUDE_DIRS GTEST_MAIN_LIBRARIES) - else() - include(External_GTest) - set( GTEST_ROOT ${GTEST_ROOT} ) - list(APPEND SimpleRTK_VARS GTEST_ROOT) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES GTest) - endif() -endif() - -#------------------------------------------------------------------------------ -# Python virtualenv -#------------------------------------------------------------------------------ -option( USE_SYSTEM_VIRTUALENV "Use a system version of Python's virtualenv. " OFF ) -mark_as_advanced(USE_SYSTEM_VIRTUALENV) -if( NOT DEFINED SRTK_PYTHON_USE_VIRTUALENV OR SRTK_PYTHON_USE_VIRTUALENV ) - if ( USE_SYSTEM_VIRTUALENV ) - find_package( PythonVirtualEnv REQUIRED) - else() - include(External_virtualenv) - if ( WRAP_PYTHON ) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES virtualenv) - endif() - endif() - list(APPEND SimpleRTK_VARS PYTHON_VIRTUALENV_SCRIPT) -endif() - -#------------------------------------------------------------------------------ -# ITK -#------------------------------------------------------------------------------ -option(USE_SYSTEM_ITK "Use a pre-built version of ITK" OFF) -mark_as_advanced(USE_SYSTEM_ITK) -if(USE_SYSTEM_ITK) - find_package(ITK REQUIRED) - #we require certain packages be turned on in RTK - include(srtkCheckForRTKModuleDependencies) -else() - set(ITK_WRAPPING OFF) - include(External_ITK) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES RTK) -endif() - - -#------------------------------------------------------------------------------ -# RTK -#------------------------------------------------------------------------------ -option(USE_SYSTEM_RTK "Use a pre-built version of RTK" OFF) -mark_as_advanced(USE_SYSTEM_RTK) -if(USE_SYSTEM_RTK) - find_package(RTK REQUIRED) - #we require certain packages be turned on in RTK - include(srtkCheckForRTKModuleDependencies) -else() - include(External_RTK) - list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES RTK) -endif() - - - -get_cmake_property( _varNames VARIABLES ) - -foreach (_varName ${_varNames}) - if(_varName MATCHES "^SimpleRTK_" OR _varName MATCHES "^SRTK_" ) - if (NOT _varName MATCHES "^SRTK_LANGUAGES_VARS" - AND - NOT _varName MATCHES "^SimpleRTK_VARS" - AND - NOT _varName MATCHES "^SimpleRTK_REQUIRED_" - AND - NOT _varName MATCHES "^SRTK_UNDEFINED_SYMBOLS_ALLOWED") - message( STATUS "Passing variable \"${_varName}=${${_varName}}\" to SimpleRTK external project.") - list(APPEND SimpleRTK_VARS ${_varName}) - endif() - endif() -endforeach() - - -VariableListToCache( SimpleRTK_VARS ep_simplertk_cache ) -VariableListToArgs( SimpleRTK_VARS ep_simplertk_args ) -VariableListToCache( SRTK_LANGUAGES_VARS ep_languages_cache ) -VariableListToArgs( SRTK_LANGUAGES_VARS ep_languages_args ) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SimpleRTK-build/CMakeCacheInit.txt" "${ep_simplertk_cache}${ep_common_cache}\n${ep_languages_cache}" ) - -set(proj SimpleRTK) -ExternalProject_Add(${proj} - DOWNLOAD_COMMAND "" - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. - BINARY_DIR SimpleRTK-build - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - --no-warn-unused-cli - -C "${CMAKE_CURRENT_BINARY_DIR}/SimpleRTK-build/CMakeCacheInit.txt" - ${ep_simplertk_args} - ${ep_common_args} - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=/lib - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=/lib - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=/bin - -DCMAKE_BUNDLE_OUTPUT_DIRECTORY:PATH=/bin - ${ep_languages_args} - # ITK - -DITK_DIR:PATH=${ITK_DIR} - # ITK - -DRTK_DIR:PATH=${RTK_DIR} - # Swig - -DSWIG_DIR:PATH=${SWIG_DIR} - -DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE} - -DBUILD_TESTING:BOOL=${BUILD_TESTING} - -DWRAP_LUA:BOOL=${WRAP_LUA} - -DWRAP_PYTHON:BOOL=${WRAP_PYTHON} - -DWRAP_RUBY:BOOL=${WRAP_RUBY} - -DWRAP_JAVA:BOOL=${WRAP_JAVA} - -DWRAP_TCL:BOOL=${WRAP_TCL} - -DWRAP_CSHARP:BOOL=${WRAP_CSHARP} - -DWRAP_R:BOOL=${WRAP_R} - -DBUILD_EXAMPLES:BOOL=${BUILD_TESTING} - DEPENDS ${${CMAKE_PROJECT_NAME}_DEPENDENCIES} -) - -ExternalProject_Add_Step(${proj} forcebuild - COMMAND ${CMAKE_COMMAND} -E remove - ${CMAKE_CURRENT_BUILD_DIR}/${proj}-prefix/src/${proj}-stamp/${prog}-build - DEPENDEES configure - DEPENDERS build - ALWAYS 1 -) - - -#------------------------------------------------------------------------------ -# SimpleRTKExamples -#------------------------------------------------------------------------------ - -# We build SimpleRTKExamples as an enternal project to verify -# installation of SimpleRTK - -include(External_SimpleRTKExamples) - - -#------------------------------------------------------------------------------ -# List of external projects -#------------------------------------------------------------------------------ -set(external_project_list RTK Swig SimpleRTKExamples PCRE Lua GTest virtualenv ${CMAKE_PROJECT_NAME}) - - -#----------------------------------------------------------------------------- -# Dump external project dependencies -#----------------------------------------------------------------------------- -set(ep_dependency_graph "# External project dependencies") -foreach(ep ${external_project_list}) - set(ep_dependency_graph "${ep_dependency_graph}\n${ep}: ${${ep}_DEPENDENCIES}") -endforeach() -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ExternalProjectDependencies.txt "${ep_dependency_graph}\n") - - -if(COMMAND ExternalData_Add_Target) - ExternalData_Add_Target(SuperBuildSimpleRTKSourceReal) - add_dependencies(SuperBuildSimpleRTKSource SuperBuildSimpleRTKSourceReal) -endif() diff --git a/utilities/SimpleRTK/SuperBuild/lua.cmake b/utilities/SimpleRTK/SuperBuild/lua.cmake deleted file mode 100644 index 0dfa8ce3e..000000000 --- a/utilities/SimpleRTK/SuperBuild/lua.cmake +++ /dev/null @@ -1,85 +0,0 @@ -cmake_minimum_required ( VERSION 2.8.1 FATAL_ERROR ) - - -if(POLICY CMP0025) - cmake_policy(SET CMP0025 OLD) -endif() - - -project (LUA C) - -# Setup build locations. -if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -endif() -if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() -if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -endif() - - - -#------------------------------------------------------------------------------ -# Variables for use in install rules: - -if(NOT LUA_INSTALL_RUNTIME_DIR) - set(LUA_INSTALL_RUNTIME_DIR "bin") -endif() -if(NOT LUA_INSTALL_LIBRARY_DIR) - set(LUA_INSTALL_LIBRARY_DIR "lib") -endif() -if(NOT LUA_INSTALL_ARCHIVE_DIR) - set(LUA_INSTALL_ARCHIVE_DIR "lib") -endif() -if(NOT LUA_INSTALL_INCLUDE_DIR) - set(LUA_INSTALL_INCLUDE_DIR "include") -endif() - - -if( MSVC ) - # suppress warning in Visual Studio about the securtiy of methods - add_definitions (-D_CRT_SECURE_NO_WARNINGS) - - # suppress warning: - # '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4334" ) -endif() - -if( APPLE ) - if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") - # suppress Clang warnings about empty loop bodies and deprecated declarations (tmpnam) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-empty-body -Wno-deprecated-declarations" ) - endif() -endif() - -# define the lua core source files -set (LUA_CORE_SRCS src/lapi.c src/lcode.c src/ldebug.c src/ldo.c src/ldump.c - src/lfunc.c src/lgc.c src/llex.c src/lmem.c src/lobject.c src/lopcodes.c - src/lparser.c src/lstate.c src/lstring.c src/ltable.c src/ltm.c src/lundump.c - src/lvm.c src/lzio.c) - -# define the lua lib source files -set (LUA_LIB_SRCS src/lauxlib.c src/lbaselib.c src/ldblib.c src/liolib.c - src/lmathlib.c src/loslib.c src/ltablib.c src/lstrlib.c src/loadlib.c src/linit.c) - -# create the library -add_library (lua ${LUA_LIB_SRCS} ${LUA_CORE_SRCS}) - -# create the lue executable and link it to the lib -add_executable (luaexec src/lua.c) -target_link_libraries (luaexec lua) - -# name the executable lua just like the library -set_target_properties(luaexec PROPERTIES OUTPUT_NAME lua) - -if ( UNIX ) - target_link_libraries ( luaexec m ) -endif() - -install ( TARGETS luaexec - RUNTIME DESTINATION ${LUA_INSTALL_RUNTIME_DIR} - LIBRARY DESTINATION ${LUA_INSTALL_LIBRARY_DIR} - ARCHIVE DESTINATION ${LUA_INSTALL_ARCHIVE_DIR} - ) diff --git a/utilities/SimpleRTK/SuperBuild/pcre_configure_step.cmake.in b/utilities/SimpleRTK/SuperBuild/pcre_configure_step.cmake.in deleted file mode 100644 index d77172cf5..000000000 --- a/utilities/SimpleRTK/SuperBuild/pcre_configure_step.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -# Set the important envirimental variables that auto-conf uses to -# configure, mostly these are passed from the CMake -# configuration. Others are just explicitly passed from the -# enviroment. If there is a problem with them in the future they can -# be addressed in CMake with the same structure. - -set(ENV{CC} "@CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_ARG1@") -set(ENV{CFLAGS} "@CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELEASE@") -set(ENV{LDFLAGS} "@CMAKE_LINKER_FLAGS@ @CMAKE_LINKER_FLAGS_RELEASE@") - -set(ENV{LIBS} "$ENV{LIBS}") - -set(ENV{CPP} "$ENV{CPP}") -set(ENV{CPPFLAGS} "$ENV{CPPFLAGS}") -set(ENV{CXXPP} "$ENV{CXXPP}") - -set(ENV{CXX} "@CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_ARG1@") -set(ENV{CXXFLAGS} "@CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELEASE@") - - -set(ENV{YACC} "@BISON_EXECUTABLE@" ) -set(ENV{YFLAGS} "@BISON_FLAGS@" ) - -execute_process( - COMMAND sh @pcre_source_dir@/configure --prefix=@pcre_install_dir@ --disable-shared - WORKING_DIRECTORY @pcre_binary_dir@ -) diff --git a/utilities/SimpleRTK/SuperBuild/swig_configure_step.cmake.in b/utilities/SimpleRTK/SuperBuild/swig_configure_step.cmake.in deleted file mode 100644 index 8a85b41c7..000000000 --- a/utilities/SimpleRTK/SuperBuild/swig_configure_step.cmake.in +++ /dev/null @@ -1,37 +0,0 @@ -# Set the important envirimental variables that auto-conf uses to -# configure, mostly these are passed from the CMake -# configuration. Others are just explicitly passed from the -# enviroment. If there is a problem with them in the future they can -# be addressed in CMake with the same structure. - -cmake_policy(SET CMP0012 NEW) - -set(ENV{CC} "@CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_ARG1@") -set(ENV{CFLAGS} "@CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELEASE@") -set(ENV{LDFLAGS} "@CMAKE_LINKER_FLAGS@ @CMAKE_LINKER_FLAGS_RELEASE@") - -set(ENV{LIBS} "$ENV{LIBS}") -set(ENV{CPP} "$ENV{CPP}") -set(ENV{CPPFLAGS} "$ENV{CPPFLAGS}") - -set(ENV{CXX} "@CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_ARG1@") -set(ENV{CXXFLAGS} "@CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELEASE@") - -set(ENV{YACC} "@BISON_EXECUTABLE@" ) -set(ENV{YFLAGS} "@BISON_FLAGS@" ) - -if(@USE_SWIG_FROM_GIT@) - execute_process( - COMMAND sh @swig_source_dir@/autogen.sh - WORKING_DIRECTORY @swig_source_dir@ - ) -endif() - -execute_process( - COMMAND sh @swig_source_dir@/configure - --prefix=@swig_install_dir@ - --with-pcre-prefix=@pcre_install_dir@ - --without-octave - --with-python=@PYTHON_EXECUTABLE@ - WORKING_DIRECTORY @swig_binary_dir@ -) diff --git a/utilities/SimpleRTK/TemplateComponents/AddExtraIncludes.cxx.in b/utilities/SimpleRTK/TemplateComponents/AddExtraIncludes.cxx.in deleted file mode 100644 index bc66bc6ad..000000000 --- a/utilities/SimpleRTK/TemplateComponents/AddExtraIncludes.cxx.in +++ /dev/null @@ -1,5 +0,0 @@ -$(if include_files and #include_files > 0 then -OUT = [[// Additional include files -$(for i=1,#include_files do OUT = OUT .. '#include "' .. include_files[i] .. '"' if i < #include_files then OUT = OUT .. '\n' end end) -// Done with additional include files]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/ClassDeclaration.h.in b/utilities/SimpleRTK/TemplateComponents/ClassDeclaration.h.in deleted file mode 100644 index 03ec4f3b3..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ClassDeclaration.h.in +++ /dev/null @@ -1,30 +0,0 @@ - /**\class ${name} -$(if briefdescription and (briefdescription:len() > 0) then OUT=[[\brief ${briefdescription}]] end) - -$(if detaileddescription and (detaileddescription:len() >0) then OUT=[[${detaileddescription}]] end) -$(if (not no_procedure) or (no_procedure == 1) then OUT=[[\sa itk::simple::${name:gsub("ImageFilter$", "")} for the procedural interface]] end) -$(if true then - OUT=[[\sa ]] - if itk_name and (itk_name:len() > 0) then - OUT=OUT..[[itk::${itk_name}]] - elseif filter_type and (filter_type:len() >0) then - OUT=OUT..[[${filter_type:gsub("%b<>", "")}]] - else - OUT=OUT..[[itk::${name}]] - end -OUT=OUT..[[ for the Doxygen on the original ITK class.]] -end) - */ - class SRTKBasicFilters_EXPORT ${name} : public $(if number_of_inputs then OUT=[[ImageFilter<${number_of_inputs}>]] else OUT=[[ImageFilter<1>]] end) { - public: - typedef ${name} Self; - - /** Default Constructor that takes no arguments and initializes - * default parameters */ - ${name}(); - - /** Destructor */ - ~${name}(); - - /** Define the pixels types supported by this filter */ - typedef ${pixel_types} PixelIDTypeList; diff --git a/utilities/SimpleRTK/TemplateComponents/ClassEnd.h.in b/utilities/SimpleRTK/TemplateComponents/ClassEnd.h.in deleted file mode 100644 index 2acb76020..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ClassEnd.h.in +++ /dev/null @@ -1 +0,0 @@ - }; diff --git a/utilities/SimpleRTK/TemplateComponents/ClassNameAndPrint.h.in b/utilities/SimpleRTK/TemplateComponents/ClassNameAndPrint.h.in deleted file mode 100644 index 904dfbcf5..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ClassNameAndPrint.h.in +++ /dev/null @@ -1,5 +0,0 @@ - /** Name of this class */ - std::string GetName() const { return std::string ("${name}"); } - - /** Print ourselves out */ - std::string ToString() const; diff --git a/utilities/SimpleRTK/TemplateComponents/ConstructorInitializeMembers.cxx.in b/utilities/SimpleRTK/TemplateComponents/ConstructorInitializeMembers.cxx.in deleted file mode 100644 index a83cc3628..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ConstructorInitializeMembers.cxx.in +++ /dev/null @@ -1,22 +0,0 @@ -$(if measurements then -temp=false -for i = 1,#measurements do - if measurements[i].active then - temp=true - else -OUT=OUT..'\ - this->m_'..measurements[i].name..' = '..measurements[i].default..';\ -' - end -end -if temp then -OUT=OUT..[[ - this->m_Filter = NULL;]] -end -end) -$(foreach members - $(if (default ~= nil) then -OUT = [[ - this->m_${name} = ${default}; -]] -end)) diff --git a/utilities/SimpleRTK/TemplateComponents/ConstructorMemberFunctionSetup.cxx.in b/utilities/SimpleRTK/TemplateComponents/ConstructorMemberFunctionSetup.cxx.in deleted file mode 100644 index 89b0bc0d7..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ConstructorMemberFunctionSetup.cxx.in +++ /dev/null @@ -1,9 +0,0 @@ - this->m_MemberFactory.reset( new detail::MemberFunctionFactory( this ) ); - -$(if custom_register then - OUT=' ${custom_register}' -else -OUT = [[ - this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > (); -]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/ConstructorSignature.cxx.in b/utilities/SimpleRTK/TemplateComponents/ConstructorSignature.cxx.in deleted file mode 100644 index 3b278b808..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ConstructorSignature.cxx.in +++ /dev/null @@ -1 +0,0 @@ -${name}::${name} () diff --git a/utilities/SimpleRTK/TemplateComponents/ConstructorVectorPixels.cxx.in b/utilities/SimpleRTK/TemplateComponents/ConstructorVectorPixels.cxx.in deleted file mode 100644 index 05a76f77d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ConstructorVectorPixels.cxx.in +++ /dev/null @@ -1,6 +0,0 @@ - $(if vector_pixel_types_by_component then - OUT=[[ typedef ${vector_pixel_types_by_component} VectorByComponentsPixelIDTypeList; - typedef detail::ExecuteInternalVectorImageAddressor VectorAddressorType; - this->m_MemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, 3, VectorAddressorType> (); - this->m_MemberFactory->RegisterMemberFunctions< VectorByComponentsPixelIDTypeList, 2, VectorAddressorType> ();]] - end) diff --git a/utilities/SimpleRTK/TemplateComponents/CustomCasts.cxx b/utilities/SimpleRTK/TemplateComponents/CustomCasts.cxx deleted file mode 100644 index 15ec3200f..000000000 --- a/utilities/SimpleRTK/TemplateComponents/CustomCasts.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// -// Custom Casts -// -namespace { -$(when measurements $(foreach measurements -$(if active and ( custom_cast or label_map ) then -OUT=[[ -template -struct ${name}CustomCast -{ -]] -if custom_cast then -OUT=OUT..[[ - template - static ${type} Helper( const T & value ) { return ${custom_cast}; } -]] -end -OUT=OUT..[[ - - static ${type} CustomCast( const FilterType *f]] -if parameters then - for inum=1,#parameters do - OUT=OUT..', '..parameters[inum].type..' '..parameters[inum].name - end -end -OUT=OUT..[[ ) - { - return ]] -if custom_cast then - OUT=OUT..[[${name}CustomCast::Helper(]] -end -if label_map then - OUT=OUT..[[f->GetOutput()->GetLabelObject(label)->Get${name}()]] -else - OUT=OUT..[[f->Get${name}(${parameters[1].name})]] -end -if custom_cast then - OUT=OUT..')' -end -OUT=OUT..';'..[[ - - } -}; -]] - end))) -} diff --git a/utilities/SimpleRTK/TemplateComponents/CustomMethods.cxx.in b/utilities/SimpleRTK/TemplateComponents/CustomMethods.cxx.in deleted file mode 100644 index 47a119382..000000000 --- a/utilities/SimpleRTK/TemplateComponents/CustomMethods.cxx.in +++ /dev/null @@ -1,25 +0,0 @@ -$(if custom_methods and #custom_methods > 0 then -OUT = [[ - -// -// Custom Methods -// -]] -for i=1,#custom_methods do - OUT=OUT..'\n' - OUT=OUT..custom_methods[i].return_type..[[ ${name}::]]..custom_methods[i].name..'(' - if custom_methods[i].parameters then - for pnum=1,#custom_methods[i].parameters do - if not pnum == 1 then - OUT=OUT..', ' - end - OUT=OUT..custom_methods[i].parameters[pnum].type ..' '.. custom_methods[i].parameters[pnum].var_name - end - end - OUT=OUT..[[ ) -{ - ]]..custom_methods[i].body..[[ - -} -]] -end end) diff --git a/utilities/SimpleRTK/TemplateComponents/CustomMethods.h.in b/utilities/SimpleRTK/TemplateComponents/CustomMethods.h.in deleted file mode 100644 index 31a71049a..000000000 --- a/utilities/SimpleRTK/TemplateComponents/CustomMethods.h.in +++ /dev/null @@ -1,19 +0,0 @@ -$(if custom_methods and #custom_methods > 0 then -OUT=OUT..'\n' -for i=1,#custom_methods do - OUT=OUT..'\n' - if custom_methods[i].doc then - OUT=OUT..' /** '..custom_methods[i].doc..' */\n' - end - OUT=OUT..' '..custom_methods[i].return_type..' '..custom_methods[i].name..'(' - if custom_methods[i].parameters then - for pnum=1,#custom_methods[i].parameters do - if not pnum == 1 then - OUT=OUT..', ' - end - OUT=OUT..custom_methods[i].parameters[pnum].type ..' '.. custom_methods[i].parameters[pnum].var_name - end - end - OUT=OUT..[[ ); -]] -end end) diff --git a/utilities/SimpleRTK/TemplateComponents/DesctuctorDefinition.cxx.in b/utilities/SimpleRTK/TemplateComponents/DesctuctorDefinition.cxx.in deleted file mode 100644 index 7198e2612..000000000 --- a/utilities/SimpleRTK/TemplateComponents/DesctuctorDefinition.cxx.in +++ /dev/null @@ -1,22 +0,0 @@ -// -// Destructor -// -${name}::~${name} () -{ -$(if measurements then -temp=false -for i = 1,#measurements do - if measurements[i].active then - temp=true - end -end -if temp then -OUT=[[ - if (this->m_Filter != NULL) - { - m_Filter->UnRegister(); - } -]] -end -end) -} diff --git a/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.cxx.in b/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.cxx.in deleted file mode 100644 index 29ecc507f..000000000 --- a/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.cxx.in +++ /dev/null @@ -1,5 +0,0 @@ -/* - * WARNING: DO NOT EDIT THIS FILE! - * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. - * Please look at srtkImageFilterTemplate.cxx.in to make changes. - */ diff --git a/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.h.in b/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.h.in deleted file mode 100644 index bd1951da6..000000000 --- a/utilities/SimpleRTK/TemplateComponents/DoNotEditWarning.h.in +++ /dev/null @@ -1,5 +0,0 @@ -/* - * WARNING: DO NOT EDIT THIS FILE! - * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. - * Please look at srtk${template_code_filename}Template.h.in to make changes. - */ diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalGetImagePointers.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalGetImagePointers.cxx.in deleted file mode 100644 index 6a33bcbb3..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalGetImagePointers.cxx.in +++ /dev/null @@ -1,9 +0,0 @@ -$(if number_of_inputs > 0 then -OUT=[[ - // Get the pointer to the ITK image contained in image1 - typename InputImageType::ConstPointer image1 = this->CastImageToITK( inImage1 ); -]] end)$(for nimg=2,number_of_inputs do -OUT = OUT .. ' // Get the a pointer to the ITK image contained in image' .. nimg .. '\n' -OUT = OUT .. ' typename InputImageType' .. nimg .. '::ConstPointer image' .. nimg .. ' =' - .. ' this->CastImageToITK( inImage' .. nimg .. ' );\n' -end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalITKFilter.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalITKFilter.cxx.in deleted file mode 100644 index 54e2acf6b..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalITKFilter.cxx.in +++ /dev/null @@ -1,18 +0,0 @@ - $(if filter_type then - OUT=[[typedef ${filter_type} FilterType;]] - else - if itk_name then - OUT=[[typedef itk::${itk_name} FilterType;]] - end) - // Set up the filter - typename FilterType::Pointer filter = FilterType::New(); diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalMethod.h.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalMethod.h.in deleted file mode 100644 index c7fa0b19e..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalMethod.h.in +++ /dev/null @@ -1,15 +0,0 @@ - private: - - /** Setup for member function dispatching */ - - typedef Image (Self::*MemberFunctionType)( $(include ImageParameters.in)$(include InputParametersInternal.in) ); - template Image ExecuteInternal ( $(include ImageParameters.in)$(include InputParametersInternal.in) ); - -$(if vector_pixel_types_by_component then - if number_of_inputs > 1 then - throw 'number_of_inputs must be 1 to use vector_pixel_types_by_component' - end -OUT=[[ - /** Dispatched methods which calls ExecuteInteral on each component */ - template Image ExecuteInternalVectorImage ( const Image& image );]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterInputs.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterInputs.cxx.in deleted file mode 100644 index b2070ecce..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterInputs.cxx.in +++ /dev/null @@ -1,37 +0,0 @@ -$(if custom_set_input then -OUT=' ${custom_set_input}' - else - for nimg=1,number_of_inputs do -OUT= OUT .. 'filter->SetInput( ' .. nimg-1 .. ', image' .. nimg ..' );\n' -end -end) -$(if inputs then -for i = 1,#inputs do - if inputs[i].optional then - OUT = OUT .. ' if ( in'..inputs[i].name..' != NULL )\ {\n ' - else - OUT = OUT .. ' assert( '..'in' .. inputs[i].name ..' != NULL );\n' - end - OUT = OUT .. ' ' - if inputs[i].custom_itk_cast then - OUT = OUT..inputs[i].custom_itk_cast..'\n' - elseif inputs[i].type == "Image" then - local input_type = 'typename FilterType::InputImageType' - if i ~= 1 then - input_type = 'typename FilterType::'..inputs[i].name..'Type' - end - OUT = OUT .. input_type .. '::ConstPointer image'..i..' = this->CastImageToITK<'..input_type..'>( *in' .. inputs[i].name ..' );\n' - if i == 1 then - OUT = OUT .. ' filter->SetInput( image1 );\n' - else - OUT = OUT .. ' filter->Set'..inputs[i].name..'( '..'image' .. i .. ' );\n' - end - else - OUT = OUT..'filter->Set'..inputs[i].name..'( '..'in' .. inputs[i].name ..' );\n' - end - if inputs[i].optional then - OUT = OUT .. ' }\n' - end -end -end) -$(include ExecuteInternalSetITKFilterParameters.cxx.in) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterParameters.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterParameters.cxx.in deleted file mode 100644 index b6569f5a3..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSetITKFilterParameters.cxx.in +++ /dev/null @@ -1,16 +0,0 @@ - -$(foreach members -$(if custom_itk_cast then -OUT = ' ${custom_itk_cast}' -elseif dim_vec and dim_vec == 1 then - OUT = [[ - ${itk_type} itkVec${name} = srtkSTLVectorToITK<${itk_type}>( this->Get${name}() ); - filter->Set${name}( itkVec${name} );]] -elseif pixeltype then - OUT = ' filter->Set${name} ( static_cast< typename ${pixeltype}ImageType::PixelType> ( this->m_${name} ) );' -elseif enum then - OUT = ' filter->Set${name} ( ${itk_type} ( int( this->m_${name} ) ) );' -else - OUT = ' filter->Set${name} ( this->m_${name} );' -end) -) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSignature.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSignature.cxx.in deleted file mode 100644 index 7edcec275..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalSignature.cxx.in +++ /dev/null @@ -1,23 +0,0 @@ -template -Image ${name}::ExecuteInternal ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT.. ', ' - end - OUT= OUT .. 'const Image& inImage' .. inum -end )$(if inputs then -for i = 1,#inputs do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - if not inputs[i].type and inputs[i].enum then - OUT = OUT .. name .. '::' .. inputs[i].name .. 'Type' - elseif inputs[i].dim_vec and (inputs[i].dim_vec == 1) then - OUT = OUT..'const std::vector<'..inputs[i].type..'> *' - elseif inputs[i].point_vec and (inputs[i].point_vec == 1) then - OUT = OUT..'const std::vector< std::vector<'..inputs[i].type..'> > *' - else - OUT = OUT .. 'const ' .. inputs[i].type .. ' *' - end - OUT = OUT .. ' in' .. inputs[i].name -end -end) ) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalTypedefs.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalTypedefs.cxx.in deleted file mode 100644 index 4dc2e022a..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalTypedefs.cxx.in +++ /dev/null @@ -1,21 +0,0 @@ -$(if (number_of_inputs) > 0 or (inputs and #inputs > 0 ) then -OUT=[[ - // Define the input and output image types - typedef TImageType InputImageType; - ]] end) -$(for nimg=2,number_of_inputs do -OUT=OUT .. ' typedef TImageType InputImageType' .. nimg .. ';\n' - end) - $(if output_image_type then - OUT=[[//Define output image type - typedef ${output_image_type} OutputImageType;]] - elseif output_pixel_type then - OUT=[[// Define output image type -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#else - typedef itk::Image< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#endif]] - else - OUT=[[typedef InputImageType OutputImageType;]] - end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalUpdateAndReturn.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalUpdateAndReturn.cxx.in deleted file mode 100644 index 7b0f5e9f8..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalUpdateAndReturn.cxx.in +++ /dev/null @@ -1,68 +0,0 @@ - -$(if measurements then -temp=false -for i = 1,#measurements do - if measurements[i].active then - temp=true - end -end -if temp then -OUT=OUT..[[ - - // release the old filter ( and output data ) - if ( this->m_Filter != NULL) - { - this->m_Filter->UnRegister(); - this->m_Filter = NULL; - } - - this->m_Filter = filter; - this->m_Filter->Register(); -]] -end - end) - - this->PreUpdate( filter.GetPointer() ); - -$(if measurements then -for i = 1,#measurements do - if measurements[i].active then - OUT=OUT..' this->m_pfGet'..measurements[i].name..' = nsstd::bind(' - if measurements[i].custom_cast or measurements[i].label_map then - OUT=OUT..'&'..measurements[i].name..'CustomCast::CustomCast' - else - OUT=OUT..'&FilterType::Get'..measurements[i].name - end - OUT=OUT..', filter.GetPointer()' - if measurements[i].parameters then - for inum=1,#measurements[i].parameters do - OUT=OUT..", nsstd::placeholders::_"..inum - end - end - OUT=OUT..' );\ -' - end -end -end) - - // Run the ITK filter and return the output as a SimpleRTK image - filter->Update(); - -$(when measurements $(foreach measurements -$(if not active and custom_itk_cast then - OUT=[[ ${custom_itk_cast}]] -elseif not active then - OUT=[[ this->m_${name} = filter->Get${name}();]] -end))) - -$(if no_return_image then -OUT=[[ - return Image(); -]] -else -OUT=[[ - typename FilterType::OutputImageType *itkOutImage = filter->GetOutput(); - this->FixNonZeroIndex( itkOutImage ); - return Image( this->CastITKToImage(itkOutImage) ); -]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalVectorImages.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteInternalVectorImages.cxx.in deleted file mode 100644 index 382ed5ac2..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteInternalVectorImages.cxx.in +++ /dev/null @@ -1,71 +0,0 @@ -$(if vector_pixel_types_by_component then -OUT=[[ -// -// Dispatched methods to call ExecuteInternal on each component of the VectorImage -// -template Image -${name}::ExecuteInternalVectorImage ( const Image& inImage1 ) -{ - typedef TImageType VectorInputImageType; - typedef typename VectorInputImageType::InternalPixelType ComponentType; -#ifdef RTK_USE_CUDA - typedef typename itk::CudaImage ComponentImageType; -#else - typedef typename itk::Image ComponentImageType; -#endif - - // we must define the input and output image types should be the - // same as the scalar execute internal method - typedef ComponentImageType InputImageType; -]] -if output_image_type then -OUT=OUT..[[ - //Define output image type - typedef ${output_image_type} OutputImageType;]] -elseif output_pixel_type then -OUT=OUT..[[ - // Define output image type -#ifdef RTK_USE_CUDA - typedef itk::CudaImage< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#else - typedef itk::Image< ${output_pixel_type}, InputImageType::ImageDimension > OutputImageType; -#endif]] -else - OUT=OUT..[[ - // Define output image type - typedef InputImageType OutputImageType;]] -end - -OUT=OUT..[[ - - // Get the pointer to the ITK image contained in image1 - typename VectorInputImageType::ConstPointer image1 = - this->CastImageToITK( inImage1 ); - - typedef itk::VectorIndexSelectionCastImageFilter< VectorInputImageType, ComponentImageType > ComponentExtratorType; - typename ComponentExtratorType::Pointer extractor = ComponentExtratorType::New(); - extractor->SetInput( image1 ); - - typedef itk::ComposeImageFilter ToVectorFilterType; - typename ToVectorFilterType::Pointer toVector = ToVectorFilterType::New(); - - unsigned int numComps = image1->GetNumberOfComponentsPerPixel(); - for ( unsigned int i = 0; i < numComps; ++i ) - { - extractor->SetIndex( i ); - extractor->Update(); - - Image tmp = this->ExecuteInternal( Image( extractor->GetOutput() ) ); - - typename OutputImageType::ConstPointer tempITKImage = this->CastImageToITK( tmp ); - - toVector->SetInput( i, tempITKImage ); - } - - toVector->Update(); - - return Image( toVector->GetOutput() ); -} - -//----------------------------------------------------------------------------- -]]end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteMethodNoParameters.h.in b/utilities/SimpleRTK/TemplateComponents/ExecuteMethodNoParameters.h.in deleted file mode 100644 index 90ce97e65..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteMethodNoParameters.h.in +++ /dev/null @@ -1,15 +0,0 @@ -$(if inputs then - for i =1,#inputs do - if inputs[i].optional then - has_optional_inputs=inputs[i].optional - end - end - end -) - /** Execute the filter on the input image$(if number_of_inputs == 2 then OUT=[[s]]end) */ - Image Execute ( $(include ImageParameters.in)$(include InputParameters.in) ); -$(if has_optional_inputs then - no_optional=1 - OUT=[[ Image Execute ( $(include ImageParameters.in)$(include InputParameters.in) ); -]] -end)$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteMethodWithParameters.h.in b/utilities/SimpleRTK/TemplateComponents/ExecuteMethodWithParameters.h.in deleted file mode 100644 index 0b63c18b0..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteMethodWithParameters.h.in +++ /dev/null @@ -1,15 +0,0 @@ -$(if members and #members > 0 then -OUT=[[ - - - /** Execute the filter on the input image$(if number_of_inputs == 2 then OUT='s'end) with the given parameters */ - Image Execute ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParameters.in) );]] -end)$(if members and #members > 0 then - if has_optional_inputs then - no_optional=1 - OUT=OUT..[[ - - Image Execute ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParameters.in) );]] - end -end) -$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteNoParameters.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteNoParameters.cxx.in deleted file mode 100644 index 8f1f00035..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteNoParameters.cxx.in +++ /dev/null @@ -1,68 +0,0 @@ -Image ${name}::Execute ( $(include ImageParameters.in)$(include InputParameters.in) ) -{ -$(if true then -local inputName = "image1" -if not (number_of_inputs > 0) and (#inputs > 0) then - inputName = inputs[1].name:sub(1,1):lower() .. inputs[1].name:sub(2,-1) -end -OUT=[[ - PixelIDValueEnum type = ]]..inputName..[[.GetPixelID(); - unsigned int dimension = ]]..inputName..[[.GetDimension(); -]] -for inum=2,number_of_inputs do - OUT= OUT .. '\n if ( type != image' .. inum .. '.GetPixelIDValue() || dimension != image' .. inum .. '.GetDimension() ) { srtkExceptionMacro ( "Image' .. inum .. ' for ${name} doesnt match type or dimension!" ); }' -end -if inputs then - for inum=2,#inputs do - if not inputs[inum].optional or not no_optional then - local currentInputName = inputs[inum].name:sub(1,1):lower()..inputs[inum].name:sub(2,-1) - OUT=OUT..[[ - - // todo need better error handling and potential type conversion - if ( ]]..inputName..[[.GetDimension() != ]]..currentInputName..[[.GetDimension()]] - if not inputs[inum].no_size_check then - OUT=OUT..[[ || - ]]..inputName..[[.GetSize() != ]]..currentInputName..[[.GetSize()]] - end - OUT=OUT..[[ ) - { - srtkExceptionMacro ( "Input image ]]..currentInputName..[[ does not match dimension or size of first image!" ); - } -]] - end - end -end -end) - return this->m_MemberFactory->GetMemberFunction( type, dimension )( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT .. ', ' - end - OUT= OUT .. 'image' .. inum - end - if inputs then - for inum=1,#inputs do - if number_of_inputs>0 or inum>1 then - OUT = OUT .. ", " - end - if inputs[inum].optional and no_optional then - OUT=OUT.."NULL" - else - OUT=OUT.."&"..inputs[inum].name:sub(1,1):lower() .. inputs[inum].name:sub(2,-1) - end - end - end) ); -} -$(if inputs then - local has_optional_inputs = false - for i =1,#inputs do - if inputs[i].optional then - has_optional_inputs=inputs[i].optional - end - end - if has_optional_inputs and not no_optional then - no_optional=1 --- we recusively include this same template file but with the no_optional variable defined - OUT=[[ -$(include ExecuteNoParameters.cxx.in)]] - end -end)$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/ExecuteWithParameters.cxx.in b/utilities/SimpleRTK/TemplateComponents/ExecuteWithParameters.cxx.in deleted file mode 100644 index c597b093c..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ExecuteWithParameters.cxx.in +++ /dev/null @@ -1,45 +0,0 @@ -$(if members and #members > 0 then -OUT = [[ - -Image ${name}::Execute ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParameters.in) ) -{ -$(foreach members -$(if (not no_set_method) or (no_set_method == 0) then -OUT = ' this->Set${name} ( ${name:sub(1,1):lower() .. name:sub(2,-1)} );' -end) -) - return this->Execute ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT.. ', ' - end - OUT= OUT .. 'image' .. inum - end - if inputs then - local count = number_of_inputs - for inum=1,#inputs do - if not (inputs[inum].optional and no_optional) then - if count>0 then - OUT = OUT .. ", " - end - count = count + 1 - OUT=OUT..inputs[inum].name:sub(1,1):lower() .. inputs[inum].name:sub(2,-1) - end - end - end -) ); -} -]] -end) -$(if inputs then - local has_optional_inputs = false - for i =1,#inputs do - if inputs[i].optional then - has_optional_inputs=inputs[i].optional - end - end - if has_optional_inputs and not no_optional then - no_optional=1 --- we recusively include this same template file but with the no_optional variable defined - OUT=[[$(include ExecuteWithParameters.cxx.in)]] - end -end)$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.cxx.in b/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.cxx.in deleted file mode 100644 index f1431b36d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.cxx.in +++ /dev/null @@ -1,49 +0,0 @@ -$(if (not no_procedure) or (no_procedure == 1) then -OUT=[[ -// -// Function to run the Execute method of this filter -// -Image ${name:gsub("ImageFilter$", ""):gsub("Filter$", "")} ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParameters.in) ) -{ - ${name} filter; - return filter.Execute ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT..', ' - end - OUT=OUT .. 'image' .. inum - end - local count = number_of_inputs - if inputs then - for inum=1,#inputs do - if not (inputs[inum].optional and no_optional) then - if count>0 then - OUT = OUT .. ", " - end - count = count + 1 - OUT=OUT..inputs[inum].name:sub(1,1):lower() .. inputs[inum].name:sub(2,-1) - end - end - end - for i = 1,#members do - if count > 0 then - OUT = OUT .. ", " - end - count = count + 1 - OUT= OUT .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) - end) ); -} -]] -end)$(if inputs and ((not no_procedure) or (no_procedure == 1))then - local has_optional_inputs = false - for i =1,#inputs do - if inputs[i].optional then - has_optional_inputs=inputs[i].optional - end - end - if has_optional_inputs and not no_optional then - no_optional=1 --- we recusively include this same template file but with the no_optional variable defined - OUT=[[ -$(include FunctionalAPI.cxx.in)]] - end -end)$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.h.in b/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.h.in deleted file mode 100644 index d07c1a62d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/FunctionalAPI.h.in +++ /dev/null @@ -1,24 +0,0 @@ -$(if (not no_procedure) or (no_procedure == 1) then -OUT='\ - /**\ -' -if briefdescription and (briefdescription:len() > 0) then - OUT=OUT..' * \\brief ${briefdescription}' -else - OUT=OUT..' * \\brief itk::simple::${name} Procedural Interface' -end -OUT=OUT..[[ - - * - * This function directly calls the execute method of ${name} - * in order to support a procedural API - * - * \sa itk::simple::${name} for the object oriented interface - */ - SRTKBasicFilters_EXPORT Image ${name:gsub("ImageFilter$", ""):gsub("Filter$", "")} ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParametersWithDefaults.in) ); -]] -end)$(if has_optional_inputs and ((not no_procedure) or (no_procedure == 1)) then - no_optional=1 - OUT=OUT..[[ - SRTKBasicFilters_EXPORT Image ${name:gsub("ImageFilter$", ""):gsub("Filter$", "")} ( $(include ImageParameters.in)$(include InputParameters.in)$(include MemberParametersWithDefaults.in) );]] -end)$(if inputs then no_optional=nil end) diff --git a/utilities/SimpleRTK/TemplateComponents/ImageParameters.in b/utilities/SimpleRTK/TemplateComponents/ImageParameters.in deleted file mode 100644 index cd2f502c7..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ImageParameters.in +++ /dev/null @@ -1,6 +0,0 @@ -$(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT.. ', ' - end - OUT= OUT .. 'const Image& image' .. inum - end ) diff --git a/utilities/SimpleRTK/TemplateComponents/InputParameters.in b/utilities/SimpleRTK/TemplateComponents/InputParameters.in deleted file mode 100644 index 06de83d0d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/InputParameters.in +++ /dev/null @@ -1,21 +0,0 @@ -$(if inputs then -local count=1 -for i = 1,#inputs do - if not (inputs[i].optional and no_optional) then - if (number_of_inputs > 0 or count > 1) then - OUT = OUT .. ", " - end - count = count + 1 - if not inputs[i].type and inputs[i].enum then - OUT = OUT .. name .. '::' .. inputs[i].name .. 'Type' - elseif inputs[i].dim_vec and (inputs[i].dim_vec == 1) then - OUT = OUT..'const std::vector<'..inputs[i].type..'> &' - elseif inputs[i].point_vec and (inputs[i].point_vec == 1) then - OUT = OUT..'const std::vector< std::vector<'..inputs[i].type..'> > &' - else - OUT = OUT .. 'const ' .. inputs[i].type .. ' &' - end - OUT = OUT .. ' ' .. inputs[i].name:sub(1,1):lower() .. inputs[i].name:sub(2,-1) - end -end -end) diff --git a/utilities/SimpleRTK/TemplateComponents/InputParametersInternal.in b/utilities/SimpleRTK/TemplateComponents/InputParametersInternal.in deleted file mode 100644 index 5a3839f15..000000000 --- a/utilities/SimpleRTK/TemplateComponents/InputParametersInternal.in +++ /dev/null @@ -1,17 +0,0 @@ -$(if inputs then -for i = 1,#inputs do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - if not inputs[i].type and inputs[i].enum then - OUT = OUT .. name .. '::' .. inputs[i].name .. 'Type' - elseif inputs[i].dim_vec and (inputs[i].dim_vec == 1) then - OUT = OUT..'const std::vector<'..inputs[i].type..'> *' - elseif inputs[i].point_vec and (inputs[i].point_vec == 1) then - OUT = OUT..'const std::vector< std::vector<'..inputs[i].type..'> > *' - else - OUT = OUT .. 'const ' .. inputs[i].type .. ' *' - end - OUT = OUT .. ' ' .. inputs[i].name:sub(1,1):lower() .. inputs[i].name:sub(2,-1) -end -end) diff --git a/utilities/SimpleRTK/TemplateComponents/MemberFunctionDispatch.h.in b/utilities/SimpleRTK/TemplateComponents/MemberFunctionDispatch.h.in deleted file mode 100644 index 2f303b5d0..000000000 --- a/utilities/SimpleRTK/TemplateComponents/MemberFunctionDispatch.h.in +++ /dev/null @@ -1,5 +0,0 @@ - friend struct detail::MemberFunctionAddressor; -$(if vector_pixel_types_by_component then -OUT=[[ friend struct detail::ExecuteInternalVectorImageAddressor;]] -end) - nsstd::auto_ptr > m_MemberFactory; diff --git a/utilities/SimpleRTK/TemplateComponents/MemberGetSetDeclarations.h.in b/utilities/SimpleRTK/TemplateComponents/MemberGetSetDeclarations.h.in deleted file mode 100644 index 4794d1ed2..000000000 --- a/utilities/SimpleRTK/TemplateComponents/MemberGetSetDeclarations.h.in +++ /dev/null @@ -1,126 +0,0 @@ -$(foreach members -$(if enum then - OUT=OUT..'\ -\ - typedef enum {' - for i = 1,#enum do - if( i > 1) then - OUT=OUT..',' - end - OUT=OUT..enum[i] - end - if type then - OUT=OUT..'} ${type};' - else - OUT=OUT..'} ${name}Type;' - end -end) -$(if (not no_set_method) or (no_set_method == 0) then - OUT = '\ - /**' - if briefdescriptionSet and (briefdescriptionSet:len() > 0) then - OUT=OUT .. '\ - * \\brief ${briefdescriptionSet}' - end - if detaileddescriptionSet and (detaileddescriptionSet:len() > 0) then - OUT=OUT .. '\ - * ${detaileddescriptionSet}' - end - OUT= OUT .. '\ - */\ - SRTK_RETURN_SELF_TYPE_HEADER Set${name} (' - if not type and enum then - OUT=OUT..' ${name}Type' - elseif dim_vec and (dim_vec == 1) then - OUT=OUT..' const std::vector<${type}> &' - elseif point_vec and (point_vec == 1) then - OUT=OUT..' const std::vector< std::vector<${type}> >&' - else - OUT=OUT..' ${type}' - end - OUT=OUT..' ${name} ) { this->m_${name} = ${name}; return *this; }' - if dim_vec and ( set_as_scalar == 1 ) then - OUT = OUT .. '\ -\ - /** Set the values of the ${name} vector all to value */\ - SRTK_RETURN_SELF_TYPE_HEADER Set${name}( ${type} value ) { this->m_${name} = std::vector<${type}>(3, value); return *this; }\ -' - end - if type == "bool" and ( not dim_vec or not dim_vec == 1 ) then - OUT = OUT .. '\ -\ - /** Set the value of ${name} to true or false respectfully. */\ - SRTK_RETURN_SELF_TYPE_HEADER ${name}On() { return this->Set${name}(true); }\ - SRTK_RETURN_SELF_TYPE_HEADER ${name}Off() { return this->Set${name}(false); }' - end -end) -$(if (not no_get_method) or (no_get_method == 0) then - OUT = '\ - /**' - if briefdescriptionGet and (briefdescriptionGet:len() > 0) then - OUT=OUT .. '\ - * \\brief ${briefdescriptionGet}' - end - if detaileddescriptionGet and (detaileddescriptionGet:len() > 0) then - OUT=OUT .. '\ - * ${detaileddescriptionGet}' - end - OUT= OUT .. '\ - */\ - ' - if not type and enum then - OUT=OUT..' ${name}Type' - elseif dim_vec and (dim_vec == 1) then - OUT=OUT..' std::vector<${type}>' - elseif point_vec and (point_vec == 1) then - OUT=OUT..' std::vector< std::vector >' - else - OUT=OUT..' ${type}' - end - OUT=OUT..' Get${name}() const { return this->m_${name}; }' -end)$(if point_vec and (point_vec == 1) then - OUT=[[ - - /** \brief Add ${name} point */ - SRTK_RETURN_SELF_TYPE_HEADER Add${name:gsub("s([0-9]?)$","%1")}( const std::vector< ${type} > &point ) { this->m_${name}.push_back(point); return *this;} - /** \brief Remove all ${name} points */ - SRTK_RETURN_SELF_TYPE_HEADER Clear${name}( ) { this->m_${name}.clear(); return *this;} -]] -end))$(when measurements $(foreach measurements - - /**$(if briefdescriptionGet and (briefdescriptionGet:len() > 0) then OUT=[[ \brief ${briefdescriptionGet}]]end) - *$(if detaileddescriptionGet and (detaileddescriptionGet:len() > 0) then OUT =[[ ${detaileddescriptionGet}]]end) - * -$(if active then -OUT=[[ - * This is an active measurement. It may be accessed while the - * filter is being executing in command call-backs and can be - * accessed after execution. -]] -else -OUT=[[ - * This is a measurement. Its value is updated in the Execute - * methods, so the value will only be valid after an execution. -]] -end) */ -$(if active then -OUT=[[ - ${type} Get${name}($(if parameters then -for inum=1,#parameters do - if inum>1 then - OUT = OUT .. ', ' - end - OUT = OUT .. parameters[inum].type .. ' ' .. parameters[inum].name -end end)) const { return this->m_pfGet${name}($(if parameters then -for inum=1,#parameters do - if inum>1 then - OUT = OUT .. ', ' - end - OUT = OUT .. parameters[inum].name -end end)); }; -]] -else -OUT=[[ - ${type} Get${name}() const { return this->m_${name}; }; -]] -end))) diff --git a/utilities/SimpleRTK/TemplateComponents/MemberParameters.in b/utilities/SimpleRTK/TemplateComponents/MemberParameters.in deleted file mode 100644 index 3d50f6838..000000000 --- a/utilities/SimpleRTK/TemplateComponents/MemberParameters.in +++ /dev/null @@ -1,19 +0,0 @@ -$(for i = 1,#members do - temp = number_of_inputs - if inputs then - temp = temp + #inputs - end - if (temp > 0 or i > 1) then - OUT = OUT .. ", " - end - if not members[i].type and members[i].enum then - OUT = OUT .. name .. '::' .. members[i].name .. 'Type' - elseif members[i].dim_vec and (members[i].dim_vec == 1) then - OUT = OUT..'const std::vector<'..members[i].type..'> &' - elseif members[i].point_vec and (members[i].point_vec == 1) then - OUT = OUT..'const std::vector< std::vector<'..members[i].type..'> > &' - else - OUT = OUT .. members[i].type - end - OUT = OUT .. ' ' .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) -end) diff --git a/utilities/SimpleRTK/TemplateComponents/MemberParametersWithDefaults.in b/utilities/SimpleRTK/TemplateComponents/MemberParametersWithDefaults.in deleted file mode 100644 index 98e60c8af..000000000 --- a/utilities/SimpleRTK/TemplateComponents/MemberParametersWithDefaults.in +++ /dev/null @@ -1,23 +0,0 @@ -$(for i = 1,#members do - local count = number_of_inputs - if inputs then - for j = 1,#inputs do - if not (inputs[j].optional and no_optional) then - count = count + 1 - end - end - end - if (count > 0 or i > 1) then - OUT = OUT .. ", " - end - if not type and members[i].enum then - OUT = OUT .. name .. '::' .. members[i].name .. 'Type' - elseif members[i].dim_vec and (members[i].dim_vec == 1) then - OUT = OUT..'const std::vector<'..members[i].type..'> &' - elseif members[i].point_vec and (members[i].point_vec == 1) then - OUT = OUT..'const std::vector< std::vector<'..members[i].type..'> > &' - else - OUT = OUT .. members[i].type - end - OUT= OUT .." ".. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) .. " = " .. members[i].default -end) diff --git a/utilities/SimpleRTK/TemplateComponents/MemberPointsGetSetDeclarations.h.in b/utilities/SimpleRTK/TemplateComponents/MemberPointsGetSetDeclarations.h.in deleted file mode 100644 index e69de29bb..000000000 diff --git a/utilities/SimpleRTK/TemplateComponents/PrivateMemberDeclarations.h.in b/utilities/SimpleRTK/TemplateComponents/PrivateMemberDeclarations.h.in deleted file mode 100644 index 2ec985d4d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/PrivateMemberDeclarations.h.in +++ /dev/null @@ -1,53 +0,0 @@ -$(for i = 1,#members do -if members[i].doc then -OUT=OUT..'\ - /* '..members[i].doc..' */' -end -OUT=OUT..'\ - ' -if not members[i].type and members[i].enum then - OUT=OUT..members[i].name..'Type' -elseif members[i].dim_vec and (members[i].dim_vec == 1) then - OUT=OUT..'std::vector<'..members[i].type..'>' -elseif members[i].point_vec and (members[i].point_vec == 1) then - OUT=OUT..'std::vector< std::vector<'..members[i].type..'> >' -else - OUT=OUT..members[i].type -end -OUT=OUT..' m_'..members[i].name..';' - -end)$(when measurements - -$(foreach measurements -$(if doc then -OUT=[[ - /* ${doc} */]]end) -$(if active then -OUT=[[ - nsstd::function<${type}($(if parameters then -for inum=1,#parameters do - if inum>1 then - OUT = OUT .. ', ' - end - OUT = OUT .. parameters[inum].type -end end))> m_pfGet${name}; -]] - else -OUT=[[ - ${type} m_${name}; -]] -end))) -$(if measurements then -temp=false -for i = 1,#measurements do - if measurements[i].active then - temp=true - end -end -if temp then -OUT=[[ - // Holder of process object for active measurements - itk::ProcessObject *m_Filter; -]] -end -end) diff --git a/utilities/SimpleRTK/TemplateComponents/PublicDeclarations.h.in b/utilities/SimpleRTK/TemplateComponents/PublicDeclarations.h.in deleted file mode 100644 index 75df02335..000000000 --- a/utilities/SimpleRTK/TemplateComponents/PublicDeclarations.h.in +++ /dev/null @@ -1,5 +0,0 @@ -$(if public_declarations then - OUT=[[ - /** Custom public declarations */ - ${public_declarations} -]]end) diff --git a/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.cxx.in b/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.cxx.in deleted file mode 100644 index 2bfa55e39..000000000 --- a/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.cxx.in +++ /dev/null @@ -1,22 +0,0 @@ -$(if (not no_procedure) or (no_procedure == 1) then -OUT=[[ -// -// Function to run the Execute method of this filter -// -Image ${name:gsub("Filter$", "")} ( $(include ImageParameters.in)$(include MemberParameters.in) ) -{ - ${name} filter; - return filter.Execute ( $(for inum=1,number_of_inputs do - if inum>1 then - OUT=OUT..', ' - end - OUT=OUT .. 'image' .. inum - end)$(for i = 1,#members do - if (number_of_inputs > 0 or i > 1) then - OUT = OUT .. ", " - end - OUT= OUT .. members[i].name:sub(1,1):lower() .. members[i].name:sub(2,-1) - end) ); -} -]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.h.in b/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.h.in deleted file mode 100644 index cb77611df..000000000 --- a/utilities/SimpleRTK/TemplateComponents/RTKFunctionalAPI.h.in +++ /dev/null @@ -1,20 +0,0 @@ -$(if (not no_procedure) or (no_procedure == 1) then -OUT='\ - /**\ -' -if briefdescription and (briefdescription:len() > 0) then - OUT=OUT..' * \\brief ${briefdescription}' -else - OUT=OUT..' * \\brief rtk::simple::${name} Procedural Interface' -end -OUT=OUT..[[ - - * - * This function directly calls the execute method of ${name} - * in order to support a procedural API - * - * \sa rtk::simple::${name} for the object oriented interface - */ - SRTKBasicFilters_EXPORT Image ${name:gsub("Filter$", "")} ( $(include ImageParameters.in)$(include MemberParametersWithDefaults.in) ); -]] -end) diff --git a/utilities/SimpleRTK/TemplateComponents/StandardIncludes.cxx.in b/utilities/SimpleRTK/TemplateComponents/StandardIncludes.cxx.in deleted file mode 100644 index 1d86d40bc..000000000 --- a/utilities/SimpleRTK/TemplateComponents/StandardIncludes.cxx.in +++ /dev/null @@ -1,22 +0,0 @@ -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkImage.h" -#include "itkVectorImage.h" -#include "itkLabelMap.h" -#include "itkLabelObject.h" -#include "itkNumericTraits.h" -#include "itkNumericTraitsVariableLengthVectorPixel.h" -#include "itkVectorIndexSelectionCastImageFilter.h" -#include "itkComposeImageFilter.h" - -#include "srtk${name}.h" -$(if itk_name then - OUT=[[ -#include "itk${itk_name}.h"]] -else - OUT=[[ -#include "rtk${name}.h"]] -end) - diff --git a/utilities/SimpleRTK/TemplateComponents/ToStringBody.cxx.in b/utilities/SimpleRTK/TemplateComponents/ToStringBody.cxx.in deleted file mode 100644 index 583fb833d..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ToStringBody.cxx.in +++ /dev/null @@ -1,44 +0,0 @@ - std::ostringstream out; - out << "rtk::simple::${name}\n"; -$(foreach members -$(if (not no_print) or (not no_print == 1) then - OUT=[[ - out << " ${name}: "; -]] - if point_vec and (point_vec == 1) then - OUT=OUT..[[ - out << "[ "; - for (unsigned int i = 0; i + 1 < m_${name}.size(); ++i) - { - this->ToStringHelper(out, this->m_${name}[i]); - out << ", "; - } - if ( !this->m_${name}.empty() ) out << this->m_${name}.back() << ' '; - out << "]";]] - else - OUT=OUT..[[ - this->ToStringHelper(out, this->m_${name}); -]] - end - OUT=OUT..[[ - out << std::endl;]] -end) -)$(when measurements $(foreach measurements -$(if (not no_print) or (not no_print == 1) then -if active then - OUT=[[ - out << " ${name}: "; - if (bool(this->m_pfGet${name})) - { - this->ToStringHelper(out, this->m_pfGet${name}()); - } - else - { - out << "(null)"; - } - out << std::endl;]] -else -OUT=[[ out << " ${name}: " << this->m_${name} << std::endl;]] -end -end))) - out << ProcessObject::ToString(); diff --git a/utilities/SimpleRTK/TemplateComponents/ToStringReturn.cxx.in b/utilities/SimpleRTK/TemplateComponents/ToStringReturn.cxx.in deleted file mode 100644 index be9177412..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ToStringReturn.cxx.in +++ /dev/null @@ -1 +0,0 @@ - return out.str(); diff --git a/utilities/SimpleRTK/TemplateComponents/ToStringSignature.cxx.in b/utilities/SimpleRTK/TemplateComponents/ToStringSignature.cxx.in deleted file mode 100644 index fe143033f..000000000 --- a/utilities/SimpleRTK/TemplateComponents/ToStringSignature.cxx.in +++ /dev/null @@ -1 +0,0 @@ -std::string ${name}::ToString() const diff --git a/utilities/SimpleRTK/Testing/CMakeLists.txt b/utilities/SimpleRTK/Testing/CMakeLists.txt deleted file mode 100644 index 57e285f52..000000000 --- a/utilities/SimpleRTK/Testing/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(Unit) diff --git a/utilities/SimpleRTK/Testing/Unit/CMakeLists.txt b/utilities/SimpleRTK/Testing/Unit/CMakeLists.txt deleted file mode 100644 index 941a63ad2..000000000 --- a/utilities/SimpleRTK/Testing/Unit/CMakeLists.txt +++ /dev/null @@ -1,775 +0,0 @@ -include_directories(${ITK_INCLUDE_DIRS}) - -find_package( GTest REQUIRED ) - -set ( SimpleRTKUnitTestSourceBase - SimpleRTKTestHarness.cxx - srtkImageCompare.cxx -) -add_library ( SimpleRTKUnitTestBase STATIC ${SimpleRTKUnitTestSourceBase} ) -add_dependencies( SimpleRTKUnitTestBase BasicFiltersSourceCode ) -# Find tests generated in the binary directory -# To add a new file, just add it to this list. Any GoogleTests inside will be automatically -# added to ctest. -set ( SimpleRTKUnitTestSource - srtkImageTests.cxx - srtkCommonTests.cxx - srtkImageIOTests.cxx - srtkBasicFiltersTests.cxx - ) - -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PythonTests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/LuaTests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/TclTests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/RTests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/RubyTests) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/JavaTests/org/rtk/simple/testing) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CSharpTests) - -# Adjust Python to run in the virtualenv -set( PythonVirtualenvHome ${SimpleRTK_BINARY_DIR}/Testing/Installation/PythonVirtualenv ) - -add_executable(SimpleRTKUnitTestDriver0 SimpleRTKUnitTestDriver.cxx ${SimpleRTKUnitTestSource}) -target_link_libraries ( SimpleRTKUnitTestDriver0 ${GTEST_LIBRARIES} SimpleRTKUnitTestBase ${SimpleRTK_LIBRARIES} ) - -# -# Glob for necessary template files up front, before the foreach loop over -# the filters: -# -file ( GLOB CXX_TEMPLATE_FILES "*Template*.cxx.in" ) -file ( GLOB LUA_TEMPLATE_FILES "*Template*.lua.in" ) -file ( GLOB PYTHON_TEMPLATE_FILES "*Template*py.in" ) -file ( GLOB TCL_TEMPLATE_FILES "*Template*.tcl.in" ) -file ( GLOB R_TEMPLATE_FILES "*Template*.R.in" ) -file ( GLOB RUBY_TEMPLATE_FILES "*Template*rb.in" ) -file ( GLOB JAVA_TEMPLATE_FILES "*Template*.java.in" ) -file ( GLOB CSHARP_TEMPLATE_FILES "*Template*.cs.in" ) - -# -# Generate code for the tests in different languages -# -# Break all these source files into a bunch of separate executables -# base on every n files in the list. -set ( _stride 50 ) -set ( _exec_i 1 ) # exec 0 is the manual tests -set ( _i 0 ) - -# Disable the generated fileter for now -#foreach ( FILTERNAME ${GENERATED_FILTER_LIST} ) -foreach(FILTERNAME ${NOTHING}) - if ( NOT _i LESS _stride ) - add_executable(SimpleRTKUnitTestDriver${_exec_i} SimpleRTKUnitTestDriver.cxx ${GENERATED_TEST_SOURCE}) - target_link_libraries ( SimpleRTKUnitTestDriver${_exec_i} ${GTEST_LIBRARIES} SimpleRTKUnitTestBase ${SimpleRTK_LIBRARIES} ) - math(EXPR _exec_i "${_exec_i}+1") - set(GENERATED_TEST_SOURCE "") - set ( _i 0 ) - endif () - - # Set up some convenience variables - set (filter_json_file ${SimpleRTK_SOURCE_DIR}/Code/BasicFilters/json/${FILTERNAME}.json) - set (template_expansion_script ${SimpleRTK_SOURCE_DIR}/Utilities/ExpandTemplate.lua) - set (template_include_dir ${SimpleRTK_SOURCE_DIR}/TemplateComponents) - - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/srtk${FILTERNAME}Test.cxx") - add_custom_command ( - OUTPUT ${OUTPUT_TEST_FILENAME} - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/srtk ${template_include_dir} TestTemplate.cxx.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${CXX_TEMPLATE_FILES} - ) - add_test( NAME BasicFilters.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=BasicFilters.${FILTERNAME}:BasicFilters.${FILTERNAME}_* ) - set ( GENERATED_TEST_SOURCE ${GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - - if ( WRAP_LUA ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/LuaTests/${FILTERNAME}Test.lua") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/Lua ${template_include_dir} TestTemplate.lua.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${LUA_TEMPLATE_FILES} - ) - add_test( NAME Lua.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=Lua.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - if ( WRAP_PYTHON ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/PythonTests/${FILTERNAME}Test.py") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/Python ${template_include_dir} TestTemplate.py.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${PYTHON_TEMPLATE_FILES} - ) - add_test( NAME Python.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=Python.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - if ( WRAP_TCL ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/TclTests/${FILTERNAME}Test.tcl") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/Tcl ${template_include_dir} TestTemplate.tcl.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${TCL_TEMPLATE_FILES} - ) - add_test( NAME Tcl.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=Tcl.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - if ( WRAP_R ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/RTests/${FILTERNAME}Test.R") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/R ${template_include_dir} TestTemplate.R.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${R_TEMPLATE_FILES} - ) - add_test( NAME R.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=R.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - if ( WRAP_RUBY ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/RubyTests/${FILTERNAME}Test.rb") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/Ruby ${template_include_dir} TestTemplate.rb.in "${OUTPUT_TEST_FILENAME}" - DEPENDS ${filter_json_file} ${RUBY_TEMPLATE_FILES} - ) - add_test( NAME Ruby.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=Ruby.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - # Java Tests - if ( WRAP_JAVA ) - set(OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/JavaTests/org/rtk/simple/testing/${FILTERNAME}Test.java") - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/Java ${template_include_dir} TestTemplate.java.in "${OUTPUT_TEST_FILENAME}" - COMMAND ${Java_JAVAC_EXECUTABLE} -classpath ${SimpleRTK_BINARY_DIR}/Wrapping/${JAR_FILE} ${SimpleRTK_BINARY_DIR}/Testing/JavaTests/org/rtk/simple/testing/${FILTERNAME}Test.java - DEPENDS ${filter_json_file} ${JAVA_TEMPLATE_FILES} ${SWIG_MODULE_SimpleRTKJava_TARGET_NAME} - ) - add_test( NAME Java.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=Java.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - # C# Tests - if ( WRAP_CSHARP ) - set( OUTPUT_TEST_FILENAME "${SimpleRTK_BINARY_DIR}/Testing/CSharpTests/Test${FILTERNAME}.cs" ) - if ( WIN32 ) - string( REPLACE "/" "\\" OUTPUT_TEST_FILENAME_SAFE ${OUTPUT_TEST_FILENAME} ) - else () - string( REPLACE "\\" "/" OUTPUT_TEST_FILENAME_SAFE ${OUTPUT_TEST_FILENAME} ) - endif () - add_custom_command ( - OUTPUT "${OUTPUT_TEST_FILENAME}" - COMMAND ${CMAKE_COMMAND} -E remove -f "${OUTPUT_TEST_FILENAME}" - COMMAND lua ${template_expansion_script} test ${filter_json_file} ${SimpleRTK_SOURCE_DIR}/Testing/CSharp ${template_include_dir} TestTemplate.cs.in "${OUTPUT_TEST_FILENAME}" - COMMAND ${CSHARP_COMPILER} - /t:exe /platform:${CSHARP_PLATFORM} - /lib:${CSHARP_BINARY_DIRECTORY} /reference:System.dll /reference:SimpleRTKCSharpManaged.dll - /out:${CSHARP_BINARY_DIRECTORY}/Test${FILTERNAME}.exe ${OUTPUT_TEST_FILENAME_SAFE} - DEPENDS ${filter_json_file} ${CSHARP_TEMPLATE_FILES} - ) - add_test( NAME CSharp.${FILTERNAME} COMMAND SimpleRTKUnitTestDriver${_exec_i} --gtest_filter=CSharp.${FILTERNAME} ) - set ( WRAPPED_GENERATED_TEST_SOURCE ${WRAPPED_GENERATED_TEST_SOURCE} ${OUTPUT_TEST_FILENAME}) - endif() - - math(EXPR _i "${_i}+1") - -endforeach() - -add_executable(SimpleRTKUnitTestDriver${_exec_i} SimpleRTKUnitTestDriver.cxx ${GENERATED_TEST_SOURCE}) -target_link_libraries ( SimpleRTKUnitTestDriver${_exec_i} ${GTEST_LIBRARIES} SimpleRTKUnitTestBase ${SimpleRTK_LIBRARIES} ) - -# Build Google Test -find_package(Threads) -if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available. - set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=1") -endif() - -# Test data directory -set(TEST_HARNESS_TEMP_DIRECTORY ${SimpleRTK_BINARY_DIR}/Testing/Temporary) -set(TEST_HARNESS_DATA_DIRECTORY ${SimpleRTK_BINARY_DIR}/ExternalData/Testing/Data) - -# Set some variables -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SimpleRTKTestHarnessPaths.h.in - ${CMAKE_CURRENT_BINARY_DIR}/SimpleRTKTestHarnessPaths.h ESCAPE_QUOTES) - -include_directories ( -${GTEST_INCLUDE_DIRS} -${CMAKE_CURRENT_SOURCE_DIR} -${CMAKE_CURRENT_BINARY_DIR} -${SimpleRTK_INCLUDE_DIRS} -) - -add_custom_target(WrappedGeneratedTests ALL - DEPENDS ${WRAPPED_GENERATED_TEST_SOURCE} -) - -# Add org.rtk.simple.jar dependency if necessary -if( WRAP_JAVA ) - add_dependencies(WrappedGeneratedTests org_rtk_simple_jar) -endif() - -# Add C# dependency if necessary -if( WRAP_CSHARP ) - add_dependencies(WrappedGeneratedTests SimpleRTKCSharpManaged) -endif() - -add_executable( srtkSystemInformationTest srtkSystemInformationTest.cxx ) -target_link_libraries( srtkSystemInformationTest ${SimpleRTK_LIBRARIES} ) -add_test( NAME srtkSystemInformaionTest COMMAND srtkSystemInformationTest ${CMAKE_BINARY_DIR} ) - - -# Add all the tests by parsing the source code -# This macro searches for GoogleTest macros and adds them as test automatically -macro(ADD_GOOGLE_TESTS target) - # Add the generated tests - set ( AllTestsHits "" ) - set ( LongTestsHits "" ) - - foreach ( source ${ARGN} ) - file(READ "${source}" contents) - - # Find all test and long test lists - string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,_]+)\\) /\\* Long \\*/" LongTests ${contents}) - string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,_]+)\\)" AllTests ${contents}) - - # Convert the C++ code into a short test name - foreach(hit ${AllTests}) - string(REGEX REPLACE ".*\\( *( *[A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) - set ( AllTestsHits ${AllTestsHits} ${test_name} ) - endforeach() - foreach(hit ${LongTests}) - string(REGEX REPLACE ".*\\(( *[A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) - set ( LongTestsHits ${LongTestsHits} ${test_name} ) - endforeach() - endforeach() - - # If we are not running the long tests, remove them from the AllTests list - if ( NOT RUN_LONG_TESTS ) - foreach ( test ${LongTestsHits} ) - list ( REMOVE_ITEM AllTestsHits ${test} ) - endforeach() - endif () - - list ( SORT AllTestsHits ) - list ( REMOVE_DUPLICATES AllTestsHits ) - # Add all the remaining tests to CTest's test list - foreach(hit ${AllTestsHits}) - # Take the first item in gtest list as the name - string( REGEX MATCH "[^:]+" name ${hit} ) - add_test( NAME ${name} COMMAND ${target} --gtest_filter=${hit} ) - endforeach() -endmacro() - -add_google_tests(SimpleRTKUnitTestDriver0 ${SimpleRTKUnitTestSource}) - - -####################################################### -# -# Tests which use the itkTestDriver -# -####################################################### - -set( RTK_TEST_DRIVER "rtkTestDriver" ) - -# -# CXX Examples -# -#if ( ${BUILD_EXAMPLES} ) -# add_test(NAME CXX.Example.SimpleGaussian -# COMMAND "${RTK_TEST_DRIVER}" -# --compare-MD5 -# "${TEST_HARNESS_TEMP_DIRECTORY}/CXX.SimpleGaussian.nrrd" -# 5ef06ed0d5d8952c770348699b70f23e -# $ -# "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" -# 2.0 -# "${TEST_HARNESS_TEMP_DIRECTORY}/CXX.SimpleGaussian.nrrd" -# ) -#endif() - -if ( WRAP_CSHARP ) - - # - # This is a function which compiles the program and set up the - # enviroment for executing CSharp examples and tests. - # - function(add_csharp_test name csharp_file) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - # the root is with out extension or path - get_filename_component( CSHARP_EXECUTABLE ${csharp_file} NAME_WE ) - - # make sure the executable has CSharp in it - if ( NOT CSHARP_EXECUTABLE MATCHES "CSharp" ) - set( CSHARP_EXECUTABLE "CSharp${CSHARP_EXECUTABLE}" ) - endif() - - # add the target to compile the test - csharp_add_executable( - "${CSHARP_EXECUTABLE}" - SimpleRTKCSharpManaged.dll - ${csharp_file} - ) - - # because each executable is it's own target we actually don't - # need to make a target depend on this list - list( APPEND compiled_csharp_tests "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe") - - add_dependencies("${CSHARP_EXECUTABLE}" SimpleRTKCSharpManaged) - - # the interpreter is set to "" when none is needed - if( CSHARP_INTERPRETER ) - add_test(NAME CSharp.${name} - COMMAND "${RTK_TEST_DRIVER}" - "${CSHARP_INTERPRETER}" - "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe" - ${ARGN} - ) - else () - add_test(NAME CSharp.${name} - COMMAND "${RTK_TEST_DRIVER}" - "${CSHARP_BINARY_DIRECTORY}/${CSHARP_EXECUTABLE}.exe" - ${ARGN} - ) - endif() - - endfunction() - - # - # CSharp Examples - # - add_csharp_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/RTKFirstReconstruction.cs" -# --compare -# "${TEST_HARNESS_TEMP_DIRECTORY}/CSharp.SimpleGaussian.nrrd" -# "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_TEMP_DIRECTORY}/CSharp.RTKFirstReconstruction.mha" ) - # - # CSharp Tests - # - add_csharp_test( Test.ImageTest - "${SimpleRTK_SOURCE_DIR}/Testing/CSharpImageTest.cs" ) - -endif () - - -if ( WRAP_JAVA ) - - # - # This is a function which set up the enviroment for executing JAVA examples and tests - # - function(add_java_test name java_file) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - # the root is with out extension or path, it is also assumed to the the name of the main class - get_filename_component( _java_class ${java_file} NAME_WE ) - set( _java_file_class "${_java_class}.class" ) - - if(WIN32) - set( _JAVA_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$" ) - # Note: on windows this is a semi-colon separated list - set( _JAVA_CLASSPATH "${SimpleRTK_BINARY_DIR}/Wrapping/${JAR_FILE};${CMAKE_CURRENT_BINARY_DIR}" ) - else() - set( _JAVA_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ) - set( _JAVA_CLASSPATH "${SimpleRTK_BINARY_DIR}/Wrapping/${JAR_FILE}:${CMAKE_CURRENT_BINARY_DIR}" ) - endif() - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_java_file_class}" - COMMAND "${Java_JAVAC_EXECUTABLE}" - ARGS -classpath "${_JAVA_CLASSPATH}" - -d "${CMAKE_CURRENT_BINARY_DIR}" - "${java_file}" - DEPENDS ${java_file} ${SWIG_MODULE_SimpleRTKJava_TARGET_NAME} org_rtk_simple_jar - ) - - list( APPEND compiled_java_tests "${CMAKE_CURRENT_BINARY_DIR}/${_java_file_class}") - - # set in parent scope to accumulate list during function execution - set( compiled_java_tests ${compiled_java_tests} PARENT_SCOPE) - - add_test(NAME Java.${name} - COMMAND "${RTK_TEST_DRIVER}" - "${Java_JAVA_EXECUTABLE}" - "-Djava.library.path=${_JAVA_LIBRARY_PATH}" - "-classpath" "${_JAVA_CLASSPATH}" - "${_java_class}" - ${ARGN} - ) - endfunction() - - add_java_test( ProcessObjectTest - "${SimpleRTK_SOURCE_DIR}/Testing/srtkProcessObjectTest.java" ) - - # - # JAVA Examples - # - add_java_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussian.java" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Java.SimpleGaussian.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Java.SimpleGaussian.nrrd" ) - - add_java_test( Example.FilterProgressReporting - "${SimpleRTK_SOURCE_DIR}/Examples/FilterProgressReporting.java" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Java.FilterProgressReporting.nrrd" - ) - set_tests_properties( Java.Example.FilterProgressReporting - PROPERTIES PASS_REGULAR_EXPRESSION "DiscreteGaussianImageFilter Progress" ) - -# This test currently does not compile or work -# -# add_java_test( Example.ImageConnection -# "${SimpleRTK_SOURCE_DIR}/Examples/ImageConnection.java" ) - - - # after all add_java_tests are called, form a target so all the code - # is built - add_custom_target( CompileJavaTests ALL DEPENDS ${compiled_java_tests} ) - -endif () - - -if ( WRAP_PYTHON ) - - # - # This is a function which set up the enviroment for executing python examples and tests - # - function(add_python_test name) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - set(command "${VIRTUAL_PYTHON_EXECUTABLE}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - add_test(NAME Python.${name} - COMMAND "${RTK_TEST_DRIVER}" - --add-before-env SITK_NOSHOW "YES" - ${command} - ${ARGN} - ) - endfunction() - - # - # Python Examples - # - add_python_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussian.py" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.SimpleGaussian.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.SimpleGaussian.nrrd" ) - - add_python_test( Example.SimpleGaussianProcedural - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussianProcedural.py" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.SimpleGaussianProcedural.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.SimpleGaussianProcedural.nrrd" ) - - add_python_test( Example.ImageCreateAndSet - "${SimpleRTK_SOURCE_DIR}/Examples/ImageCreateAndSet.py" ) - - add_python_test( Example.CannyEdge - "${SimpleRTK_SOURCE_DIR}/Examples/CannyEdge.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/OAS1_0001_MR1_mpr-1_anon.nrrd" ) - - add_python_test( Example.ExtractSlice - "${SimpleRTK_SOURCE_DIR}/Examples/ExtractSlice.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/OAS1_0001_MR1_mpr-1_anon.nrrd" - "30" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.ExtractSlice.nrrd") - - add_python_test( Example.BoarderSegmentation - "${SimpleRTK_SOURCE_DIR}/Examples/BoarderSegmentation.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/OAS1_0001_MR1_mpr-1_anon.nrrd" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.BoarderSegmentation.nrrd" - "5000" - "150" ) - - add_python_test( Example.N4BiasFieldCorrection - "${SimpleRTK_SOURCE_DIR}/Examples/N4BiasFieldCorrection.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/OAS1_0001_MR1_mpr-1_anon.nrrd" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.Example.N4BiasFieldCorrection.nrrd" - "1" ) - - add_python_test( Example.ReadAndShow - "${SimpleRTK_SOURCE_DIR}/Examples/ReadAndShow.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/VM1111Shrink-RGB.png" ) - - add_python_test( Example.GeodesicActiceContourSegmentation - "${SimpleRTK_SOURCE_DIR}/Examples/GeodesicActiceContourSegmentation.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/cthead1.png" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.Example.GeodesicActiceContourSegmentation.nrrd" - .3 10 .9 50 55 - ) - - add_python_test( Example.FFTConvolution - "${SimpleRTK_SOURCE_DIR}/Examples/FFTConvolution.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/cthead1-Float.mha" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/Gaussian_1.5.nrrd" - "${TEST_HARNESS_TEMP_DIRECTORY}/Python.Examples.FFTConvolution.nrrd" - ) - - add_python_test( Example.FilterProgressReporting - "${SimpleRTK_SOURCE_DIR}/Examples/FilterProgressReporting.py" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonFilterProgressReporting.nrrd" - ) - set_tests_properties( Python.Example.FilterProgressReporting - PROPERTIES PASS_REGULAR_EXPRESSION "DiscreteGaussianImageFilter Progress" ) - - add_python_test( Example.Segmentation.ConnectedThresholdImageFilter1 - "${SimpleRTK_SOURCE_DIR}/Examples/Segmentation/ConnectedThresholdImageFilter.py" - --compare-MD5 - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationConnectedThreshold1.png" - "d4ff9c512f9c18a84729677de800db0d" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/BrainProtonDensitySlice.png" - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationConnectedThreshold1.png" - 150 180 - 60 116 - ) - - add_python_test( Example.Segmentation.ConnectedThresholdImageFilter2 - "${SimpleRTK_SOURCE_DIR}/Examples/Segmentation/ConnectedThresholdImageFilter.py" - --compare-MD5 - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationConnectedThreshold2.png" - "a9695df04cde5b9c5481d8c253a5b3aa" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/BrainProtonDensitySlice.png" - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationConnectedThreshold2.png" - 210 250 - 81 112 - ) - - add_python_test( Example.Segmentation.NeighborhoodConnectedImageFilter1 - "${SimpleRTK_SOURCE_DIR}/Examples/Segmentation/NeighborhoodConnectedImageFilter.py" - --compare-MD5 - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationNeighborhoodConnected1.png" - "311d9d4b492e1ea625e3b0b295814dce" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/BrainProtonDensitySlice.png" - "${TEST_HARNESS_TEMP_DIRECTORY}/PythonSegmentationNeighborhoodConnected1.png" - 150 180 - 60 116 - ) - - - # - # Python Tests - # - add_python_test( Test.ImageTests - "${SimpleRTK_SOURCE_DIR}/Testing/srtkImageTests.py" ) - add_python_test( Test.ImageIndexing - "${SimpleRTK_SOURCE_DIR}/Testing/ImageIndexingTest.py" ) - - add_python_test( Test.IOTest - "${SimpleRTK_SOURCE_DIR}/Testing/IOTest.py" - "${TEST_HARNESS_TEMP_DIRECTORY}") - - # Numpy test. - add_python_test( Test.Numpy - "${SimpleRTK_SOURCE_DIR}/Testing/srtkNumpyArrayConversionTest.py" - ) - - add_python_test( Test.ProcessObject - "${SimpleRTK_SOURCE_DIR}/Testing/srtkProcessObjectTest.py" - ) - - - -endif() - - -if ( WRAP_LUA ) - - # - # This is a function which set up the enviroment for executing lua examples and tests - # - function(add_lua_test name) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - set(command "$") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - add_test(NAME Lua.${name} - COMMAND "${RTK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - endfunction() - - - # - # Lua Examples - # - add_lua_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussian.lua" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Lua.SimpleGaussian.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Lua.SimpleGaussian.nrrd" ) - -endif () - -if ( WRAP_RUBY ) - - # - # This is a function which set up the enviroment for executing ruby examples and tests - # - function(add_ruby_test name) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - set(command "${RUBY_EXECUTABLE}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - add_test(NAME Ruby.${name} - COMMAND "${RTK_TEST_DRIVER}" - --add-before-env RUBYLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$" - --add-before-env RUBYLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" - ${command} - ${ARGN} - ) - endfunction() - - - # - # Ruby Examples - # - add_ruby_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussian.rb" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Ruby.SimpleGaussian.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Ruby.SimpleGaussian.nrrd" ) - -endif () - - -if ( WRAP_TCL ) - - # - # This is a function which set up the enviroment for executing TCL examples and tests - # - function(add_tcl_test name) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - - set(command "$") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - add_test(NAME Tcl.${name} - COMMAND "${RTK_TEST_DRIVER}" - ${command} - ${ARGN} - ) - endfunction() - - - # - # TCL Examples - # - add_tcl_test( Example.SimpleGaussian - "${SimpleRTK_SOURCE_DIR}/Examples/SimpleGaussian.tcl" - --compare - "${TEST_HARNESS_TEMP_DIRECTORY}/Tcl.SimpleGaussian.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Baseline/Example_SimpleGaussian_2.0.nrrd" - "${TEST_HARNESS_DATA_DIRECTORY}/Input/RA-Short.nrrd" - "2.0" - "${TEST_HARNESS_TEMP_DIRECTORY}/Tcl.SimpleGaussian.nrrd" ) - -endif () - -if ( WRAP_R ) - - # - # This is a function which set up the enviroment for executing R examples and tests - # - function(add_r_test name) - - if ( NOT ${BUILD_EXAMPLES} AND "${name}" MATCHES "^Example." ) - return() - endif() - - set(command "${R_COMMAND}") - - # add extra command which may be needed on some systems - if(CMAKE_OSX_ARCHITECTURES) - list(GET CMAKE_OSX_ARCHITECTURES 0 test_arch) - set(command arch -${test_arch} ${command}) - endif() - - add_test(NAME R.${name} - COMMAND - ${command} - ${ARGN} - ) - - set_property(TEST R.${name} - PROPERTY ENVIRONMENT R_LIBS=${SimpleRTK_BINARY_DIR}/Wrapping/RLib/ - ) - endfunction() - - - # - # R tests and Examples - # - add_r_test( Arithmetic - "--file=${SimpleRTK_SOURCE_DIR}/Testing/RArithmeticTest.R" - ) - -endif () diff --git a/utilities/SimpleRTK/Testing/Unit/CSharpImageFilterTestTemplate.cs.in b/utilities/SimpleRTK/Testing/Unit/CSharpImageFilterTestTemplate.cs.in deleted file mode 100644 index 310d6932a..000000000 --- a/utilities/SimpleRTK/Testing/Unit/CSharpImageFilterTestTemplate.cs.in +++ /dev/null @@ -1,172 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -/* - * WARNING: DO NOT EDIT THIS FILE! - * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. - * Please look at CSharpImageFilterTestTemplate.cs.in to make changes. - */ - -// This is C# code to test ${name} -using System; -using System.Collections.Generic; -using rtk.simple; - -public class Test${name} { - - public static int Main(string[] args) { - - try { - - // Get the right number of inputs - int num_inputs = 1; -$(if number_of_inputs then - OUT=[[ - num_inputs = ${number_of_inputs};]] -end) - - // Check the command line arguments - if ( args.Length < num_inputs + 1 ) { - Console.WriteLine("Usage: ${name} tag output"); - return 1; - } - - String tag = args[1]; - - // Instantiate objects - ImageFileReader reader = new ImageFileReader(); - ImageFileWriter writer = new ImageFileWriter(); - ${name} filter = new ${name}(); - List inputs = new List(); -$(if #tests == 0 then - OUT=[[ - // No tests defined => exit with error code - Console.WriteLine ( "No tests defined!" ); - return 1;]] -end) - // Run each test -$(foreach tests - if (tag.Equals( "${tag}" )) { - - // Read image(s) - for ( int i = 2; i < args.Length-1; i++ ) { - - inputs.Add( reader.SetFileName( args[i] ).Execute() ); - } - -$(if inputA_cast then - OUT=[[ - CastImageFilter caster = new CastImageFilter(); - caster.SetOutputPixelType( PixelIDValueEnum.${inputA_cast}.swigValue ); - inputs[0] = caster.Execute( inputs[0] );]] -end) - -$(if inputB_cast then - OUT=[[ - caster = new CastImageFilter(); - caster.SetOutputPixelType( PixelIDValueEnum.${inputB_cast}.swigValue ); - inputs[1] = caster.Execute( inputs[1] );]] -end) - - -$(when settings - // Set parameters -$(foreach settings -$(if parameter == "SeedList" then - OUT=[[ - filter.ClearSeeds(); -$(for i=1,#value do OUT=OUT .. "\ - {\ - VectorUInt32 idx = new VectorUInt32( new uint[] " .. value[i] .. " );\ - filter.AddSeed( idx );\ - }\ -" end)]] -elseif parameter == "TrialPoints" then - OUT=[[ - filter.ClearTrialPoints(); -$(for i=1,#value do OUT=OUT .. "\ - {\ - VectorUInt32 idx = new VectorUInt32( new uint[] " .. value[i] .. " );\ - filter.AddTrialPoint( idx );\ - }\ -" end)]] -elseif dim_vec == 1 then - A='{' - for i=1,#value-1 do - A=A..value[i]..", " - end - A=A..value[#value] - A=A..'}' - OUT=[[ - { - $(if type == "bool" then - OUT="VectorBool idx = new VectorBool( new bool[] "..A.." );" - elseif type == "unsigned int" then - OUT="VectorUInt32 idx = new VectorUInt32( new uint[] "..A.." );" - elseif type == "int" then - OUT="VectorInt32 idx = new VectorInt32( new int[] "..A.." );" - elseif type == "unsigned long" then - OUT="VectorULong idx = new VectorULong( new ulong[] "..A.." );" - elseif type == "long" then - OUT="VectorLong idx = new VectorLong( new long[] "..A.." );" - elseif type == "unsigned short" then - OUT="VectorUShort idx = new VectorUShort( new ushort[] "..A.." );" - elseif type == "short" then - OUT="VectorShort idx = new VectorShort( new short[] "..A.." );" - elseif type == "float" then - OUT="VectorFloat idx = new VectorFloat( new float[] "..A.." );" - elseif type == "double" then - OUT="VectorDouble idx = new VectorDouble( new double[] "..A.." );" - elseif type == "uint8_t" then - OUT="VectorUInt8 idx = new VectorUInt8( new byte[] "..A.." );" - elseif type == "uint16_t" then - OUT="VectorUInt16 idx = new VectorUInt16( new ushort[] "..A.." );" - elseif type == "uint32_t" then - OUT="VectorUInt32 idx = new VectorUInt32( new uint[] "..A.." );" - elseif type == "uint64_t" then - OUT="VectorUInt64 idx = new VectorUInt64( new ulong[] "..A.." );" - elseif type == "int8_t" then - OUT="VectorInt8 idx = new VectorInt8( new sbyte[] "..A.." );" - elseif type == "int16_t" then - OUT="VectorInt16 idx = new VectorInt16( new short[] "..A.." );" - elseif type == "int32_t" then - OUT="VectorInt32 idx = new VectorInt32( new int[] "..A.." );" - elseif type == "int64_t" then - OUT="VectorInt64 idx = new VectorInt64( new long[] "..A.." );" - end) - filter.Set${parameter}( idx ); - }]] -else - OUT=[[ - filter.Set${parameter}( $(if csharp_value then OUT='${csharp_value}' else OUT='${value}' end) );]] -end) -) -) - // Run the filter - Image output = filter.Execute ( $(if #inputs > 0 then OUT=[[inputs[0] ]] end)$(for inum=1,#inputs-1 do OUT=OUT..", inputs["..inum.."]" end) ); - - // Write output - writer.SetFileName( args[args.Length-1] ).Execute( output ); - } -) - } catch (Exception ex) { - Console.WriteLine( "ERROR: " + ex.ToString() ); - return 1; - } - return 0; - } -} diff --git a/utilities/SimpleRTK/Testing/Unit/CSharpImageTest.cs b/utilities/SimpleRTK/Testing/Unit/CSharpImageTest.cs deleted file mode 100644 index 2d8fc60a2..000000000 --- a/utilities/SimpleRTK/Testing/Unit/CSharpImageTest.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using rtk.simple; -using srtk = rtk.simple; -using PixelId = rtk.simple.PixelIDValueEnum; - -namespace rtk.simple { - /// Test rtk.simple.Image. - public class CSharpImageTest { - public const int ExitSuccess = 0; - public const int ExitFailure = 1; - - public static int CheckHash(Image img, string expectedHash, ref int success) - { - HashImageFilter hasher = new HashImageFilter(); - string actualHash = hasher.Execute(img); - if (actualHash != expectedHash) - { - success = ExitFailure; - Console.WriteLine("Expected hash: \"{0}\" actual hash: \"{1}\".", expectedHash, actualHash ); - } - return 0; - } - - /// Main entry point. - public static int Main (string[] args) { - int success = ExitSuccess; - try { - Image image = new Image(100, 100, PixelId.srtkInt8); - Image image2 = new Image(100, 100, PixelId.srtkInt8); - - image += 10; - image -= 1; - CheckHash(image, "1cda91cc1bf474a25d6365f7fa7ef1fc75b3c7c9", ref success); - image *= 2; - image /= 3; - CheckHash(image, "856f68940ff670209aa9d60f38fc4cca1880f647", ref success); - - - // image with just one 7 reset zero - image *= 0; - VectorUInt32 idx = new VectorUInt32(); - idx.Add(0); - idx.Add(0); - image.SetPixelAsInt8( idx, 7 ); - - // Unary operators - CheckHash(-image, "fe7e0c8ac8252189cf5766a352397bc62dd42e4d", ref success); - CheckHash(+image, "6cccaa2d5c958e79ebd5ca4a0b00bee747797c8d", ref success); - CheckHash(!image, "f4695dbf5bc9ea2796b2e4f360ea4b5ecbf70c37", ref success); - CheckHash(~image, "746470f03126f653cc23265e0b1c1fe16a952745", ref success); - CheckHash(image, "6cccaa2d5c958e79ebd5ca4a0b00bee747797c8d", ref success); - - - // Comparison operators - CheckHash( image < 7, "f4695dbf5bc9ea2796b2e4f360ea4b5ecbf70c37", ref success); - CheckHash( image > 7, "f907b7bf318b79fd6b9da589646f8b1dac77d0c8", ref success); - CheckHash( image <= 7, "cef864600fc947062ac359fe9a7cc049c7273b8e", ref success); - CheckHash( image >= 7, "52f583bfeb07a6c4c5a26b28f8ae180bf8e0079b", ref success); - - CheckHash( image < image2, "f907b7bf318b79fd6b9da589646f8b1dac77d0c8", ref success); - CheckHash( image > image2, "52f583bfeb07a6c4c5a26b28f8ae180bf8e0079b", ref success); - CheckHash( image <= image2, "f4695dbf5bc9ea2796b2e4f360ea4b5ecbf70c37", ref success); - CheckHash( image >= image2, "cef864600fc947062ac359fe9a7cc049c7273b8e", ref success); - - // Binary bitwise operators - image &= 5;; - image |= 7; - image ^= 8; - CheckHash(image, "0c26e6610c876b83cf681688eb8e80b952a394ce", ref success); - - image &= image; - image ^= image; - image |= image; - CheckHash( image, "f907b7bf318b79fd6b9da589646f8b1dac77d0c8", ref success); // just zeros - - - // image of 1s - image *= 0; - image += 1; - - image += image; - image -= image; - image *= image; - image /= image; - CheckHash(image, "287046eafd10b9984977f6888ea50ea50fe846b5", ref success); - - - } catch (Exception ex) { - success = ExitFailure; - Console.WriteLine(ex); - } - return success; - } - } -} diff --git a/utilities/SimpleRTK/Testing/Unit/IOTest.py b/utilities/SimpleRTK/Testing/Unit/IOTest.py deleted file mode 100644 index 5520b223b..000000000 --- a/utilities/SimpleRTK/Testing/Unit/IOTest.py +++ /dev/null @@ -1,36 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ -from __future__ import print_function - -import SimpleRTK as srtk -import sys - -# this test is suppose to test the python interface to the IO classs - -if len ( sys.argv ) != 2: - print( "Usage: %s outputPath" % ( sys.argv[0] ) ) - -outputPath = sys.argv[1] - -image = srtk.Image( 10, 10, srtk.srtkInt32 ) - - -try: - srtk.WriteImage( image, "this.isafilenamewithnoimageio" ) -except RuntimeError as e: - print( "Caught expected error" ) diff --git a/utilities/SimpleRTK/Testing/Unit/IOTests.cxx b/utilities/SimpleRTK/Testing/Unit/IOTests.cxx deleted file mode 100644 index afe2a37f5..000000000 --- a/utilities/SimpleRTK/Testing/Unit/IOTests.cxx +++ /dev/null @@ -1,186 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include -#include -#include -#include -#include - -TEST(IO,ImageFileReader) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - - typedef std::map MapType; - MapType mapping; - - // Configure the mapping between filename and MD5 hash - mapping["Input/RA-Short.nrrd"] = "a963bd6a755b853103a2d195e01a50d3"; - mapping["Input/RA-Float.nrrd"] = "3ccccde44efaa3d688a86e94335c1f16"; - mapping["Input/RA-Slice-Short.nrrd"] = "22cdc0af7d51934a744b9c4fd4748cd1"; - mapping["Input/RA-Slice-Float.nrrd"] = "999078d36a4491d691cc93d8c3ed29fc"; - mapping["Input/Ramp-Zero-One-Float.nrrd"] = "f47efe1a6f48cb5cfe1aa23232f1168b"; - mapping["Input/Ramp-One-Zero-Float.nrrd"] = "0b18fac85955571d069b3666ff987119"; - mapping["Input/Ramp-Up-Short.nrrd"] = "86f2ea8a68b3069f33f2271829a30aa2"; - mapping["Input/Ramp-Down-Short.nrrd"] = "71f5c852a6251069fa1d60f796463343"; - mapping["Input/STAPLE1.png"] = "095f00a68a84df4396914fa758f34dcc"; - mapping["Input/STAPLE2.png"] = "301858f5eee39b092d28d9837f008fb8"; - - - // Loop over the map, load each file, and compare the hash value - for ( MapType::iterator it = mapping.begin(); it != mapping.end(); ++it ) { - reader.SetFileName ( dataFinder.GetFile ( it->first ) ); - EXPECT_EQ ( reader.GetFileName(), dataFinder.GetFile ( it->first ) ); - rtk::simple::Image image = reader.Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( it->second, hasher.Execute ( image ) ) << " reading " << it->first; - // Try the functional interface - EXPECT_EQ ( it->second, hasher.Execute ( rtk::simple::ReadImage ( dataFinder.GetFile ( it->first ) ) ) ) << "Functional interface"; - } - -} - -TEST(IO,ReadWrite) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - rtk::simple::ImageFileWriter writer; - - // From the command line utility - std::string md5 = "a963bd6a755b853103a2d195e01a50d3"; - std::string sha1 = "126ea8c3ef5573ca1e4e0deece920c2c4a4f38b5"; - - - rtk::simple::Image image = reader.SetFileName ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ) ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - - // Write it out - std::string filename = dataFinder.GetOutputFile ( "IO.ReadWrite.nrrd" ); - writer.SetFileName ( filename ).Execute ( image ); - ASSERT_TRUE ( dataFinder.FileExists ( filename ) ); - - image = reader.SetFileName ( filename ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - - // Make sure we wrote and read the file correctly - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - - // Again, with the functional interface - filename = dataFinder.GetOutputFile ( "IO.ReadWrite-Functional.nrrd" ); - rtk::simple::WriteImage ( image, filename ); - ASSERT_TRUE ( dataFinder.FileExists ( filename ) ); - - image = reader.SetFileName ( filename ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - - // Make sure we wrote and read the file correctly - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - -} - - -TEST(IO,2DFormats) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - - rtk::simple::Image image = reader.SetFileName ( dataFinder.GetFile ( "Input/RA-Slice-Short.png" ) ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ); - EXPECT_EQ ( "bf0f7bae60b0322222e224941c31f37a981901aa", hasher.Execute ( image ) ); - ASSERT_EQ ( 2u, image.GetDimension() ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 64u, image.GetHeight() ); - EXPECT_EQ ( 0u, image.GetDepth() ); - -} - -namespace srtk = rtk::simple; - -TEST(IO, SeriesReader) { - - std::vector< std::string > fileNames; - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - - srtk::ImageSeriesReader reader; - srtk::Image image = reader.SetFileNames ( fileNames ).Execute(); - EXPECT_EQ ( "b13c0a17109e3a5058e8f225c9ef2dbcf79ac240", srtk::Hash( image ) ); - EXPECT_EQ ( 3u, image.GetDimension() ); - EXPECT_EQ ( 256u, image.GetWidth() ); - EXPECT_EQ ( 256u, image.GetHeight() ); - EXPECT_EQ ( 3u, image.GetDepth() ); - - fileNames.push_back( dataFinder.GetFile ( "Input/WhiteDots.png" )); - image = srtk::ReadImage( fileNames ); - EXPECT_EQ ( "62fff5903956f108fbafd506e31c1e733e527820", srtk::Hash( image ) ); - EXPECT_EQ ( 4u, image.GetDepth() ); - - fileNames.resize(0); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - reader.SetFileNames ( fileNames ); - image = reader.Execute(); - EXPECT_EQ ( 3u, image.GetDepth() ); - EXPECT_EQ ( "bb42b8d3991132b4860adbc4b3f6c38313f52b4c", srtk::Hash( image ) ); - -} - -TEST(IO,WriteOptions) { - - srtk::ImageFileWriter writer; - - EXPECT_EQ( false, writer.GetUseCompression() ); - - writer.SetUseCompression( false ); - EXPECT_EQ( false, writer.GetUseCompression() ); - - writer.UseCompressionOn(); - EXPECT_EQ( true, writer.GetUseCompression() ); - - writer.UseCompressionOff(); - EXPECT_EQ( false, writer.GetUseCompression() ); - - srtk::Image image = srtk::ReadImage( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - EXPECT_EQ ( "0188164c9932359b3f33f176d0d73661c4dc04a8", srtk::Hash( image ) ); - - writer.Execute( image, dataFinder.GetOutputFile( "with_compression.nrrd" ), true ); - EXPECT_EQ( true, writer.GetUseCompression() ); - - writer.Execute( image, dataFinder.GetOutputFile( "without_compression.nrrd" ), false ); - EXPECT_EQ( false, writer.GetUseCompression() ); - -} - -TEST(IO,Write) { - - srtk::Image image = srtk::ReadImage( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - EXPECT_EQ ( "0188164c9932359b3f33f176d0d73661c4dc04a8", srtk::Hash( image ) ); - - ASSERT_THROW(srtk::WriteImage( image, dataFinder.GetOutputFile ( "this.isafilenamewithnoimageio" ) ), std::exception ) << "Checking for assert on bad output image name."; -} diff --git a/utilities/SimpleRTK/Testing/Unit/ImageIndexingTest.py b/utilities/SimpleRTK/Testing/Unit/ImageIndexingTest.py deleted file mode 100644 index 1f4484f3b..000000000 --- a/utilities/SimpleRTK/Testing/Unit/ImageIndexingTest.py +++ /dev/null @@ -1,156 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ -from __future__ import print_function -import sys -import unittest - - -import SimpleRTK as srtk -import numpy as np - - -class TestImageIndexingInterface(unittest.TestCase): - """This tests the indexing feature for the Image class. """ - - - def setUp(self): - pass - - def assertImageNDArrayEquals(self, img, nda, msg=""): - for p,n in zip(img, nda.flat): - self.assertEqual( p, n, msg ) - - - def _helper_check_srtk_to_numpy_type(self, srtkType, numpyType): - image = srtk.Image( (9, 10), srtkType, 1 ) - a = srtk.GetArrayFromImage( image ) - self.assertEqual( numpyType, a.dtype ) - self.assertEqual( (10, 9), a.shape ) - - - def test_2d(self): - """testing __getitem__ for 2D image""" - - nda = np.linspace(0, 14, 15 ).reshape(3,5) - - img = srtk.GetImageFromArray( nda ) - - self.assertEqual( img.GetSize(), (5,3) ) - - # check basic indexing - self.assertEqual( img[0,0], 0.0 ) - self.assertEqual( img[(1,0)], 1.0 ) - self.assertEqual( img[[2,0]], 2.0 ) - self.assertEqual( img[1,2], 11.0 ) - self.assertEqual( img[-1,-2], 9.0 ) - - # check default slice indexing - self.assertImageNDArrayEquals(img[:,:],nda) - self.assertImageNDArrayEquals(img[:],nda) - self.assertImageNDArrayEquals(img[::-1,::-1],nda[::-1,::-1]) - - # out of bounds cases and empty - self.assertEqual(len(img[:,5:6]), 0) - self.assertEqual(len(img[:,2:1]), 0) - self.assertEqual(len(img[-6:0,:]), 0) - self.assertEqual(len(img[0:0,:]), 0) - - - - self.assertImageNDArrayEquals(img[1:3,0:2], nda[0:2,1:3]) - self.assertImageNDArrayEquals(img[1:,2:],nda[2:,1:]) - self.assertImageNDArrayEquals(img[:3,:4],nda[:4,:3]) - self.assertImageNDArrayEquals(img[1:,2:],nda[2:,1:]) - - self.assertImageNDArrayEquals(img[1:4:2,0:2:2],nda[0:2:2,1:4:2]) - self.assertImageNDArrayEquals(img[1::2,0::2],nda[0::2,1::2]) - self.assertImageNDArrayEquals(img[:3:2,:2:2],nda[:2:2,:3:2]) - - - # some negative cases - self.assertImageNDArrayEquals(img[-4:-1,-2:-1],nda[-2:-1,-4:-1]) - self.assertImageNDArrayEquals(img[-4:-1:-2,-2:-1:1],nda[-2:-1:1,-4:-1:-2]) - self.assertImageNDArrayEquals(img[::-1,:],nda[:,::-1]) - - # check some exceptions - self.assertRaises(IndexError, lambda : img[0,3] ) - self.assertRaises(IndexError, lambda : img[5,0] ) - self.assertRaises(IndexError, lambda : img[5,0] ) - self.assertRaises(IndexError, lambda : img[-6,0] ) - self.assertRaises(IndexError, lambda : img[-5,-4] ) - self.assertRaises(IndexError, lambda : img[1] ) - self.assertRaises(IndexError, lambda : img[1,1,1] ) - - - def test_3d_extract(self): - """testing __getitem__ for extrating 2D slices from 3D image""" - - nda = np.linspace(0, 59, 60 ).reshape(3,4,5) - - img = srtk.GetImageFromArray( nda ) - - # check some exceptions - self.assertRaises(IndexError, lambda : img[0,3] ) - self.assertRaises(IndexError, lambda : img[:,0,3] ) - self.assertRaises(IndexError, lambda : img[:,1:1,3] ) - self.assertRaises(IndexError, lambda : img[:,1:0,3] ) - - self.assertImageNDArrayEquals(img[1], nda[:,:,1]) - self.assertImageNDArrayEquals(img[-1], nda[:,:,-1]) - self.assertImageNDArrayEquals(img[:,-2], nda[:,-2]) - self.assertImageNDArrayEquals(img[:,:,2], nda[2]) - - self.assertImageNDArrayEquals(img[::-1,:,-2], nda[-2,:,::-1]) - self.assertImageNDArrayEquals(img[::-1,0,1:-1], nda[1:-1,0,::-1]) - - - def test_3d(self): - """testing __getitem__ for extrating 2D slices from 3D image""" - - nda = np.linspace(0, 59, 60 ).reshape(3,4,5) - - img = srtk.GetImageFromArray( nda ) - - # check some exceptions - self.assertRaises(IndexError, lambda : img[0,3,0,0] ) - self.assertRaises(IndexError, lambda : img[0,4,0] ) - self.assertRaises(IndexError, lambda : img[0,0,3] ) - self.assertRaises(IndexError, lambda : img[-6,0,0] ) - self.assertRaises(IndexError, lambda : img[0,0,-4] ) - - # check basic indexing - self.assertEqual( img[0,0,0], 0.0 ) - self.assertEqual( img[(1,0,0)], 1.0 ) - self.assertEqual( img[[2,0,0]], 2.0 ) - self.assertEqual( img[3,2,1], 33.0 ) - self.assertEqual( img[-3,-2,-1], 52.0 ) - - - self.assertImageNDArrayEquals(img[1:-1,1:-1,1:-1], nda[1:-1,1:-1,1:-1]) - self.assertImageNDArrayEquals(img[:,:,1:2],nda[1:2,:,:]) - self.assertImageNDArrayEquals(img[1:5,2:4,0:2],nda[0:2,2:4,1:5]) - self.assertImageNDArrayEquals(img[1:,2:,:2],nda[:2,2:,1:]) - - # some negative cases - self.assertImageNDArrayEquals(img[::-1,::-1,::-1], nda[::-1,::-1,::-1]) - self.assertImageNDArrayEquals(img[:,::-2,::-1], nda[::-1,::-2,:]) - self.assertImageNDArrayEquals(img[-1:-4:-1,:,:], nda[:,:,-1:-4:-1]) - - -if __name__ == '__main__': - unittest.main() diff --git a/utilities/SimpleRTK/Testing/Unit/JavaImageFilterTestTemplate.java.in b/utilities/SimpleRTK/Testing/Unit/JavaImageFilterTestTemplate.java.in deleted file mode 100644 index f318abcb0..000000000 --- a/utilities/SimpleRTK/Testing/Unit/JavaImageFilterTestTemplate.java.in +++ /dev/null @@ -1,200 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -/* - * WARNING: DO NOT EDIT THIS FILE! - * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. - * Please look at JavaImageFilterTestTemplate.java.in to make changes. - */ - -package org.rtk.simple.testing; -import java.math.BigInteger; -// This is Java code to test ${name} -import org.rtk.simple.*; - -class ${name}Test { - - public static void main( String argv[] ) { - - // Get the right number of inputs - int num_inputs = 1; - $(if number_of_inputs then - OUT=[[num_inputs = ${number_of_inputs};]] - end) - - // Check the command line arguments - if ( argv.length < num_inputs + 1 ) { - System.out.println("Usage: ${name} tag output"); - return; - } - - String tag = argv[0]; - - // Instantiate objects - ImageFileReader reader = new ImageFileReader(); - ImageFileWriter writer = new ImageFileWriter(); - ${name} filter = new ${name}(); - - $(if #tests == 0 then - OUT=[[ - // No tests defined => exit with error code - System.out.println ( "No tests defined!" ); - System.exit ( 1 ); - ]] - end) - - // Run each testzf -$(foreach tests - if (tag.equals( "${tag}" )) { - - - Image[] inputs; - inputs = new Image[ ${#inputs} ]; - - // Read image(s) -$(for i=0,#inputs-1 do -OUT=OUT..[[ - inputs[]]..i..[[] = reader.setFileName( argv[]]..i..[[+1] ).execute(); -]] -end) - - CastImageFilter caster = new CastImageFilter(); -$(if inputA_cast then - OUT=[[ - caster.setOutputPixelType( PixelIDValueEnum.${inputA_cast}.swigValue() ); - inputs[0] = caster.execute( inputs[0] ); -]] -end)$(if inputB_cast then - OUT=[[ - caster.setOutputPixelType( PixelIDValueEnum.${inputB_cast}.swigValue() ); - inputs[1] = caster.execute( inputs[1] ); -]] -end) - - $(when settings - // Set parameters - $(foreach settings -$(if parameter == "SeedList" then - OUT=[[filter.clearSeeds(); - $(for i=1,#value do OUT=OUT .. "{\ - int v[] = " .. value[i] .. ";\ - VectorUInt32 idx = new VectorUInt32();\ - for (int i = 0; i < inputs[0].getDimension(); i++) {\ - idx.push_back(v[i]);\ - }\ - filter.addSeed(idx);\ - }\ - " end)]] -elseif parameter == "TrialPoints" then - OUT=[[filter.clearTrialPoints(); - $(for i=1,#value do OUT=OUT .. "{\ - int v[] = " .. value[i] .. ";\ - VectorUInt32 idx = new VectorUInt32();\ - for (int i = 0; i < inputs[0].getDimension(); i++) {\ - idx.push_back(v[i]);\ - }\ - filter.addTrialPoint(idx);\ - }\ - " end)]] -elseif dim_vec == 1 then - OUT=[[ - { - $(if type == "bool" then - OUT="Boolean" - elseif type == "unsigned int" then - OUT="int" - elseif type == "unsigned long" then - OUT="long" - elseif type == "unsigned short" then - OUT="short" - elseif type == "uint8_t" then - OUT="short" - elseif type == "uint16_t" then - OUT="short" - elseif type == "uint32_t" then - OUT="int" - elseif type == "uint64_t" then - OUT="long" - else - OUT="${type}" - end) v[] = $(if java_value then - OUT=OUT..java_value - else - OUT=OUT..'{' - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value]..'}' - end); - $(if type == "bool" then - OUT="VectorBool idx = new VectorBool( v.length );" - elseif type == "unsigned int" then - OUT="VectorUInt32 idx = new VectorUInt32( v.length );" - elseif type == "int" then - OUT="VectorInt32 idx = new VectorInt32( v.length );" - elseif type == "unsigned long" then - OUT="VectorULong idx = new VectorULong( v.length );" - elseif type == "long" then - OUT="VectorLong idx = new VectorLong( v.length );" - elseif type == "unsigned short" then - OUT="VectorUShort idx = new VectorUShort( v.length );" - elseif type == "short" then - OUT="VectorShort idx = new VectorShort( v.length );" - elseif type == "float" then - OUT="VectorFloat idx = new VectorFloat( v.length );" - elseif type == "double" then - OUT="VectorDouble idx = new VectorDouble( v.length );" - elseif type == "uint8_t" then - OUT="VectorUInt16 idx = new VectorUInt16( v.length );" - elseif type == "uint16_t" then - OUT="VectorUInt16 idx = new VectorUInt16( v.length );" - elseif type == "uint32_t" then - OUT="VectorUInt32 idx = new VectorUInt32( v.length );" - elseif type == "uint64_t" then - OUT="VectorUInt64 idx = new VectorUInt64( v.length );" - elseif type == "int8_t" then - OUT="VectorInt16 idx = new VectorInt16( v.length );" - elseif type == "int16_t" then - OUT="VectorInt16 idx = new VectorInt16( v.length );" - elseif type == "int32_t" then - OUT="VectorInt32 idx = new VectorInt32( v.length );" - elseif type == "int64_t" then - OUT="VectorInt64 idx = new VectorInt64( v.length );" - end) - - for (int i = 0; i < v.length; i++) { - idx.set( i, v[i] ); - } - filter.set${parameter}(idx); - }]] -else -OUT=[[ - filter.set${parameter}( $(if java_value then OUT='${java_value}' else OUT='${value}' end) );]] -end) -) -) - - // Run the filter - Image output = filter.execute ( $(if #inputs > 0 then OUT=[[inputs[0] ]] end)$(for inum=1,#inputs-1 do OUT=OUT..", inputs["..inum.."]" end) ); - - // Write output - writer.setFileName( argv[argv.length - 1] ).execute( output ); - } -) - } -} diff --git a/utilities/SimpleRTK/Testing/Unit/LuaImageFilterTestTemplate.lua.in b/utilities/SimpleRTK/Testing/Unit/LuaImageFilterTestTemplate.lua.in deleted file mode 100644 index e0247ff92..000000000 --- a/utilities/SimpleRTK/Testing/Unit/LuaImageFilterTestTemplate.lua.in +++ /dev/null @@ -1,132 +0,0 @@ ---========================================================================== --- --- Copyright Insight Software Consortium & RTK Consortium --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0.txt --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- ---==========================================================================*/ - --- --- WARNING: DO NOT EDIT THIS FILE! --- THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. --- Please look at LuaImageFilterTestTemplate.lua.in to make changes. --- - - --- This is Lua code to test ${name} - -inputs = 1 -$(if number_of_inputs then - OUT=[[inputs = ${number_of_inputs}]] - end) - -if #arg < inputs + 2 then - print ( "Usage: ${name} tag output" ) - os.exit ( 1 ) -end - -tag = arg[1]; - -reader = SimpleRTK.ImageFileReader() -writer = SimpleRTK.ImageFileWriter() -filter = SimpleRTK.${name}() - -$(if #tests == 0 then - OUT=[[print ( "No tests defined!" ); os.exit ( 1 );]] - end) - -$(foreach tests - if tag == "${tag}" then - $(when settings -$(foreach settings -$(if parameter == "SeedList" and lua_value then - OUT=[[filter:ClearSeeds(); - $(for i=1,#lua_value do OUT=OUT .. "\ - idx = SimpleRTK.VectorUInt32();\ - for _,v in ipairs(".. lua_value[i] ..") do idx:push_back(v) end\ - filter:AddSeed( idx );"end)]] -elseif parameter == "SeedList" then - OUT=[[filter:ClearSeeds(); - $(for i=1,#value do OUT=OUT .. "\ - idx = SimpleRTK.VectorUInt32();\ - for _,v in ipairs(".. value[i] ..") do idx:push_back(v) end\ - filter:AddSeed( idx );"end)]] -elseif parameter == "TrialPoints" and lua_value then - OUT=[[filter:ClearTrialPoints(); - $(for i=1,#lua_value do OUT=OUT .. "\ - idx = SimpleRTK.VectorUInt32();\ - for _,v in ipairs(".. lua_value[i] ..") do idx:push_back(v) end\ - filter:AddTrialPoint( idx );"end)]] -elseif parameter == "TrialPoints" then - OUT=[[filter:ClearTrialPoints(); - $(for i=1,#value do OUT=OUT .. "\ - idx = SimpleRTK.VectorUInt32();\ - for _,v in ipairs(".. value[i] ..") do idx:push_back(v) end\ - filter:AddTrialPoint( idx );"end)]] -elseif dim_vec and dim_vec == 1 then - if type == "bool" then - OUT="idx = SimpleRTK.VectorBool();" - elseif type == "int" then - OUT="idx = SimpleRTK.VectorInt32();" - elseif type == "double" then - OUT="idx = SimpleRTK.VectorDouble();" - else - OUT="idx = SimpleRTK.VectorUInt32();" - end - - OUT=OUT.. [[ - - for _,v in ipairs(]] -if lua_value then - OUT=OUT..'${lua_value}' -else - OUT=OUT..'{' - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value]..'}' -end -OUT=OUT..[[) do idx:push_back(v) end - filter:Set${parameter}( idx );]] -else -OUT=[[ - filter:Set${parameter}( $(if lua_value then OUT='${lua_value}' else OUT='${value}' end) );]] -end) -) -) - - inputs = {} - for i=2,#arg-1 do - print( "reading..."..arg[i] ); - table.insert( inputs, reader:SetFileName ( arg[i] ):Execute() ); - end - -$(if inputA_cast then -OUT=[[ - inputs[1] = SimpleRTK.Cast( inputs[1], SimpleRTK.${inputA_cast} ); - ]] -end) -$(if inputB_cast then -OUT=[[ - inputs[2] = SimpleRTK.Cast( inputs[2], SimpleRTK.${inputB_cast} ); - ]] -end) - - - - output = filter:Execute ( unpack( inputs ) ) - - writer:SetFileName ( arg[#arg] ):Execute ( output ) - end -) - diff --git a/utilities/SimpleRTK/Testing/Unit/PythonImageFilterTestTemplate.py.in b/utilities/SimpleRTK/Testing/Unit/PythonImageFilterTestTemplate.py.in deleted file mode 100644 index cdd02ba59..000000000 --- a/utilities/SimpleRTK/Testing/Unit/PythonImageFilterTestTemplate.py.in +++ /dev/null @@ -1,108 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -# -# WARNING: DO NOT EDIT THIS FILE! -# THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. -# Please look at PythonImageFilterTestTemplate.py.in to make changes. -# - -from __future__ import print_function - -# This is Python code to test ${name} -import SimpleRTK -import sys - -inputs = 1 -$(if number_of_inputs then - OUT=[[inputs = ${number_of_inputs}]] - end) - -if len ( sys.argv ) < inputs + 2: - print( "Usage: ${name} tag output" ) - sys.exit ( 1 ) - -tag = sys.argv[1] - -reader = SimpleRTK.ImageFileReader() -writer = SimpleRTK.ImageFileWriter() -filter = SimpleRTK.${name}() - -$(if #tests == 0 then - OUT=[[ -print( "No tests defined!" ) -sys.exit ( 1 ) - ]] - end) - -$(foreach tests -if tag == "${tag}": -$(when settings -$(foreach settings -$(if parameter == "SeedList" and python_value then - OUT=[[ filter.ClearSeeds() - filter$(for i=1,#python_value do OUT=OUT .. ".AddSeed( " .. python_value[i] .. " )" end)]] -elseif parameter == "SeedList" then - OUT=[[ filter.ClearSeeds() - filter$(for i=1,#value do OUT=OUT .. ".AddSeed( " .. value[i] .. " )" end)]] -elseif parameter == "TrialPoints" and python_value then - OUT=[[ filter.ClearTrialPoints() - filter$(for i=1,#python_value do OUT=OUT .. ".AddTrialPoint( " .. python_value[i] .. " )" end)]] -elseif parameter == "TrialPoints" then - OUT=[[ filter.ClearTrialPoints() - filter$(for i=1,#value do OUT=OUT .. ".AddTrialPoint( " .. value[i] .. " )" end)]] -elseif python_value then -OUT=[[ - filter.Set${parameter}( ${python_value} )]] -elseif dim_vec and dim_vec==1 then -OUT=[[ - filter.Set${parameter}( ( ]] - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value]..' ) )' -else -OUT=[[ - filter.Set${parameter}( ${value} )]] -end) -) -) - - inputs = [] - - for i in range(2, len(sys.argv)-1 ): - print( "reading ", sys.argv[i] ) - inputs.append( SimpleRTK.ReadImage( sys.argv[i] ) ); - - -$(if inputA_cast then -OUT=[[ - inputs[0] = SimpleRTK.Cast( inputs[0], SimpleRTK.${inputA_cast} ); - ]] -end) - -$(if inputB_cast then -OUT=[[ - inputs[1] = SimpleRTK.Cast( inputs[1], SimpleRTK.${inputB_cast} ); - ]] -end) - - output = filter.Execute( *tuple(inputs) ) - - writer.SetFileName ( sys.argv[-1] ).Execute ( output ) -) diff --git a/utilities/SimpleRTK/Testing/Unit/RArithmeticTest.R b/utilities/SimpleRTK/Testing/Unit/RArithmeticTest.R deleted file mode 100644 index cd16d5814..000000000 --- a/utilities/SimpleRTK/Testing/Unit/RArithmeticTest.R +++ /dev/null @@ -1,442 +0,0 @@ -## simple arithmetic tests for R. We are ensuring that operator overloading -## works and that the results are the same as for R arithmetic. We also -## use the image/array conversion routines -## -## do everything using floating point, to avoid dealing with 8bit precision - -library(SimpleRTK) - -testimA <- ReadImage(system.file("data/cthead1-Float.mha", package="SimpleRTK")) -testimB <- ReadImage(system.file("data/cthead1-Float.mha", package="SimpleRTK")) - -# need to cast to signed types to compare with R arithmetic -testimInt <- ReadImage(system.file("data/cthead1.png", package="SimpleRTK")) -testimInt <- Cast(testimInt, 'srtkInt16') - -testArrayA <- as.array(testimA) -testArrayB <- as.array(testimB) - -compareImArray <- function(im, Arr) - { - imA <- as.array(im) - if (any(is.nan(imA) != is.nan(Arr))) { - return(FALSE) - } - Arr[is.nan(Arr)] <- 0 - imA[is.nan(imA)] <- 0 - return(all(imA == Arr)) - } -compareBinImArray <- function(im, Arr) - { - imA <- as.array(im) > 0 - if (any(is.nan(imA) != is.nan(Arr))) { - return(FALSE) - } - Arr[is.nan(Arr)] <- 0 - imA[is.nan(imA)] <- 0 - return(all(imA == Arr)) - } -compareImArrayTol <- function(im, Arr, tol=1e-06) - { - # first check the NaNs - should match - imA <- as.array(im) - if (any(is.nan(imA) != is.nan(Arr))) { - return(FALSE) - } - if (any(is.infinite(imA) != is.infinite(Arr))) { - return(FALSE) - } - # reset NaN - Arr[is.nan(Arr)] <- 0 - imA[is.nan(imA)] <- 0 - # reset inf - Arr[is.infinite(Arr)] <- 0 - imA[is.infinite(imA)] <- 0 - - return(all(abs(imA - Arr)< tol) ) - } - -plusTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - - Im <- testimA + testimB - A <- testArrayA + testArrayB - - if (!compareImArray(Im, A)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - - ImC <- testimA + 101 - AC <- testArrayA + 101 - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- 101 + testimA - AC <- 101 + testArrayA - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - - } - -minusTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - - Im <- testimA - testimB - A <- testArrayA - testArrayB - - if (!compareImArray(Im, A)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- testimA - 101 - AC <- testArrayA - 101 - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- 101 - testimA - AC <- 101 - testArrayA - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } } - -multTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - - Im <- testimA * testimB - A <- testArrayA * testArrayB - - if (!compareImArray(Im, A)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- testimA * 101 - AC <- testArrayA * 101 - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- 101 * testimA - AC <- 101 * testArrayA - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - } -divTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - ## need to avoid 0/0. Also there is a difference in precision. - ## image is floating point, array is double precision, so we need - ## to include a tolerance - Im <- testimA / (testimB + 1) - A <- testArrayA / (testArrayB+1) - - if (!compareImArrayTol(Im, A)) { - cat("A failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- testimA / 101 - AC <- testArrayA / 101 - if (!compareImArrayTol(ImC, AC)) { - cat("B failure in", fname, "\n") - quit(save="no", status=1) - } - # srtk doesn't return infs - ImC <- 101/(testimA+1) - AC <- 101/(testArrayA+1) - if (!compareImArrayTol(ImC, AC, tol=1e-05)) { - cat("C failure in", fname, "\n") - quit(save="no", status=1) - } - } -powTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - ## There is a difference in precision. - ## image is floating point, array is double precision, so we need - ## to include a tolerance - p <- array(data=0.9, dim=dim(testArrayA)) - ip <- testimA * 0 + 0.9 - Im <- testimA ^ ip - A <- testArrayA ^ p - - if (!compareImArrayTol(Im, A, tol=5e-05)) { - cat("A failure in", fname, "\n") - quit(save="no", status=1) - } - ImC <- testimA ^ 0.9 - AC <- testArrayA ^ 0.9 - if (!compareImArrayTol(ImC, AC, tol=5e-05)) { - cat("B failure in", fname, "\n") - quit(save="no", status=1) - } - # there isn't a SimpleRTK function for this - #ImC <- 3.1^testimA - #AC <- 3.1^testArrayA - #if (!compareImArrayTol(ImC, AC)) { - # cat("failure in", fname, "\n") - # #quit(save="no", status=1) - #} - } -modTest <- function() - { - fname <- deparse(sys.call(0)[[1]]) - ## needs to use integer dividend and integer images. No support - ## for float in underlying srtk filter - ImC <- testimInt %% 3 - AC <- as.array(testimInt) %% 3 - if (!compareImArray(ImC, AC)) { - cat("failure in", fname, "\n") - quit(save="no", status=1) - } - } - -mathTest <- function() - { - # this will produce NaNs - need to compare them - mnames <- c('cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'abs', 'exp', 'sqrt', - 'log', 'log10') - for (n in mnames) { - Im <- eval(parse(text=paste(n, "(testimA/256)"))) - A <- eval(parse(text=paste(n, "(testArrayA/256)"))) - print(n) - if (!compareImArrayTol(Im, A, 1e-05)) - { - cat("failure in mathGroup", n, "\n") - quit(save="no", status=1) - } - } - - } - -logicTest <- function() - { - bin1 <- testimInt > 100 - bin2 <- testimInt > 120 - bA1 <- as.array(bin1) - bA2 <- as.array(bin2) - - r1 <- bin1 & bin2 - r2 <- bA1 & bA2 - if (!compareBinImArray(r1, r2)) - { - cat("failure in &\n") - quit(save="no", status=1) - } - - r1 <- bin1 | bin2 - r2 <- bA1 | bA2 - if (!compareBinImArray(r1, r2)) - { - cat("failure in |\n") - quit(save="no", status=1) - } - r1 <- xor(bin1, bin2) - r2 <- xor(bA1, bA2) - if (!compareBinImArray(r1, r2)) - { - cat("failure in xor\n") - quit(save="no", status=1) - } - - r1 <- !bin1 - r2 <- !bA1 - if (!compareBinImArray(r1, r2)) - { - cat("failure in !\n") - quit(save="no", status=1) - } - } - -compareTest <- function() - { - i0 <- testimInt - i1 <- 113 - i2 <- i0 + 1 - - a0 <- as.array(testimInt) - a1 <- 113 - a2 <- a0 + 1 - - r1 <- i0 == i1 - r2 <- a0 == a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in ==\n") - quit(save="no", status=1) - } - - r1 <- i0 != i1 - r2 <- a0 != a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in !=\n") - quit(save="no", status=1) - } - - r1 <- i0 <= i1 - r2 <- a0 <= a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <=\n") - quit(save="no", status=1) - } - - r1 <- i0 >= i1 - r2 <- a0 >= a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <=\n") - quit(save="no", status=1) - } - r1 <- i0 < i1 - r2 <- a0 < a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <\n") - quit(save="no", status=1) - } - - r1 <- i0 > i1 - r2 <- a0 > a1 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in >\n") - quit(save="no", status=1) - } -################################### - r1 <- i1 == i0 - r2 <- a1 == a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in ==\n") - quit(save="no", status=1) - } - - r1 <- i1 != i0 - r2 <- a1 != a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in !=\n") - quit(save="no", status=1) - } - - r1 <- i1 <= i0 - r2 <- a1 <= a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <=\n") - quit(save="no", status=1) - } - - r1 <- i1 >= i0 - r2 <- a1 >= a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in >=\n") - quit(save="no", status=1) - } - r1 <- i1 < i0 - r2 <- a1 < a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <\n") - quit(save="no", status=1) - } - - r1 <- i1 > i0 - r2 <- a1 > a0 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in >\n") - quit(save="no", status=1) - } - ## will need to be extended to support image comparison ops. -################################### - r1 <- i0 == i2 - r2 <- a0 == a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in ==\n") - quit(save="no", status=1) - } - - r1 <- i0 != i2 - r2 <- a0 != a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in !=\n") - quit(save="no", status=1) - } - - r1 <- i0 <= i2 - r2 <- a0 <= a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <=\n") - quit(save="no", status=1) - } - - r1 <- i0 >= i2 - r2 <- a0 >= a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in >=\n") - quit(save="no", status=1) - } - r1 <- i0 < i2 - r2 <- a0 < a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in <\n") - quit(save="no", status=1) - } - - r1 <- i0 > i2 - r2 <- a0 > a2 - - if (!compareBinImArray(r1, r2)) - { - cat("failure in >\n") - quit(save="no", status=1) - } - - } - -plusTest() -minusTest() -multTest() -divTest() -powTest() -modTest() -mathTest() -logicTest() -compareTest() - -quit(save="no", status=0) diff --git a/utilities/SimpleRTK/Testing/Unit/RImageFilterTestTemplate.R.in b/utilities/SimpleRTK/Testing/Unit/RImageFilterTestTemplate.R.in deleted file mode 100644 index 5a759afea..000000000 --- a/utilities/SimpleRTK/Testing/Unit/RImageFilterTestTemplate.R.in +++ /dev/null @@ -1,114 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -# -# WARNING: DO NOT EDIT THIS FILE! -# THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. -# Please look at RImageFilterTestTemplate.R.in to make changes. -# - -# -# This is R code to test ${name} -# - -library(SimpleRTK) - -inputs <- 1 -$(if number_of_inputs then - OUT=[[inputs <- ${number_of_inputs}]] - end) - -# arguments after --args -args <- commandArgs( TRUE ) - -numberOfArguments <- length(args) - -if ( numberOfArguments < inputs + 2) { - print ( "Usage: ${name} tag output" ) - quit( save="no", status=1 ) -} - -tag <- args[[1]] - -writer <- ImageFileWriter() -filter <- ${name}() - -$(if #tests == 0 then - OUT=[[ -print ( 'No tests defined!' ) -quit( save="no", status=1 ) - ]] - end) - -lastargument <- args[[numberOfArguments]] - -$(foreach tests -if(tag == "${tag}") { - $(when settings -$(foreach settings -$(if parameter == "SeedList" then - OUT=[[ - filter <- filter$$ClearSeeds() - $(for i=1,#value do - OUT=OUT .. "filter <- filter$$AddSeed( " .. R_value[i] .. " )\n" - end) - ]] -elseif R_value then -OUT=[[ - filter <- filter$$Set${parameter}( ${R_value} ) - ]] -elseif dim_vec and dim_vec==1 then -OUT=[[ - filter$$Set${parameter}( c( ]] - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value]..' ) )' -else -OUT=[[ - filter <- filter$$Set${parameter}( ${value} ) - ]] -end) -) -) - - inputs <- list() - if (length(args) >= 3) - { - for ( i in 3:length(args)-1 ) - { - inputs[[length(inputs)+1]] <- ReadImage( args[[i]] ) - } - } - -$(if inputA_cast then - OUT=" inputs[[1]] = Cast( inputs[[1]], '${inputA_cast}' )" -end) -$(if inputB_cast then - OUT=" inputs[[2]] = Cast( inputs[[2]], '${inputB_cast}' )" -end) - - output <- filter$$Execute ( $(if #inputs > 0 then OUT="inputs[[1]] " end)$(for inum=2,#inputs do OUT=OUT..", inputs[["..inum.."]]" end) ) - - writer <- writer$$SetFileName( lastargument ) - writer <- writer$$Execute( output ) - - } -) - -quit( save="no", status=0 ) diff --git a/utilities/SimpleRTK/Testing/Unit/RubyImageFilterTestTemplate.rb.in b/utilities/SimpleRTK/Testing/Unit/RubyImageFilterTestTemplate.rb.in deleted file mode 100644 index e18944096..000000000 --- a/utilities/SimpleRTK/Testing/Unit/RubyImageFilterTestTemplate.rb.in +++ /dev/null @@ -1,139 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -# -# WARNING: DO NOT EDIT THIS FILE! -# THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. -# Please look at RubyImageFilterTestTemplate.rb.in to make changes. -# - - -# This is Ruby code to test ${name} -require 'simplertk' - -inputs = 1 -$(if number_of_inputs then - OUT=[[inputs = ${number_of_inputs}]] - end) - -if ARGV.length < inputs + 2 then - puts( "Usage: ${name} tag output" ) - exit( 1 ) -end - -tag = ARGV[0]; - -reader = Simplertk::ImageFileReader.new -writer = Simplertk::ImageFileWriter.new -filter = Simplertk::${name}.new - -$(if #tests == 0 then - OUT=[[ -puts( "No tests defined!" ); -exit( 1 ); - ]] - end) - -$(foreach tests -if tag == "${tag}" then - $(when settings -$(foreach settings -$(if parameter == "SeedList" and ruby_value then - OUT=[[ filter.clear_seeds() - $(for i=1,#ruby_value do OUT=OUT .. "\ - v = Simplertk::VectorUInt32.new\ - for i in ".. ruby_value[i] .." do v << i end\ - filter.add_seed(v)" end)]] -elseif parameter == "SeedList"then - OUT=[[ filter.clear_seeds() - $(for i=1,#value do OUT=OUT .. "\ - v = Simplertk::VectorUInt32.new\ - for i in ".. value[i] .." do v << i end\ - filter.add_seed(v)" end)]] -elseif parameter == "TrialPoints" and ruby_value then - OUT=[[ filter.clear_trial_points() - $(for i=1,#ruby_value do OUT=OUT .. "\ - v = Simplertk::VectorUInt32.new\ - for i in ".. ruby_value[i] .." do v << i end\ - filter.add_trial_point(v)" end)]] -elseif parameter == "TrialPoints"then - OUT=[[ filter.clear_trial_points() - $(for i=1,#value do OUT=OUT .. "\ - v = Simplertk::VectorUInt32.new\ - for i in ".. value[i] .." do v << i end\ - filter.add_trial_point(v)" end)]] -elseif dim_vec and dim_vec == 1 then - - if type == "bool" then - OUT="v = Simplertk::VectorBool.new" - elseif type == "int" then - OUT="v = Simplertk::VectorInt32.new" - elseif type == "double" then - OUT="v = Simplertk::VectorDouble.new" - else - OUT="v = Simplertk::VectorUInt32.new" - end - -OUT=OUT..[[ - - for i in ]] -if ruby_value then - OUT='${ruby_value}' -else - OUT=OUT..'[ ' - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value]..' ]' -end -OUT=OUT..[[do v << i end - filter.set_${parameter:gsub ( "([a-z])([A-Z])", "%1_%2" ):lower()}(v)]] -else -OUT=[[ - filter.set_${parameter:gsub ( "([a-z])([A-Z])", "%1_%2" ):lower()}( $(if ruby_value then OUT='${ruby_value}' else OUT='${value}' end) ) ]] -end) -) -) - inputs = Array.new - - for i in 1..ARGV.length-2 - puts "reading.."+ARGV[i] - inputs.push( Simplertk::read_image( ARGV[i] ) ) - end -$(if inputA_cast then - --- the first char of the string needs to be converted to upper case -OUT=[[ - caster = Simplertk::CastImageFilter.new - caster.set_output_pixel_type( Simplertk::${inputA_cast:gsub("^%l", inputA_cast.upper ) }) - inputs[0] = caster.execute( inputs[0] ) ]] -end) -$(if inputB_cast then - --- the first char of the string needs to be converted to upper case -OUT=[[ - caster = Simplertk::CastImageFilter.new - caster.set_output_pixel_type( Simplertk::${inputB_cast:gsub("^%l", inputB_cast.upper ) }) - inputs[1] = caster.execute( inputs[1] ) ]] -end) - - output = filter.execute( *inputs ) - writer.set_file_name( ARGV[ARGV.length-1] ).execute( output ) -end -) - diff --git a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.cxx b/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.cxx deleted file mode 100644 index 1d037cffd..000000000 --- a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.cxx +++ /dev/null @@ -1,287 +0,0 @@ - -#include "SimpleRTKTestHarness.h" - -void DataFinder::SetRuntimeDirectoryFromArgv0 ( std::string argv0 ) - { - std::string errorMessage, path, dir, file; - bool result = itksys::SystemTools::FindProgramPath ( argv0.c_str(), path, errorMessage ); - mRuntimeDirectory = ""; - if ( result == false ) - { - std::cerr << "SetRuntimeDirectoryFromArgv0: couldn't determine the location of " - << argv0 << " error was: " << errorMessage << std::endl; - } - else - { - result = itksys::SystemTools::SplitProgramPath ( path.c_str(), dir, file ); - if ( result == false ) - { - std::cerr << "SetRuntimeDirectoryFromArgv0: couldn't split directory from path " << path << std::endl; - } - else - { - mRuntimeDirectory = dir; - } - } - } - -static void selectArch( std::vector& words ) - { - words.clear(); - -#ifdef OSX_ARCHITECTURES - - std::string osx_arch(OSX_ARCHITECTURES); - if (!osx_arch.length()) - { - // OSX_ARCHITECTURES has no value, so bail out - return; - } - - words.push_back("/usr/bin/arch"); - -#ifdef __x86_64__ - words.push_back("-x86_64"); -#endif -#ifdef __i386__ - words.push_back("-i386"); -#endif -#ifdef __ppc__ - words.push_back("-ppc"); -#endif -#ifdef __ppc64__ - words.push_back("-ppc64"); -#endif -#endif - } - - -std::vector DataFinder::FindExecutable ( std::string exe ) - { - return std::vector( 1, this->GetRuntimeDirectory() + "/" + exe + EXECUTABLE_SUFFIX ); - } - -std::vector DataFinder::GetLuaExecutable () - { - return this->FindExecutable ( "SimpleRTKLua" ); - } - -std::vector DataFinder::GetTclExecutable () - { - return this->FindExecutable ( "SimpleRTKTclsh" ); - } - -std::vector DataFinder::GetPythonExecutable () - { - std::vector words; - selectArch(words); - words.push_back(PYTHON_EXECUTABLE_PATH); - return words; - } - -std::vector DataFinder::GetRubyExecutable () - { - return std::vector ( 1, RUBY_EXECUTABLE_PATH ); - } - -std::vector DataFinder::GetRExecutable () - { - return std::vector ( 1, R_EXECUTABLE_PATH ); - } - -std::vector DataFinder::GetJavaExecutable () - { - std::vector words; - selectArch(words); - words.push_back(JAVA_EXECUTABLE_PATH); - -#ifdef OSX_ARCHITECTURES -#ifdef __x86_64__ - words.push_back("-d64"); -#endif -#ifdef __i386__ - words.push_back("-d32"); -#endif -#ifdef __ppc__ - words.push_back("-d32"); -#endif -#ifdef __ppc64__ - words.push_back("-d64"); -#endif -#endif - return words; - } - -std::vector DataFinder::GetCSharpCompiler () - { - return std::vector ( 1, CSHARP_COMPILER ); - } - -std::vector DataFinder::GetCSharpInterpreter () - { - return std::vector ( 1, CSHARP_INTERPRETER ); - } - -int ExternalProgramRunner::RunExecutable ( std::vector CommandLine, bool showOutput ) - { - std::string fullCommand; - for ( unsigned int idx = 0; idx < CommandLine.size(); idx++ ) { - fullCommand += CommandLine[idx]; - fullCommand += " "; - } - - if ( showOutput ) - { - std::cout << "Running command: '" << fullCommand << "'" << std::endl; - } - - // Allocate what we need - const char* StringCommandLine[256]; - for ( unsigned int idx = 0; idx < CommandLine.size(); idx++ ) - { - StringCommandLine[idx] = CommandLine[idx].c_str(); - } - StringCommandLine[CommandLine.size()] = NULL; - - itksysProcess* process = itksysProcess_New(); - itksysProcess_SetCommand ( process, StringCommandLine ); - itksysProcess_Execute ( process ); - - int status; - char* processData; - int processDataLength; - while ( 1 ) - { - status = itksysProcess_WaitForData ( process, &processData, &processDataLength, NULL ); - if ( status == itksysProcess_Pipe_STDOUT || status == itksysProcess_Pipe_STDERR ) - { - if ( showOutput ) - { - std::cout << std::string ( processData ) << std::endl; - } - } - else - { - // Nothing ready, so wait for the process to exit... - break; - } - } - - bool failed = false; - int ret = -1; - - itksysProcess_WaitForExit ( process, 0 ); - - switch (itksysProcess_GetState( process )) - { - case itksysProcess_State_Starting: - std::cerr << "No process has been executed." << std::endl; - failed = true; - break; - case itksysProcess_State_Executing: - std::cerr << "The process is still executing." << std::endl;; - failed = true; - break; - case itksysProcess_State_Expired: - std::cerr << "Child was killed when timeout expired." << std::endl; - failed = true; - break; - case itksysProcess_State_Exited: - ret = itksysProcess_GetExitValue(process); - break; - case itksysProcess_State_Killed: - std::cerr << "Child was killed by parent." << std::endl; - failed = true; - break; - case itksysProcess_State_Exception: - std::cerr << "Child terminated abnormally: " << itksysProcess_GetExceptionString( process ) << std::endl;; - failed = true; - break; - case itksysProcess_State_Disowned: - std::cerr << "Child was disowned." << std::endl; - failed = true; - break; - case itksysProcess_State_Error: - std::cerr << "Error in administrating child process: [" << itksysProcess_GetErrorString( process ) << "]" << std::endl; - failed = true; - break; - default: - std::cerr << "Unknown Process State" << std::endl; - failed = true; - }; - - itksysProcess_Delete ( process ); - - if ( failed ) - { - // HACK: GTest currently expects functions of void type, by - // using the comma operator we can get around this. - FAIL(), -1; - } - return ret; -} - - -void ExternalProgramRunner::CheckImageHash( const std::string &fileName, const std::string &hash ) - { - ASSERT_TRUE ( dataFinder.FileExists ( fileName ) ) << "check if " << fileName << " exists."; - - rtk::simple::Image image = rtk::simple::ReadImage( fileName ); - EXPECT_EQ ( hash, rtk::simple::Hash( image ) ); - } - -void ExternalProgramRunner::SetEnvironment ( std::string key, std::string value ) - { -#ifdef WIN32 - std::string v = key + "=" + value; - _putenv ( v.c_str() ); - std::cout << "SetEnvironment: " << v << std::endl; -#else - setenv ( key.c_str(), value.c_str(), 1 ); - std::cout << "SetEnvironment: " << key << "=" << value << std::endl; -#endif - } - -ProcessObjectCommand::ProcessObjectCommand(rtk::simple::ProcessObject &po) - : m_Process(po) -{ -} - -ProgressUpdate::ProgressUpdate(rtk::simple::ProcessObject &po) - : ProcessObjectCommand(po), - m_Progress(0.0) -{ -} - -void ProgressUpdate::Execute( ) -{ - std::cout << "Progress: " << m_Process.GetProgress() << std::endl; - m_Progress = m_Process.GetProgress(); -} - -AbortAtCommand::AbortAtCommand(rtk::simple::ProcessObject &po, float abortAt) - : ProcessObjectCommand(po), - m_AbortAt(abortAt) -{ -} - -void AbortAtCommand::Execute( ) -{ - std::cout << "p: " << m_Process.GetProgress() << std::endl; - if ( m_Process.GetProgress() >= m_AbortAt ) - { - std::cout << "aborting..." << std::endl; - m_Process.Abort(); - } -} - -CountCommand::CountCommand(rtk::simple::ProcessObject &po) - : ProcessObjectCommand(po), - m_Count(0) -{ -} - -void CountCommand::Execute( ) -{ - ++m_Count; -} diff --git a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.h b/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.h deleted file mode 100644 index c5357159c..000000000 --- a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarness.h +++ /dev/null @@ -1,234 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __SimpleRTKTestHarness_h -#define __SimpleRTKTestHarness_h - -// include ITK before STL to prevent warning in std::copy -#include - -#include -#include -#include -#include -#include -#include - -#include "srtkImage.h" -#include "srtkImageFileReader.h" -#include "srtkHashImageFilter.h" -#include "srtkCommand.h" - -// Class to help us find test data -// -/* - * DataFinder maintains several directory paths. It also - * helps us find executables. - * - * Set/GetDirectory -- Test Data directory - * should be ITK/Testing/Data - * Set/GetOutputDirectory -- Temporary directory - * SimpleRTK-build/Testing/Temporary - * Set/GetRuntimeDirectory -- Where built executables are found - * SimpleRTK-build/bin/$(OutDir)/ - * Set/GetLibraryDirectory -- Where built libraries are found - * SimpleRTK-build/lib - * GetOutputFile -- File in the temp directory - * GetBuildDirectory -- SimpleRTK-build - * FindExecutable -- Attempts to find an executable - * Returns GetExecutableDirectory + "/" + filename - */ -class DataFinder -{ - -public: - DataFinder () - { - mDirectory = TEST_HARNESS_DATA_DIRECTORY; - mOutputDirectory = TEST_HARNESS_TEMP_DIRECTORY; - mRuntimeDirectory = RUNTIME_OUTPUT_PATH; - mLibraryDirectory = LIBRARY_OUTPUT_PATH; - }; - - void SetDirectory ( const char* dir ) - { - mDirectory = dir; - }; - - void SetDirectory ( std::string dir ) - { - mDirectory = dir; - }; - - void SetRuntimeDirectoryFromArgv0 ( std::string argv0 ) ; - - void SetOutputDirectory ( std::string dir ) - { - mOutputDirectory = dir; - }; - - std::string GetDirectory () const { return mDirectory; }; - std::string GetOutputDirectory () const { return mOutputDirectory; }; - std::string GetOutputFile ( std::string filename ) - const { return mOutputDirectory + "/" + filename; }; - std::string GetRuntimeDirectory () const { return mRuntimeDirectory; } - std::string GetLibraryDirectory () const { return mLibraryDirectory; } - std::string GetBuildDirectory () const { return std::string ( SIMPLERTK_BINARY_DIR ); } - std::string GetPathSeparator () - { -#ifdef WIN32 - return ";"; -#else - return ":"; -#endif - } - - std::vector FindExecutable ( std::string exe ); - std::vector GetLuaExecutable (); - std::vector GetTclExecutable (); - std::vector GetPythonExecutable (); - std::vector GetRubyExecutable (); - std::vector GetRExecutable (); - std::vector GetJavaExecutable (); - std::vector GetCSharpCompiler (); - std::vector GetCSharpInterpreter (); - - std::string GetCSharpBinaryDirectory () { return std::string ( CSHARP_BINARY_DIRECTORY ); } - std::string GetSourceDirectory () { return std::string ( SIMPLERTK_SOURCE_DIR ); } - - bool FileExists ( const std::string &filename ) - { - return itksys::SystemTools::FileExists ( filename.c_str() ); - } - - std::string GetFile ( const std::string &filename ) - { - std::string name; - - name = mDirectory + "/" + filename; - if (this->FileExists(name)) - return name; - - // fall back to source code path - name = std::string(SIMPLERTK_SOURCE_DIR) + "/Testing/Data/" + filename; - - return name; - }; - -protected: - std::string mDirectory; - std::string mOutputDirectory; - std::string mRuntimeDirectory; - std::string mLibraryDirectory; -}; - -extern DataFinder dataFinder; - - -/// Class for running external programs -class ExternalProgramRunner : public testing::Test -{ -public: - - // check an image file that it matches the expected hash - void CheckImageHash ( const std::string &fileName, const std::string &hash ); - - // Return the separator - static std::string GetPathSeparator () - { -#ifdef WIN32 - return ";"; -#else - return ":"; -#endif - } - - /// \brief Set an environment variable - void SetEnvironment ( std::string key, std::string value ); - - /** \brief Run the command line specified in the list of arguments. - * Call FAIL if the executable fails returning -1, return the value returned by the - * process otherwise. - */ - int RunExecutable ( std::vector CommandLine, bool showOutput = false ); -}; - -class Python : public ExternalProgramRunner { }; -class Lua : public ExternalProgramRunner { }; -class Java : public ExternalProgramRunner { }; -class Tcl : public ExternalProgramRunner { }; -class R : public ExternalProgramRunner { }; -class Ruby : public ExternalProgramRunner { }; -class CSharp : public ExternalProgramRunner { }; - - -/** Base Command Class which holds onto a process object - */ -class ProcessObjectCommand - : public rtk::simple::Command -{ -public: - ProcessObjectCommand(rtk::simple::ProcessObject &po); - -protected: - rtk::simple::ProcessObject &m_Process; -}; - -/** Print the progress to the std::cout - */ -class ProgressUpdate - : public ProcessObjectCommand -{ -public: - ProgressUpdate(rtk::simple::ProcessObject &po); - - virtual void Execute( ); - - float m_Progress; -}; - -/** Command which will invoke ProcessObject::Abort when AbortAt - * progress is reached. - */ -class AbortAtCommand - : public ProcessObjectCommand -{ -public: - AbortAtCommand(rtk::simple::ProcessObject &po, float abortAt); - - virtual void Execute( ); - - float m_AbortAt; -}; - -/** Command which counts the number of time the command has been - * invoked. - */ -class CountCommand - : public ProcessObjectCommand -{ -public: - CountCommand(rtk::simple::ProcessObject &po); - - virtual void Execute( ); - - int m_Count; -}; - -#include "srtkImageCompare.h" - -#endif diff --git a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarnessPaths.h.in b/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarnessPaths.h.in deleted file mode 100644 index bc78e0b6a..000000000 --- a/utilities/SimpleRTK/Testing/Unit/SimpleRTKTestHarnessPaths.h.in +++ /dev/null @@ -1,54 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __SimpleRTKTestHarnessPaths_h -#define __SimpleRTKTestHarnessPaths_h - -#ifdef CMAKE_INTDIR - #define LIBRARY_OUTPUT_PATH "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" "/" CMAKE_INTDIR - #define RUNTIME_OUTPUT_PATH "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@" "/" CMAKE_INTDIR -#else - #define LIBRARY_OUTPUT_PATH "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" - #define RUNTIME_OUTPUT_PATH "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@" -#endif - -#define EXECUTABLE_SUFFIX "@CMAKE_EXECUTABLE_SUFFIX@" -#define SIMPLERTK_SOURCE_DIR "@SimpleRTK_SOURCE_DIR@" -#define SIMPLERTK_BINARY_DIR "@SimpleRTK_BINARY_DIR@" -#define TEST_HARNESS_TEMP_DIRECTORY "@TEST_HARNESS_TEMP_DIRECTORY@" -#define TEST_HARNESS_DATA_DIRECTORY "@TEST_HARNESS_DATA_DIRECTORY@" -#define PYTHON_EXECUTABLE_PATH "@VIRTUAL_PYTHON_EXECUTABLE@" -#define RSCRIPT_EXECUTABLE_PATH "@RSCRIPT_EXECUTABLE@" -#define R_EXECUTABLE_PATH "@R_COMMAND@" -#define JAVA_EXECUTABLE_PATH "@Java_JAVA_EXECUTABLE@" -#define JAVAC_EXECUTABLE_PATH "@Java_JAVAC_EXECUTABLE@" -#define RUBY_EXECUTABLE_PATH "@RUBY_EXECUTABLE@" -#define CSHARP_BINARY_DIRECTORY "@CSHARP_BINARY_DIRECTORY@" -#define CSHARP_COMPILER "@CSHARP_COMPILER@" -#define CSHARP_INTERPRETER "@CSHARP_INTERPRETER@" - -#define OSX_ARCHITECTURES "@CMAKE_OSX_ARCHITECTURES@" - -#cmakedefine WRAP_LUA -#cmakedefine WRAP_PYTHON -#cmakedefine WRAP_JAVA -#cmakedefine WRAP_CSHARP -#cmakedefine WRAP_TCL -#cmakedefine WRAP_R -#cmakedefine WRAP_RUBY - -#endif diff --git a/utilities/SimpleRTK/Testing/Unit/SimpleRTKUnitTestDriver.cxx b/utilities/SimpleRTK/Testing/Unit/SimpleRTKUnitTestDriver.cxx deleted file mode 100644 index 36105cdf9..000000000 --- a/utilities/SimpleRTK/Testing/Unit/SimpleRTKUnitTestDriver.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include - -#include -#include -#include "SimpleRTKTestHarness.h" - -DataFinder dataFinder; -int main(int argc, char* argv[]) -{ - for ( int i = 0; i < argc; i++ ) { - std::string arg = argv[i]; - if ( arg == "--help" ) { - std::cout << "GTest flags" << std::endl; - std::cout << "\t--gtest_list_tests List the tests" << std::endl; - std::cout << "\t--gtest_repeat Number of times to repeat each test" << std::endl; - std::cout << "\t--gtest_filter Glob filter of test name" << std::endl; - std::cout << "\t--gtest_print_time Time required to run" << std::endl; - std::cout << "\nBy default, a Google Test program runs all tests the user has defined. Sometimes, you want to run only a subset of the tests (e.g. for debugging or quickly verifying a change). If you set the GTEST_FILTER environment variable or the --gtest_filter flag to a filter string, Google Test will only run the tests whose full names (in the form of TestCaseName.TestName) match the filter.\n" - "The format of a filter is a ':'-separated list of wildcard patterns (called the positive patterns) optionally followed by a '-' and another ':'-separated pattern list (called the negative patterns). A test matches the filter if and only if it matches any of the positive patterns but does not match any of the negative patterns.\n" - "A pattern may contain '*' (matches any string) or '?' (matches any single character). For convenience, the filter '*-NegativePatterns' can be also written as '-NegativePatterns'.\n" - "For example:\n\n" - " * ./foo_test Has no flag, and thus runs all its tests.\n" - " * ./foo_test --gtest_filter=* Also runs everything, due to the single match-everything * value.\n" - " * ./foo_test --gtest_filter=FooTest.* Runs everything in test case FooTest.\n" - " * ./foo_test --gtest_filter=*Null*:*Constructor* Runs any test whose full name contains either \"Null\" or \"Constructor\".\n" - " * ./foo_test --gtest_filter=-*DeathTest.* Runs all non-death tests.\n" - " * ./foo_test --gtest_filter=FooTest.*-FooTest.Bar Runs everything in test case FooTest except FooTest.Bar. " << std::endl; - return 0; - } - } - testing::InitGoogleTest ( &argc, argv ); - dataFinder.SetRuntimeDirectoryFromArgv0 ( argv[0] ); - return RUN_ALL_TESTS(); -} diff --git a/utilities/SimpleRTK/Testing/Unit/TclImageFilterTestTemplate.tcl.in b/utilities/SimpleRTK/Testing/Unit/TclImageFilterTestTemplate.tcl.in deleted file mode 100644 index 34576d443..000000000 --- a/utilities/SimpleRTK/Testing/Unit/TclImageFilterTestTemplate.tcl.in +++ /dev/null @@ -1,103 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -# -# WARNING: DO NOT EDIT THIS FILE! -# THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. -# Please look at TclImageFilterTestTemplate.tcl.in to make changes. -# - - -# This is Tcl code to test ${name} - -$(if number_of_inputs then - OUT=[[set inputs ${number_of_inputs}]] - else - OUT=[[set inputs 1]] - end) - -if { [llength [set argv]] < ( [set inputs] + 1 ) } { - puts "Usage: ${name} tag output" - exit 1 -} -set tag [lindex [set argv] 0] -set ValidTags "" -ImageFileWriter writer -${name} filter - -$(if #tests == 0 then - OUT=[[puts "No tests defined!"; exit 1;]] - end) - -$(foreach tests -lappend ValidTags "${tag}" -if { [set tag] == "${tag}" } { - -$(when settings -$(foreach settings -$(if parameter == "SeedList" and tcl_value then -OUT=[[ filter ClearSeeds -$(for i=1,#tcl_value do OUT=OUT .. " filter AddSeed [list ".. tcl_value[i] .. "]\n" end)]] -elseif parameter == "SeedList" then -OUT=[[ filter ClearSeeds -$(for i=1,#value do OUT=OUT .. " filter AddSeed [list ".. value[i] .. "]\n" end)]] -elseif parameter == "TrialPoints" and tcl_value then -OUT=[[ filter ClearTrialPoints -$(for i=1,#tcl_value do OUT=OUT .. " filter AddTrialPoint [list ".. tcl_value[i] .. "]\n" end)]] -elseif parameter == "TrialPoints" then -OUT=[[ filter ClearTrialPoints -$(for i=1,#value do OUT=OUT .. " filter AddTrialPoint [list ".. value[i] .. "]\n" end)]] -elseif tcl_value then -OUT=[[ - filter Set${parameter} ${tcl_value}]] -elseif dim_vec and dim_vec==1 then -OUT=[[ - filter Set${parameter} [list $(for i=1,#value do OUT=OUT..value[i]..' ' end)] ]] -else -OUT=[[ - filter Set${parameter} ${value}]] -end) -)) - - set inputs {} - - for {set i 1} { $$i < $$argc-1 } {incr i } { - puts "reading [lindex $$argv $$i]" - lappend inputs [ ReadImage [lindex $$argv $$i] ] - } - -$(if inputA_cast then -OUT=[[ - set inputs [lreplace $$inputs 0 0 [ Cast [lindex $$inputs 0] [set ${inputA_cast}] ] ] - ]] -end) -$(if inputB_cast then -OUT=[[ - set inputs [lreplace $$inputs 1 1 [ Cast [lindex $$inputs 1] [set ${inputB_cast}] ] ] - ]] -end) - - set output [eval filter Execute $$inputs ] - - [writer SetFileName [lindex $$argv end] ] Execute $$output - exit -} -) - -puts stderr "Tag [set tag] was not found, must be one of [set ValidTags]" -exit 1 diff --git a/utilities/SimpleRTK/Testing/Unit/rtkHashImageFilterTest.cxx b/utilities/SimpleRTK/Testing/Unit/rtkHashImageFilterTest.cxx deleted file mode 100644 index 3637c8c0d..000000000 --- a/utilities/SimpleRTK/Testing/Unit/rtkHashImageFilterTest.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include -#include -#include -#include - -class HashImageFilterTest - : public ::testing::Test { -public: - - template - void CheckImageHashMD5( const std::string &fname, const std::string &expectedHash ) - { - - typedef itk::ImageFileReader > ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( dataFinder.GetFile ( fname ) ); - reader->Update(); - - typedef itk::HashImageFilter< itk::Image > HasherType; - typename HasherType::Pointer hasher = HasherType::New(); - hasher->SetHashFunction( HasherType::MD5 ); - hasher->SetInput( reader->GetOutput() ); - hasher->Update(); - - EXPECT_EQ ( expectedHash, hasher->GetHash() ); - - } - - template - void CheckImageHashSHA1( const std::string &fname, const std::string &expectedHash ) - { - - typedef itk::ImageFileReader > ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( dataFinder.GetFile ( fname ) ); - reader->Update(); - - typedef itk::HashImageFilter< itk::Image > HasherType; - typename HasherType::Pointer hasher = HasherType::New(); - hasher->SetHashFunction( HasherType::SHA1 ); - hasher->SetInput( reader->GetOutput() ); - hasher->Update(); - - EXPECT_EQ ( expectedHash, hasher->GetHash() ); - - } -}; - -TEST_F(HashImageFilterTest, InstantiateTest) { - - typedef itk::HashImageFilter< itk::Image< unsigned char, 1> > UCHAR1HasherType; - EXPECT_TRUE( UCHAR1HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image< unsigned char, 2> > UCHAR2HasherType; - EXPECT_TRUE( UCHAR2HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image< unsigned char, 3> > UCHAR3HasherType; - EXPECT_TRUE( UCHAR3HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image< unsigned int, 3> > UINT23HasherType; - EXPECT_TRUE( UINT23HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image > INT23HasherType; - EXPECT_TRUE( INT23HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image > FLOATHasherType; - EXPECT_TRUE( INT23HasherType::New().IsNotNull() ); - - typedef itk::HashImageFilter< itk::Image > DOUBLEHasherType; - EXPECT_TRUE( INT23HasherType::New().IsNotNull() ); - -}; - - -TEST_F(HashImageFilterTest, MD5HashValues ) { - - this->CheckImageHashMD5("Input/RA-Float.nrrd", "3ccccde44efaa3d688a86e94335c1f16"); - - this->CheckImageHashMD5("Input/RA-Float.nrrd", "16142594b185c50d64dd629750b94c90"); - - this->CheckImageHashMD5("Input/RA-Float.nrrd", "606f0ee67f5b181f90286e17e6f49926"); - - this->CheckImageHashMD5("Input/Ramp-Down-Short.nrrd", "71f5c852a6251069fa1d60f796463343" ); - - this->CheckImageHashMD5("Input/Ramp-Down-Short.nrrd", "f945b2b5384ba6f21a0fd50a970fb5ff"); -} - - -TEST_F(HashImageFilterTest, SHA1HashValues ) { - - this->CheckImageHashSHA1("Input/RA-Float.nrrd", "b187541bdcc89843d0a25a3761f344c358f3518a" ); - - this->CheckImageHashSHA1("Input/RA-Float.nrrd", "7bd2146732f1e6f38fe5ed387332d3ad3541b182" ); - - this->CheckImageHashSHA1("Input/RA-Float.nrrd", "0eac9ac1f19b27743dfeabe76e69ae251c02b641" ); - - this->CheckImageHashSHA1("Input/Ramp-Down-Short.nrrd", "4b0bd9dcf1f7d78101ce24da7f51de212f302ae9" ); - - this->CheckImageHashSHA1("Input/Ramp-Down-Short.nrrd", "3dc54908746f25fd42f17c5fe44935013e508b1b" ); -} - -TEST_F(HashImageFilterTest, VectorImages ) { - - // test image of vectors - { - typedef itk::Image, 3 > VectorImageType; - - typedef itk::ImageFileReader ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( dataFinder.GetFile ( "Input/RA-Float.nrrd" ) ); - reader->Update(); - - typedef itk::HashImageFilter< VectorImageType > HasherType; - HasherType::Pointer hasher = HasherType::New(); - hasher->SetHashFunction( HasherType::MD5 ); - hasher->SetInput( reader->GetOutput() ); - hasher->Update(); - - EXPECT_EQ( hasher->GetHash(), "3ccccde44efaa3d688a86e94335c1f16" ); - } - - // test vector image - { - typedef itk::VectorImage VectorImageType; - - typedef itk::ImageFileReader ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( dataFinder.GetFile ( "Input/RA-Float.nrrd" ) ); - reader->Update(); - - typedef itk::HashImageFilter< VectorImageType > HasherType; - HasherType::Pointer hasher = HasherType::New(); - hasher->SetHashFunction( HasherType::MD5 ); - hasher->SetInput( reader->GetOutput() ); - hasher->Update(); - - - EXPECT_EQ( hasher->GetHash(), "3ccccde44efaa3d688a86e94335c1f16" ); - } -} - -TEST_F(HashImageFilterTest, LabelMap ) { - - rtk::simple::Image img = rtk::simple::ReadImage( dataFinder.GetFile ( "Input/2th_cthead1.png" ) ); - - std::string hash; - - EXPECT_NO_THROW( hash = rtk::simple::Hash( rtk::simple::Cast( img, rtk::simple::srtkLabelUInt16 ) ) ); - EXPECT_EQ( hash, "134248ff026387fe17bd0bfa62357fa390d52985" ); - - EXPECT_NO_THROW( hash = rtk::simple::Hash( rtk::simple::Cast( img, rtk::simple::srtkLabelUInt32 ) ) ); - EXPECT_EQ( hash, "c4dc6e128902159fe04cacec27b784cd995533af" ); - -} - -TEST_F(HashImageFilterTest, Coverage ) { - - typedef itk::HashImageFilter< itk::Image< unsigned char, 2> > UCHAR2HasherType; - UCHAR2HasherType::Pointer hasher = UCHAR2HasherType::New(); - - // PrintSelf - std::ostringstream out; - out << hasher; - EXPECT_NE ( out.str(), "" ); // So the test fails if we don’t have any print self output... - - - // Set/Get Methods - hasher->SetHashFunction( UCHAR2HasherType::MD5 ); - EXPECT_EQ( hasher->GetHashFunction(), UCHAR2HasherType::MD5 ) << "expected default hash type to be MD5"; - - hasher->SetHashFunction( UCHAR2HasherType::SHA1 ); - EXPECT_EQ( hasher->GetHashFunction(), UCHAR2HasherType::SHA1 ) << "expected default hash type to be SHA1"; -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkBasicFiltersTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkBasicFiltersTests.cxx deleted file mode 100644 index 3dce97353..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkBasicFiltersTests.cxx +++ /dev/null @@ -1,240 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "itkVectorImage.h" - -TEST(BasicFilters,ImageFilter) { - namespace srtk = rtk::simple; - - srtk::CastImageFilter caster; - srtk::ImageFilter<1> &filter = caster; - - filter.DebugOn(); -} - -TEST(BasicFilters,ProcessObject_Debug) { - namespace srtk = rtk::simple; - - srtk::CastImageFilter caster; - srtk::ProcessObject &filter = caster; - - EXPECT_FALSE(filter.GetGlobalDefaultDebug()); - EXPECT_FALSE(filter.GetDebug()); - - filter.DebugOff(); - EXPECT_FALSE(filter.GetDebug()); - EXPECT_FALSE(filter.GetGlobalDefaultDebug()); - - filter.DebugOn(); - EXPECT_TRUE(filter.GetDebug()); - EXPECT_FALSE(filter.GetGlobalDefaultDebug()); - - filter.GlobalDefaultDebugOn(); - EXPECT_TRUE(filter.GetDebug()); - EXPECT_TRUE(filter.GetGlobalDefaultDebug()); - - filter.GlobalDefaultDebugOff(); - EXPECT_TRUE(filter.GetDebug()); - EXPECT_FALSE(filter.GetGlobalDefaultDebug()); - - filter.GlobalDefaultDebugOn(); - - srtk::CastImageFilter caster2; - EXPECT_TRUE(caster2.GetDebug()); - EXPECT_TRUE(caster2.GetGlobalDefaultDebug()); - -} - -TEST(BasicFilters,ProcessObject_NumberOfThreads) { - namespace srtk = rtk::simple; - - srtk::CastImageFilter caster; - srtk::ProcessObject &filter = caster; - - unsigned int gNum = filter.GetGlobalDefaultNumberOfThreads(); - EXPECT_NE(filter.GetGlobalDefaultNumberOfThreads(), 0u); - EXPECT_NE(filter.GetNumberOfThreads(), 0u); - EXPECT_EQ(filter.GetNumberOfThreads(), filter.GetGlobalDefaultNumberOfThreads()); - - filter.SetNumberOfThreads(3); - EXPECT_EQ(3u, filter.GetNumberOfThreads()); - EXPECT_EQ(gNum, filter.GetGlobalDefaultNumberOfThreads()); - - filter.SetGlobalDefaultNumberOfThreads(gNum+1); - EXPECT_EQ(gNum+1, filter.GetGlobalDefaultNumberOfThreads()); - EXPECT_EQ(3u, filter.GetNumberOfThreads()); - - srtk::CastImageFilter caster2; - EXPECT_EQ(gNum+1, caster2.GetNumberOfThreads()); - EXPECT_EQ(gNum+1, caster2.GetGlobalDefaultNumberOfThreads()); -} - -TEST(BasicFilters,Cast) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - - reader.SetFileName ( dataFinder.GetFile ( "Input/RA-Float.nrrd" ) ); - rtk::simple::Image image = reader.Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( "3ccccde44efaa3d688a86e94335c1f16", hasher.Execute ( image ) ); - - EXPECT_EQ ( image.GetPixelIDValue(), rtk::simple::srtkFloat32 ); - EXPECT_EQ ( image.GetPixelID(), rtk::simple::srtkFloat32 ); - EXPECT_EQ ( image.GetPixelIDTypeAsString(), "32-bit float" ); - - typedef std::map MapType; - MapType mapping; - mapping["2f27e9260baeba84fb83dd35de23fa2d"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkUInt8; - mapping["2f27e9260baeba84fb83dd35de23fa2d"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkInt8; - mapping["a963bd6a755b853103a2d195e01a50d3"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkUInt16; - mapping["a963bd6a755b853103a2d195e01a50d3"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkInt16; - mapping["6ceea0011178a955b5be2d545d107199"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkUInt32; - mapping["6ceea0011178a955b5be2d545d107199"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkInt32; - mapping["efa4c3b27349b97b02a64f3d2b5ca9ed"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkUInt64; - mapping["efa4c3b27349b97b02a64f3d2b5ca9ed"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkInt64; - mapping["3ccccde44efaa3d688a86e94335c1f16"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkFloat32; - mapping["ac0228acc17038fd1f1ed28eb2841c73"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkFloat64; - mapping["226dabda8fc07f20e2b9e44ca1c83955"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkComplexFloat32; - mapping["e92cbb187a92610068d7de0cb23364db"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkComplexFloat64; - mapping["2f27e9260baeba84fb83dd35de23fa2d"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorUInt8; - mapping["2f27e9260baeba84fb83dd35de23fa2d"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorInt8; - mapping["a963bd6a755b853103a2d195e01a50d3"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorUInt16; - mapping["a963bd6a755b853103a2d195e01a50d3"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorInt16; - mapping["6ceea0011178a955b5be2d545d107199"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorUInt32; - mapping["6ceea0011178a955b5be2d545d107199"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorInt32; - mapping["efa4c3b27349b97b02a64f3d2b5ca9ed"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorUInt64; - mapping["efa4c3b27349b97b02a64f3d2b5ca9ed"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorInt64; - mapping["3ccccde44efaa3d688a86e94335c1f16"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorFloat32; - mapping["ac0228acc17038fd1f1ed28eb2841c73"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkVectorFloat64; - mapping["srtkLabelUInt8"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkLabelUInt8; - mapping["srtkLabelUInt16"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkLabelUInt16; - mapping["srtkLabelUInt32"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkLabelUInt32; - mapping["srtkLabelUInt64"] = (rtk::simple::PixelIDValueType)rtk::simple::srtkLabelUInt64; - - bool failed = false; - - // Loop over the map, load each file, and compare the hash value - for ( MapType::iterator it = mapping.begin(); it != mapping.end(); ++it ) - { - rtk::simple::PixelIDValueType pixelID = it->second; - std::string hash = it->first; - - std::cerr << std::flush; - std::cerr << std::flush; - if ( pixelID == rtk::simple::srtkUnknown ) - { - std::cerr << "Enum value: " << pixelID << " (" << hash << ") is unknown and not instantiated" << std::endl; - continue; - } - - std::cerr << "Testing casting to pixelID: " << pixelID << " is " << rtk::simple::GetPixelIDValueAsString ( pixelID ) << std::endl; - - try - { - rtk::simple::CastImageFilter caster; - rtk::simple::Image test = caster.SetOutputPixelType ( pixelID ).Execute ( image ); - - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( hash, hasher.Execute ( test ) ) << "Cast to " << rtk::simple::GetPixelIDValueAsString ( pixelID ); - - } - catch ( ::rtk::simple::GenericException &e ) - { - - // hashing currently doesn't work for label images - if ( hash.find( "srtkLabel" ) == 0 ) - { - std::cerr << "Hashing currently is not implemented for Label Images" << std::endl; - } - else - { - failed = true; - std::cerr << "Failed to hash: " << e.what() << std::endl; - } - - continue; - } - - } - EXPECT_FALSE ( failed ) << "Cast failed, or could not take the hash of the imoge"; - -} - -TEST(BasicFilters,HashImageFilter) { - rtk::simple::HashImageFilter hasher; - EXPECT_EQ ( "rtk::simple::HashImageFilter\nHashFunction: SHA1\n", hasher.ToString() ); - EXPECT_EQ ( rtk::simple::HashImageFilter::SHA1, hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).GetHashFunction() ); - EXPECT_EQ ( rtk::simple::HashImageFilter::MD5, hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ).GetHashFunction() ); -} - -TEST(BasicFilters,Cast_Commands) { - // test cast filter with a bunch of commands - - namespace srtk = rtk::simple; - srtk::Image img = srtk::ReadImage( dataFinder.GetFile ( "Input/RA-Short.nrrd" ) ); - EXPECT_EQ ( "a963bd6a755b853103a2d195e01a50d3", srtk::Hash(img, srtk::HashImageFilter::MD5)); - - srtk::CastImageFilter caster; - caster.SetOutputPixelType( srtk::srtkInt32 ); - - ProgressUpdate progressCmd(caster); - caster.AddCommand(srtk::srtkProgressEvent, progressCmd); - - CountCommand abortCmd(caster); - caster.AddCommand(srtk::srtkAbortEvent, abortCmd); - - CountCommand deleteCmd(caster); - caster.AddCommand(srtk::srtkDeleteEvent, deleteCmd); - - CountCommand endCmd(caster); - caster.AddCommand(srtk::srtkEndEvent, endCmd); - - CountCommand iterCmd(caster); - caster.AddCommand(srtk::srtkIterationEvent, iterCmd); - - CountCommand startCmd(caster); - caster.AddCommand(srtk::srtkStartEvent, startCmd); - - CountCommand userCmd(caster); - caster.AddCommand(srtk::srtkUserEvent, userCmd); - - - srtk::Image out = caster.Execute(img); - EXPECT_EQ ( "6ceea0011178a955b5be2d545d107199", srtk::Hash(out, srtk::HashImageFilter::MD5)); - - EXPECT_EQ ( 1.0f, caster.GetProgress() ); - EXPECT_EQ ( 1.0f, progressCmd.m_Progress ); - EXPECT_EQ ( 0, abortCmd.m_Count ); - EXPECT_EQ ( 1, deleteCmd.m_Count ); - EXPECT_EQ ( 1, endCmd.m_Count ); - EXPECT_EQ ( 0, iterCmd.m_Count ); - EXPECT_EQ ( 1, startCmd.m_Count ); - EXPECT_EQ ( 0, userCmd.m_Count ); - -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkCommonTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkCommonTests.cxx deleted file mode 100644 index 9b37a04ce..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkCommonTests.cxx +++ /dev/null @@ -1,512 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include - -#include -#include -#include -#include - -TEST( ConditionalTest, ConditionalTest1 ) { - - // a quick check to make sure the conditional works - typedef rtk::simple::Conditional::Type IntType; - typedef rtk::simple::Conditional::Type FloatType; - - - EXPECT_EQ ( typeid( IntType ).name(), typeid( int ).name() ); - EXPECT_EQ ( typeid( FloatType ).name(), typeid( float ).name() ); - - return; - -} - -TEST( ProcessObject, GlobalWarning ) { - // Basic coverage test of setting and getting. Need separate - // specific check for propagation of warning to ITK. - - namespace srtk = rtk::simple; - - EXPECT_TRUE( srtk::ProcessObject::GetGlobalWarningDisplay() ); - - srtk::ProcessObject::GlobalWarningDisplayOff(); - EXPECT_FALSE( srtk::ProcessObject::GetGlobalWarningDisplay() ); - - srtk::ProcessObject::GlobalWarningDisplayOn(); - EXPECT_TRUE( srtk::ProcessObject::GetGlobalWarningDisplay() ); - - srtk::ProcessObject::SetGlobalWarningDisplay(false); - EXPECT_FALSE( srtk::ProcessObject::GetGlobalWarningDisplay() ); - -} - - -TEST( ProcessObject, Command_Register ) { - // Test the references between Process Objects and command. - // Try to be mean and break stuff - - namespace srtk = rtk::simple; - - // Case 0a: stack, command first - { - srtk::Command cmd; - srtk::CastImageFilter po1; - po1.AddCommand(srtk::srtkAnyEvent, cmd); - EXPECT_TRUE(po1.HasCommand(srtk::srtkAnyEvent)); - } - - // Case 0b: stack, process first - { - srtk::CastImageFilter po1; - srtk::Command cmd; - po1.AddCommand(srtk::srtkAnyEvent, cmd); - EXPECT_TRUE(po1.HasCommand(srtk::srtkAnyEvent)); - } - - // Case 1a: single command, command deleted first - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr cmd(new srtk::Command()); - po1->AddCommand(srtk::srtkAnyEvent, *cmd); - - EXPECT_TRUE(po1->HasCommand(srtk::srtkAnyEvent)); - cmd.reset(); - EXPECT_FALSE(po1->HasCommand(srtk::srtkAnyEvent)); - } - - // Case 1b: single command, process deleted first - { - std::auto_ptr po1( new srtk::CastImageFilter()); - std::auto_ptr cmd(new srtk::Command()); - po1->AddCommand(srtk::srtkAnyEvent, *cmd); - po1.reset(); - } - - // Case 2a: single command, multiple processes, command deleted first - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr po2(new srtk::CastImageFilter()); - std::auto_ptr po3(new srtk::CastImageFilter()); - - std::auto_ptr cmd(new srtk::Command()); - po1->AddCommand(srtk::srtkAnyEvent, *cmd); - po2->AddCommand(srtk::srtkStartEvent, *cmd); - po3->AddCommand(srtk::srtkEndEvent, *cmd); - cmd.reset(); - } - - // Case 2b: single command, multiple processes, processes mostly deleted first - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr po2(new srtk::CastImageFilter()); - std::auto_ptr po3(new srtk::CastImageFilter()); - - std::auto_ptr cmd(new srtk::Command()); - po1->AddCommand(srtk::srtkAnyEvent, *cmd); - po2->AddCommand(srtk::srtkStartEvent, *cmd); - po3->AddCommand(srtk::srtkEndEvent, *cmd); - - EXPECT_TRUE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po2->HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po3->HasCommand(srtk::srtkEndEvent)); - - po1.reset(); - EXPECT_TRUE(po2->HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po3->HasCommand(srtk::srtkEndEvent)); - po2.reset(); - EXPECT_TRUE(po3->HasCommand(srtk::srtkEndEvent)); - cmd.reset(); - EXPECT_FALSE(po3->HasCommand(srtk::srtkEndEvent)); - } - - // Case 3a: multiple commands, command deleted mostly first - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr cmd1(new srtk::Command()); - std::auto_ptr cmd2(new srtk::Command()); - std::auto_ptr cmd3(new srtk::Command()); - - po1->AddCommand(srtk::srtkAnyEvent, *cmd1); - po1->AddCommand(srtk::srtkStartEvent, *cmd2); - po1->AddCommand(srtk::srtkEndEvent, *cmd3); - - EXPECT_TRUE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkEndEvent)); - - cmd1.reset(); - EXPECT_FALSE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkEndEvent)); - cmd2.reset(); - EXPECT_FALSE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_FALSE(po1->HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkEndEvent)); - po1.reset(); - } - - // Case 3b: multiple commands, process object deleted first - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr cmd1(new srtk::Command()); - std::auto_ptr cmd2(new srtk::Command()); - std::auto_ptr cmd3(new srtk::Command()); - po1->AddCommand(srtk::srtkAnyEvent, *cmd1); - po1->AddCommand(srtk::srtkStartEvent, *cmd2); - po1->AddCommand(srtk::srtkEndEvent, *cmd3); - po1.reset(); - - } - - -} - -TEST( ProcessObject, Command_Add ) { - // Add command for events and verifies the state - - namespace srtk = rtk::simple; - - srtk::CastImageFilter po1; - srtk::Command cmd; - - // check initial state - EXPECT_FALSE(po1.HasCommand(srtk::srtkAnyEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkAbortEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkDeleteEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkEndEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkIterationEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkProgressEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkStartEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkUserEvent)); - - po1.AddCommand(srtk::srtkAnyEvent, cmd); - EXPECT_TRUE(po1.HasCommand(srtk::srtkAnyEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkAbortEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkDeleteEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkEndEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkIterationEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkProgressEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkStartEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkUserEvent)); - - po1.RemoveAllCommands(); - EXPECT_FALSE(po1.HasCommand(srtk::srtkAnyEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkAbortEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkDeleteEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkEndEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkIterationEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkProgressEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkStartEvent)); - EXPECT_FALSE(po1.HasCommand(srtk::srtkUserEvent)); - - po1.AddCommand(srtk::srtkAnyEvent, cmd); - po1.AddCommand(srtk::srtkAbortEvent, cmd); - po1.AddCommand(srtk::srtkDeleteEvent, cmd); - po1.AddCommand(srtk::srtkEndEvent, cmd); - po1.AddCommand(srtk::srtkIterationEvent, cmd); - po1.AddCommand(srtk::srtkProgressEvent, cmd); - po1.AddCommand(srtk::srtkStartEvent, cmd); - po1.AddCommand(srtk::srtkUserEvent, cmd); - - EXPECT_TRUE(po1.HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkAbortEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkDeleteEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkEndEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkIterationEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkProgressEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkStartEvent)); - EXPECT_TRUE(po1.HasCommand(srtk::srtkUserEvent)); -} - -TEST( ProcessObjectDeathTest, DeleteCommandActiveProcess ) -{ - // if a command is deleted while the process is active, it is - // expected for the program to terminate. - namespace srtk = rtk::simple; - - class DeleteCommandAtCommand - : public ProcessObjectCommand - { - public: - DeleteCommandAtCommand(rtk::simple::ProcessObject &po, float abortAt, Command *cmd) - : ProcessObjectCommand(po), - m_AbortAt(abortAt), - m_Cmd(cmd) - { - } - - virtual void Execute( ) - { - if ( m_Process.GetProgress() >= m_AbortAt ) - delete m_Cmd; - } - - float m_AbortAt; - Command *m_Cmd; -}; - - srtk::CastImageFilter po; - srtk::Image img(100,100,100, srtk::srtkUInt16); - - srtk::Command *cmd1 = new srtk::Command(); - DeleteCommandAtCommand cmd2(po, .01, cmd1); - - po.AddCommand(srtk::srtkAnyEvent, *cmd1); - po.AddCommand(srtk::srtkProgressEvent, cmd2); - - - po.SetNumberOfThreads(1); - ::testing::FLAGS_gtest_death_test_style = "fast"; - - ASSERT_DEATH(po.Execute(img), "Cannot delete Command during execution"); - -} - - -TEST( Event, Test1 ) -{ - // Test print of EventEnum with output operator - namespace srtk = rtk::simple; - - std::stringstream ss; - ss << srtk::srtkAnyEvent; - EXPECT_EQ("AnyEvent", ss.str()); - ss.str(""); - ss << srtk::srtkAbortEvent; - EXPECT_EQ("AbortEvent", ss.str()); - ss.str(""); - ss << srtk::srtkDeleteEvent; - EXPECT_EQ("DeleteEvent", ss.str()); - ss.str(""); - ss << srtk::srtkEndEvent; - EXPECT_EQ("EndEvent", ss.str()); - ss.str(""); - ss << srtk::srtkIterationEvent; - EXPECT_EQ("IterationEvent", ss.str()); - ss.str(""); - ss << srtk::srtkProgressEvent; - EXPECT_EQ("ProgressEvent", ss.str()); - ss.str(""); - ss << srtk::srtkStartEvent; - EXPECT_EQ("StartEvent", ss.str()); - ss.str(""); - ss << srtk::srtkUserEvent; - EXPECT_EQ("UserEvent", ss.str()); -} - - -TEST( Command, Test1 ) { - // Basic test. - namespace srtk = rtk::simple; - - srtk::Command cmd1; - // not copy construct able - //srtk::Command cmd2(cmd1); - - // not assignable - //cmd1 = cmd1; - - // Does nothing - cmd1.Execute(); - - EXPECT_EQ( "Command", cmd1.GetName() ); - cmd1.SetName("SomeName"); - EXPECT_EQ( "SomeName", cmd1.GetName() ); - -} - - -TEST( ProcessObject, Command_Ownership ) { - // Test the functionality of the ProcessObject Owning the Command - namespace srtk = rtk::simple; - - static int destroyedCount = 0; - - class HeapCommand - : public srtk::Command - { - public: - HeapCommand() : v(false) {}; - ~HeapCommand() {++destroyedCount;} - virtual void Execute() {v=true;} - using Command::SetOwnedByProcessObjects; - using Command::GetOwnedByProcessObjects; - using Command::OwnedByProcessObjectsOn; - using Command::OwnedByProcessObjectsOff; - - bool v; - }; - - { - // test set/get/on/off - HeapCommand cmd; - EXPECT_FALSE(cmd.GetOwnedByProcessObjects()); - cmd.SetOwnedByProcessObjects(true); - EXPECT_TRUE(cmd.GetOwnedByProcessObjects()); - cmd.OwnedByProcessObjectsOff(); - EXPECT_FALSE(cmd.GetOwnedByProcessObjects()); - cmd.OwnedByProcessObjectsOn(); - EXPECT_TRUE(cmd.GetOwnedByProcessObjects()); - - HeapCommand *cmd1 = new HeapCommand(); - cmd1->OwnedByProcessObjectsOn(); - EXPECT_EQ(0,destroyedCount); - delete cmd1; - EXPECT_EQ(1,destroyedCount); - } - EXPECT_EQ(2,destroyedCount); - - // case 1 - // single po, multiple cmds - { - srtk::CastImageFilter po; - srtk::Image img(5,5, srtk::srtkUInt16); - - HeapCommand *cmd2 = new HeapCommand(); - cmd2->OwnedByProcessObjectsOn(); - po.AddCommand(srtk::srtkAnyEvent, *cmd2); - - EXPECT_FALSE(cmd2->v); - EXPECT_NO_THROW( po.Execute(img) ); - EXPECT_TRUE(cmd2->v); - cmd2->v = false; - - HeapCommand *cmd3 = new HeapCommand(); - cmd3->OwnedByProcessObjectsOn(); - po.AddCommand(srtk::srtkAnyEvent, *cmd3); - - EXPECT_FALSE(cmd2->v); - EXPECT_FALSE(cmd3->v); - EXPECT_NO_THROW( po.Execute(img) ); - EXPECT_TRUE(cmd2->v); - EXPECT_TRUE(cmd3->v); - cmd2->v = false; - - delete cmd3; - EXPECT_EQ(3,destroyedCount); - } - EXPECT_EQ(4,destroyedCount); - - // case 2 - // cmd registered to multiple PO - { - std::auto_ptr po1(new srtk::CastImageFilter()); - std::auto_ptr po2(new srtk::CastImageFilter()); - - HeapCommand *cmd = new HeapCommand(); - cmd->OwnedByProcessObjectsOn(); - - po1->AddCommand(srtk::srtkAnyEvent, *cmd); - po1->AddCommand(srtk::srtkStartEvent, *cmd); - - EXPECT_TRUE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkStartEvent)); - - po2->AddCommand(srtk::srtkAnyEvent, *cmd); - EXPECT_TRUE(po2->HasCommand(srtk::srtkAnyEvent)); - - - po2.reset(); - - EXPECT_TRUE(po1->HasCommand(srtk::srtkAnyEvent)); - EXPECT_TRUE(po1->HasCommand(srtk::srtkStartEvent)); - EXPECT_EQ(4,destroyedCount); - } - EXPECT_EQ(5,destroyedCount); - - -} - -TEST( Command, Test2 ) { - // Check basic name functionality - namespace srtk = rtk::simple; - - srtk::Command cmd1; - - -} - -TEST( FunctionCommand, Test1 ) { - // Basic test. - namespace srtk = rtk::simple; - - srtk::FunctionCommand cmd1; - // not copy construct able - //srtk::Command cmd2(cmd1); - - // not assignable - //cmd1 = cmd1; - - // Does nothing - cmd1.Execute(); - - EXPECT_EQ( "FunctionCommand", cmd1.GetName() ); - cmd1.SetName("AnotherName"); - EXPECT_EQ( "AnotherName", cmd1.GetName() ); -} - -namespace -{ - -struct MemberFunctionCommandTest -{ - MemberFunctionCommandTest():v(0){} - - void DoSomething() {v=99;} - int v; -}; - -int gValue = 0; -void functionCommand(void) -{ - gValue = 98; -} - -void functionCommandWithClientData(void *_data) -{ - int &data = *reinterpret_cast(_data); - data = 97; -} - -} - -TEST( FunctionCommand, Test2 ) { - // check execution of different callbacks types - namespace srtk = rtk::simple; - - MemberFunctionCommandTest mfct; - EXPECT_EQ(0,mfct.v); - - srtk::FunctionCommand cmd1; - cmd1.SetCallbackFunction( &mfct, &MemberFunctionCommandTest::DoSomething ); - cmd1.Execute(); - EXPECT_EQ(99,mfct.v); - mfct.v = 0; - - EXPECT_EQ(0,gValue); - cmd1.SetCallbackFunction(functionCommand); - cmd1.Execute(); - EXPECT_EQ(98,gValue); - EXPECT_EQ(0,mfct.v); - - - cmd1.SetCallbackFunction(functionCommandWithClientData, &gValue); - cmd1.Execute(); - EXPECT_EQ(97,gValue); - EXPECT_EQ(0,mfct.v); -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkExceptionsTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkExceptionsTests.cxx deleted file mode 100644 index b8f5e64c7..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkExceptionsTests.cxx +++ /dev/null @@ -1,108 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include "srtkMacro.h" - -#include "SimpleRTKTestHarness.h" - -static const char * DESCRIPTION = "We expect this exception"; - -class srtkExceptionsTest - : public ::testing::Test -{ -public: - - void ThrowsrtkException( void ) - { - srtkExceptionMacro( << DESCRIPTION ); - } -}; - -TEST_F(srtkExceptionsTest, Test1) { - ASSERT_THROW( ThrowsrtkException(), ::rtk::simple::GenericException ); - - try - { - ThrowsrtkException(); - } - catch ( ::rtk::simple::GenericException &e ) - { - // could do some nifty testing here too - EXPECT_EQ ( e.GetNameOfClass(), std::string("GenericException") ); - //EXPECT_NE ( std::string ( e.GetLocation() ), "" ); HACK FIXME - // exception revision - return; - } - - // should gotten that exception - FAIL(); -} - -TEST_F(srtkExceptionsTest, Test2) { - - // this can only be tested when true, if it was false the file won't compile - srtkStaticAssert( true, "this is just a test" ); - - SUCCEED(); -} - -TEST_F(srtkExceptionsTest, Test3) { - - // This test is designed to improve coverage of the GenericException class - - // Default constructor - const rtk::simple::GenericException empty; - rtk::simple::GenericException e0; - - - rtk::simple::GenericException e1( __FILE__, __LINE__ ); - - rtk::simple::GenericException e2( __FILE__, __LINE__, "testing yet another constructor" ); - - // copy constructor - rtk::simple::GenericException e3( e2 ); - - - // asignment - e0 = e2; - e0 = e1; - e0 = empty; - - // test self assigment too - e0 = e0; - - - EXPECT_TRUE( e1 == e1 ); - EXPECT_TRUE( empty == empty ); - EXPECT_FALSE( e2 == e1 ); - - EXPECT_NO_THROW( e2.ToString() ); - EXPECT_NO_THROW( e2.GetLocation() ); - EXPECT_NO_THROW( e2.GetDescription() ); - EXPECT_NO_THROW( e2.GetFile() ); - EXPECT_NO_THROW( e2.GetLine() ); - EXPECT_NO_THROW( e2.what() ); - - // check accessor for empty/null - EXPECT_NO_THROW( empty.ToString() ); - EXPECT_NO_THROW( empty.GetLocation() ); - EXPECT_NO_THROW( empty.GetDescription() ); - EXPECT_NO_THROW( empty.GetFile() ); - EXPECT_NO_THROW( empty.GetLine() ); - EXPECT_NO_THROW( empty.what() ); - -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.cxx b/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.cxx deleted file mode 100644 index 1d3384582..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.cxx +++ /dev/null @@ -1,229 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include -#include - -#include "srtkImageCompare.h" - -namespace srtk = rtk::simple; - -void ImageCompare::NormalizeAndSave ( const srtk::Image &input, const std::string &filename ) -{ - srtk::Image image = input; - - // Extract the center slice of our image - if ( input.GetDimension() == 3 ) - { - std::vector idx( 3, 0 ); - std::vector sz = input.GetSize(); - - // set to just the center slice - idx[2] = (int)( input.GetDepth() / 2 ); - sz[2] = 0; - image = srtk::Extract( input, sz, idx ); - } - - srtk::StatisticsImageFilter stats; - stats.Execute ( image ); - srtk::Image out = srtk::IntensityWindowing ( image, stats.GetMinimum(), stats.GetMaximum(), 0, 255 ); - out = srtk::Cast ( out, srtk::srtkUInt8 ); - srtk::WriteImage ( out, filename ); -} - - -ImageCompare::ImageCompare() -{ - mTolerance = 0.0; - mMessage = ""; -} - -bool ImageCompare::compare ( const srtk::Image& image, std::string inTestCase, std::string inTag ) -{ - srtk::Image centerSlice( 0, 0, srtk::srtkUInt8 ); - std::string testCase = inTestCase; - std::string tag = inTag; - std::string testName = ::testing::UnitTest::GetInstance()->current_test_info()->name(); - - if ( testCase == "" ) - { - testCase = ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(); - } - - std::cout << "Starting image compare on " << testCase << "_" << testName << "_" << tag << std::endl; - // Does the baseline exist? - std::string extension = ".nrrd"; - std::string OutputDir = dataFinder.GetOutputDirectory(); - - std::string name = testCase - .append( "_" ) - .append(testName); - - if ( tag != "" ) - { - name.append("_").append ( tag ); - } - - // Extract the center slice of our image - if ( image.GetDimension() == 3 ) - { - std::vector idx( 3, 0 ); - std::vector sz = image.GetSize(); - - // set to just the center slice - idx[2] = (int)( image.GetDepth() / 2 ); - sz[2] = 1; - centerSlice = srtk::RegionOfInterest( image, sz, idx ); - } - else - { - centerSlice = image; - } - - std::string baselineFileName = dataFinder.GetFile( "Baseline/" + name + extension ); - - if ( !itksys::SystemTools::FileExists ( baselineFileName.c_str() ) ) - { - // Baseline does not exist, write out what we've been given - std::string newBaselineDir = OutputDir + "/Newbaseline/"; - itksys::SystemTools::MakeDirectory ( newBaselineDir.c_str() ); - std::cout << "Making directory " << newBaselineDir << std::endl; - std::string newBaseline = newBaselineDir + name + extension; - srtk::ImageFileWriter().SetFileName ( newBaseline ).Execute ( centerSlice ); - mMessage = "Baseline does not exist, wrote " + newBaseline + "\ncp " + newBaseline + " " + baselineFileName; - return false; - } - - srtk::Image baseline( 0, 0, srtk::srtkUInt8 ); - std::cout << "Loading baseline " << baselineFileName << std::endl; - - try - { - baseline = srtk::ImageFileReader().SetFileName ( baselineFileName ).Execute(); - } - catch ( std::exception& e ) - { - mMessage = "ImageCompare: Failed to load image " + baselineFileName + " because: " + e.what(); - return false; - } - - // verify they have the same size - if ( baseline.GetHeight() != centerSlice.GetHeight() - || baseline.GetWidth() != centerSlice.GetWidth() - || baseline.GetDepth() != centerSlice.GetDepth() ) - { - mMessage = "ImageCompare: Image dimensions are different"; - return false; - } - - // Get the center slices - srtk::Image diffSquared( 0, 0, rtk::simple::srtkUInt8 ); - try - { - - if ( baseline.GetPixelID() == srtk::srtkComplexFloat32 || - baseline.GetPixelID() == srtk::srtkComplexFloat64 ) - { - - srtk::Image diff = srtk::Subtract( centerSlice, baseline ); - // for complex number we multiply the image by it's complex - // conjugate, this will produce only a real value result - srtk::Image conj = srtk::RealAndImaginaryToComplex( srtk::ComplexToReal( diff ), - srtk::Multiply( srtk::ComplexToImaginary( diff ), -1.0 ) ); - diffSquared = srtk::ComplexToReal( srtk::Multiply( diff, conj ) ); - } - else if ( baseline.GetNumberOfComponentsPerPixel() > 1 ) - { - srtk::Image diff = srtk::Subtract( srtk::Cast( centerSlice, srtk::srtkVectorFloat32 ), srtk::Cast( baseline, srtk::srtkVectorFloat32 ) ); - - // for vector image just do a sum of the components - diffSquared = srtk::Pow( srtk::VectorIndexSelectionCast( diff, 0 ), 2.0 ); - for ( unsigned int i = 1; i < diff.GetNumberOfComponentsPerPixel(); ++i ) - { - srtk::Image temp = srtk::Pow( srtk::VectorIndexSelectionCast( diff, i ), 2.0 ); - diffSquared = srtk::Add( temp, diffSquared ); - } - - diffSquared = srtk::Divide( diffSquared, diff.GetNumberOfComponentsPerPixel() ); - } - else - { - srtk::Image diff = srtk::Subtract( srtk::Cast( centerSlice, srtk::srtkFloat32 ), srtk::Cast( baseline, srtk::srtkFloat32 ) ); - diffSquared = srtk::Multiply( diff, diff ); - } - - } - catch ( std::exception& e ) - { - mMessage = "ImageCompare: Failed to subtract image " + baselineFileName + " because: " + e.what(); - return false; - } - - - srtk::StatisticsImageFilter stats; - stats.Execute ( diffSquared ); - double rms = std::sqrt ( stats.GetMean() ); - - if ( rms > fabs ( mTolerance ) ) - { - std::ostringstream msg; - msg << "ImageCompare: image Root Mean Square (RMS) difference was " << rms << " which exceeds the tolerance of " << mTolerance; - msg << "\n"; - mMessage = msg.str(); - - std::cout << "" << rms << "" << std::endl; - std::cout << "" << mTolerance << "" << std::endl; - - std::string volumeName = OutputDir + "/" + name + ".nrrd"; - srtk::ImageFileWriter().SetFileName ( volumeName ).Execute ( centerSlice ); - - // Save pngs - std::string ExpectedImageFilename = OutputDir + "/" + name + "_Expected.png"; - std::string ActualImageFilename = OutputDir + "/" + name + "_Actual.png"; - std::string DifferenceImageFilename = OutputDir + "/" + name + "_Difference.png"; - - try - { - NormalizeAndSave ( baseline, ExpectedImageFilename ); - NormalizeAndSave ( centerSlice, ActualImageFilename ); - NormalizeAndSave ( srtk::Sqrt(diffSquared), DifferenceImageFilename ); - - // Let ctest know about it - std::cout << ""; - std::cout << ExpectedImageFilename << "" << std::endl; - std::cout << ""; - std::cout << ActualImageFilename << "" << std::endl; - std::cout << ""; - std::cout << DifferenceImageFilename << "" << std::endl; - - } - catch( std::exception &e ) - { - std::cerr << "Exception encountered while trying to normalize and save images for dashboard!" << std::endl; - std::cerr << e.what() << std::endl; - } - catch(...) - { - std::cerr << "Unexpected error while trying to normalize and save images for dashboard!" << std::endl; - } - - - return false; - } - - return true; -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.h b/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.h deleted file mode 100644 index f0b504e2e..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageCompare.h +++ /dev/null @@ -1,89 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#ifndef __ImageCompare_h -#define __ImageCompare_h -#include -#include - -class ImageCompare { -public: - typedef ImageCompare Self; - ImageCompare(); - - // Compare the image to the named baseline image slice by slice, display the difference in the center slice - // If the baseline does not exist, fail, and write a baseline image in the output directory - bool compare ( const rtk::simple::Image& image, std::string testGroup, std::string tag ); - - // Return the message from the previous image comparison. - std::string getMessage() { return mMessage; } - Self& setTolerance ( double t ) { mTolerance = t; return *this; } - double getTolerance() { return mTolerance; } - - static void NormalizeAndSave ( const rtk::simple::Image &image, const std::string &filename ); -protected: - std::string mMessage; - double mTolerance; -}; - -#define IMAGECOMPARE( x, tag ) \ - { \ -ImageCompare imageCompare; \ - EXPECT_TRUE( imageCompare.compare( x, "", tag ) ) << imageCompare.getMessage(); \ - } -#define IMAGECOMPAREWITHTOLERANCE( x, tag, tolerance ) \ - { \ - ImageCompare imageCompare; \ - imageCompare.setTolerance(tolerance); \ - EXPECT_TRUE( imageCompare.compare( x, "", tag ) ) << imageCompare.getMessage(); \ - } - -#define IMAGECOMPAREWITHHASH( hash, hashType, image, message ) \ - { \ - std::string actualHashValue = rtk::simple::Hash( image, rtk::simple::HashImageFilter::hashType ); \ - EXPECT_EQ ( hash, actualHashValue ) << message; \ - if ( hash != actualHashValue ) \ - { \ - std::string TestImageFilename = dataFinder.GetOutputFile ( actualHashValue + ".png"); \ - try { \ - ImageCompare::NormalizeAndSave( image, TestImageFilename ); \ - \ - std::cout << ""; \ - std::cout << TestImageFilename << "" << std::endl; \ - } catch (... ) { \ - std::cerr << "Unknow Error while writing image for measurement" << std::endl; \ - } \ - \ - rtk::simple::WriteImage ( image, dataFinder.GetOutputFile ( actualHashValue + ".nrrd" ) ); \ - std::cout << "Saved actual image as " << dataFinder.GetOutputFile ( actualHashValue + ".nrrd" ) << std::endl; \ - } \ - } - -#define IMAGECOMPARE_WITH_TESTCASE( x, testCase, tag ) \ - { \ -ImageCompare imageCompare; \ - EXPECT_TRUE( imageCompare.compare( x, testCase, tag ) ) << imageCompare.getMessage(); \ - } -#define IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE( x, testCase, tag, tolerance ) \ - { \ - ImageCompare imageCompare; \ - imageCompare.setTolerance(tolerance); \ - EXPECT_TRUE( imageCompare.compare( x, testCase, tag ) ) << imageCompare.getMessage(); \ - } - - -#endif diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageFilterTestTemplate.cxx.in b/utilities/SimpleRTK/Testing/Unit/srtkImageFilterTestTemplate.cxx.in deleted file mode 100644 index 8012716a6..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageFilterTestTemplate.cxx.in +++ /dev/null @@ -1,715 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -/* - * WARNING: DO NOT EDIT THIS FILE! - * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLERTK BUILD PROCESS. - * Please look at srtkImageFilterTestTemplate.cxx.in to make changes. - */ - -#include - -#include -#include -#include -#include -#include -#include - - -TEST(BasicFilters,${name}) { - rtk::simple::ImageFileReader reader; - rtk::simple::${name} filter; - rtk::simple::Image inputA( 0, 0, rtk::simple::srtkUInt8 ); - rtk::simple::Image inputB( 0, 0, rtk::simple::srtkUInt8 ); - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - std::string inputSHA1hash; - - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - -$(foreach members - $(if dim_vec and dim_vec == 1 then - OUT=[[for(unsigned int i = 0; i < filter.Get${name}().size(); ++i) - { - EXPECT_EQ ( filter.Get${name}()[i], ${default}[i] ) << "Testing get for ${name} at " << i; - }]] - elseif no_print == nil then - OUT=[[EXPECT_EQ ( filter.Get${name}(), ${default} ) << "Testing get for ${name}";]] -end) -) - EXPECT_NE ( filter.ToString(), "" ) << "empty ToString method!"; - EXPECT_EQ ( filter.GetName(), "${name}" ) << "checking GetName method!"; - - // Test sets / gets -$(foreach members - $(if dim_vec and dim_vec == 1 then - OUT=[[filter.Set${name} ( ${default} ); - for(unsigned int i = 0; i < filter.Get${name}().size(); ++i) - { - EXPECT_EQ ( filter.Get${name}()[i], ${default}[i] ) << "Testing set/get for ${name} at " << i; - }]] - elseif no_print == nil then - OUT=[[filter.Set${name} ( ${default} ); - EXPECT_EQ ( filter.Get${name}(), ${default} ) << "Testing set/get for ${name}";]] -end) -) - -$(if template_type and template_type == "RegionGrowing" then OUT=[[ - // Test size of default SeedList - EXPECT_EQ ( filter.GetSeedList().size(), (unsigned int)0 ) << "Testing empty seed list as default";]] -end) - -$(if template_code_filename and template_code_filename == "FastMarchingImageFilter" then OUT=[[ - // Test size of default TrialPoints - EXPECT_EQ ( filter.GetTrialPoints().size(), (unsigned int)0 ) << "Testing empty trial points as default";]] -end) - - $(if number_of_inputs == 2 then - OUT=[[ { - rtk::simple::Image smallImage( 1,1,1,rtk::simple::srtkUInt8 ); - rtk::simple::Image largeImage( 10,10,10,rtk::simple::srtkUInt8 ); - rtk::simple::Image smallShortImage( 1,1,1,rtk::simple::srtkUInt16 ); - try - { - // Try executing with different size images. - // This will either work or throw an exception, either is OK. So - // this is here just to make sure that the behavior does not cause - // undefined behavior such as segfault, or other errouneos behavior. - filter.Execute ( largeImage, smallImage ); - } catch (... ) - { } -]] - if template_code_filename and template_code_filename == "DualImageFilter" then - OUT = OUT .. [=[ - // todo add intelligence to determin some image types to test - //ASSERT_NO_THROW ( filter.Execute ( smallImage, smallShortImage ) ) << " Image types are different"; -]=] - else - OUT = OUT .. [=[ - - ASSERT_THROW ( filter.Execute ( smallImage, smallShortImage ), rtk::simple::GenericException ) << " Image types are different"; ]=] - end - OUT = OUT .. [[ - }]] - end) -} - -$(foreach tests -TEST(BasicFilters,${name}_${tag}) - { // BEGIN FOR EACH TEST - /* TAG: ${tag} DESCRIPTION: ${description} */ - - rtk::simple::ImageFileReader reader; - rtk::simple::${name} filter; - rtk::simple::Image output; - rtk::simple::HashImageFilter hasher; - std::string inputSHA1hash; - - std::vector inputs; - std::vector inputFileNames; - -$(for inum=1,#inputs do - OUT=OUT..[[ - inputFileNames.push_back( "]]..inputs[inum]..[[" ); -]] -end) - - for ( unsigned int i = 0; i < inputFileNames.size(); ++i ) - { - ASSERT_NO_THROW ( inputs.push_back( reader.SetFileName ( dataFinder.GetFile ( inputFileNames[i] ) ).Execute() ) ) << "Failed to load " << inputFileNames[i] << " from " << dataFinder.GetFile ( inputFileNames[i] ); - -$(if inputA_cast then - OUT=[[ - if ( i == 0 ) - { - ASSERT_NO_THROW( inputs[i] = rtk::simple::Cast( inputs[i], rtk::simple::${inputA_cast } ) ) << "Failed to cast inputA to ${inputA_cast}"; - } -]] end)$(if inputB_cast then - OUT=[[ - if ( i == 1 ) - { - ASSERT_NO_THROW( inputs[i] = rtk::simple::Cast( inputs[i], rtk::simple::${inputB_cast } ) ) << "Failed to cast inputB to ${inputB_cast}"; - } -]] end) - ASSERT_TRUE ( inputs[i].GetITKBase() != NULL ) << "Could not read " << inputFileNames[i]; - } - - $(if (not no_procedure) or (no_procedure ==0) then -OUT=[=[ - - // Do we get the same image back, if we use the functional interface? - rtk::simple::Image fromFunctional( 0, 0, rtk::simple::srtkUInt8 ); - rtk::simple::Image fromProcedural( 0, 0, rtk::simple::srtkUInt8 ); - ASSERT_NO_THROW ( fromProcedural = filter.Execute ( $(if #inputs > 0 then OUT=[[inputs[0] ]] end)$(for inum=1,#inputs-1 do OUT=OUT..", inputs["..inum.."]" end) ) ) << "Procedural interface to ${name}"; - ASSERT_NO_THROW ( fromFunctional = rtk::simple::${name:gsub("ImageFilter$", ""):gsub("ImageSource$", "Source")} ( $(if #inputs > 0 then OUT=[[inputs[0] ]] end)$(for inum=1,#inputs-1 do OUT=OUT..", inputs["..inum.."]" end) - $(if template_type and template_type == "RegionGrowing" then OUT=", std::vector< std::vector >()" end) - $(if template_code_filename and template_code_filename == "FastMarchingImageFilter" then OUT=", std::vector< std::vector >()" end) - $(if template_code_filename and template_code_filename == "KernelImageFilter" then OUT=[[, 1, rtk::simple::srtkBall]] end) - $(for i = 1,#members do - if (number_of_inputs > 0 or i > 1) then OUT = OUT .. ", " end - OUT= OUT .. members[i].default - end) - - - ) ) << "Functional interface to ${name}"; - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( hasher.Execute ( fromProcedural ), hasher.Execute ( fromFunctional ) ) << "procedural and functional are not the same!"; -]=] end) - - -$(if settings then -OUT=[[ -$(foreach settings - $(if parameter == "SeedList" then - OUT='filter.ClearSeeds();\ - $(for i=1,#value do OUT=OUT .. "{unsigned int __seed[] = " .. value[i] .. "; filter.AddSeed( std::vector(__seed, __seed + inputs[0].GetDimension()) );}" end);' - elseif parameter == "TrialPoints" then - OUT='filter.ClearTrialPoints();\ - $(for i=1,#value do OUT=OUT .. "{unsigned int __point[] = " .. value[i] .. "; filter.AddTrialPoint( std::vector(__point, __point + inputs[0].GetDimension()) );}" end);' - elseif dim_vec and dim_vec == 1 then - OUT='{\ - ${type} arr[] = {' - for i=1,#value-1 do - OUT=OUT..value[i]..", " - end - OUT=OUT..value[#value] - OUT=OUT..'};\ - std::vector< ${type} > vec(arr, arr + sizeof(arr)/sizeof(${type}));\ - filter.Set${parameter} ( vec );\ - for(unsigned int i = 0; i < filter.Get${parameter}().size(); ++i)\ - {\ - ASSERT_EQ ( filter.Get${parameter}()[i], vec[i] ) << "Failed to set ${parameter} to ${value}";\ - }\ - }' - else - OUT='filter.Set${parameter} ( ${value} );' - if (not no_get_method) then - if (value == "true") then - OUT = OUT .. '\ - ASSERT_TRUE ( filter.Get${parameter}() ) << "Failed to set ${parameter} to ${value}";' - elseif (value == "false") then - OUT = OUT .. '\ - ASSERT_FALSE ( filter.Get${parameter}() ) << "Failed to set ${parameter} to ${value}";' - else - OUT = OUT .. '\ - ASSERT_EQ ( ${value}, filter.Get${parameter}() ) << "Failed to set ${parameter} to ${value}";' - end - end -end) -)]] -end) - - - if ( !inputs.empty() && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt8 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt16 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt32 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt64 ) - { - inputSHA1hash = rtk::simple::Hash( inputs[0] ); - } - filter.DebugOn(); - ASSERT_NO_THROW ( output = filter.Execute ( $(if #inputs > 0 then OUT=[[inputs[0] ]] end)$(for inum=1,#inputs-1 do OUT=OUT..", inputs["..inum.."]" end) ) ); - - if ( !inputs.empty() && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt8 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt16 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt32 && - inputs[0].GetPixelID() != rtk::simple::srtkLabelUInt64 ) - { - // Check that the input is not modified - // This will fail if the filter is being run in-place - EXPECT_EQ ( inputSHA1hash, rtk::simple::Hash( inputs[0] ) ) << "Input was modified by filter."; - } - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed in ${tag}");]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed in ${tag}"); ]] - end) $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE ( output, "", ${tolerance} ); - ]]end) $(when measurements_results -$(foreach measurements_results -$(if tolerance then - OUT=[[EXPECT_NEAR(${value}, filter.Get${name}(), ${tolerance} );]] -else - if (value == "true") then - OUT = [[EXPECT_TRUE ( filter.Get${name}() ) << "Measurement failure";]] - elseif (value == "false") then - OUT = [[EXPECT_FALSE ( filter.Get${name}() ) << "Measurement failure";]] - else - OUT = [[EXPECT_EQ ( ${value}, filter.Get${name}() ) << "Measurement failure";]] - end -end) -)) - -} // END FOR EACH TEST -) - - -#if defined(WRAP_LUA) - -TEST_F(Lua,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - std::string Script = dataFinder.GetBuildDirectory() + "/Testing/Unit/LuaTests/${name}Test.lua"; - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "Lua-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetLuaExecutable(); - CommandLine.push_back ( Script ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif - -#if defined(WRAP_PYTHON) - -TEST_F(Python,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - std::string Script = dataFinder.GetBuildDirectory() + "/Testing/Unit/PythonTests/${name}Test.py"; - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "Python-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetPythonExecutable(); - CommandLine.push_back ( Script ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif - -#if defined(WRAP_TCL) - -TEST_F(Tcl,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - std::string Script = dataFinder.GetBuildDirectory() + "/Testing/Unit/TclTests/${name}Test.tcl"; - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "Tcl-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetTclExecutable ( ); - CommandLine.push_back ( Script ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif - -#if defined(WRAP_R) - -TEST_F(R,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - // Set-up the R enviroment to include the SimpleRTK R library in the - // build directory. - SetEnvironment ( "R_LIBS", dataFinder.GetBuildDirectory()+"/Wrapping/RLib" ); - - - std::string Script = dataFinder.GetBuildDirectory() + "/Testing/Unit/RTests/${name}Test.R"; - $(foreach tests - { - - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "R-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetRExecutable(); - CommandLine.push_back ( "--slave" ); - CommandLine.push_back ( "--vanilla" ); - CommandLine.push_back ( std::string("--file=")+Script ); - CommandLine.push_back ( "--args" ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - - ) -} -#endif - - - -#if defined(WRAP_JAVA) - -TEST_F(Java,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - std::string Classpath = dataFinder.GetBuildDirectory() + "/Testing/Unit/JavaTests" - + dataFinder.GetPathSeparator() + dataFinder.GetBuildDirectory() + "/Wrapping/simplertk-" + rtk::simple::Version::VersionString() + ".jar"; - std::string JavaPath = dataFinder.GetLibraryDirectory(); - std::string Script = "org.rtk.simple.testing.${name}Test"; - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "Java-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetJavaExecutable(); - CommandLine.push_back ( "-classpath" ); - CommandLine.push_back ( Classpath ); - CommandLine.push_back ( "-Djava.library.path=" + JavaPath ); - CommandLine.push_back ( Script ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif - -#if defined(WRAP_RUBY) - -TEST_F(Ruby,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - // Set our Ruby path - SetEnvironment ( "RUBYLIB", dataFinder.GetLibraryDirectory() ); - - std::string Script = dataFinder.GetBuildDirectory() + "/Testing/Unit/RubyTests/${name}Test.rb"; - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "Ruby-${name}-${tag}.nrrd" ); - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - CommandLine = dataFinder.GetRubyExecutable(); - CommandLine.push_back ( Script ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif - -#if defined(WRAP_CSHARP) - -TEST_F(CSharp,${name}) { - $(if #tests == 0 then - OUT=[[ - FAIL() << "Filter ${name} has no tests defined"; - ]] - end) - - std::string ExePath = dataFinder.GetCSharpBinaryDirectory(); - std::string ExeName = "Test${name}.exe"; - std::string ExePathAndName = ExePath + "/" + ExeName; - - // On Linux, we need to specify where the shared library is found - std::string path = dataFinder.GetBuildDirectory() + "/Wrapping/CSharpBinaries"; - SetEnvironment ( "LD_LIBRARY_PATH", path ); - - - $(foreach tests - { - /* ${description} */ - std::vector CommandLine; - std::string outputFileName = dataFinder.GetOutputFile ( "CSharp-${name}-${tag}.nrrd" ); - - // Make sure the output is deleted - if ( itksys::SystemTools::FileExists ( outputFileName.c_str() ) ) { - ASSERT_TRUE ( itksys::SystemTools::RemoveFile ( outputFileName.c_str() ) ) << "Deleting file " << outputFileName; - } - - std::vector cs_interp = dataFinder.GetCSharpInterpreter(); - - if ( cs_interp.size() && cs_interp[0].size() ) - { - CommandLine = dataFinder.GetCSharpInterpreter(); - } - CommandLine.push_back ( ExePathAndName ); - CommandLine.push_back ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ).c_str() ); - CommandLine.push_back ( "${tag}" ); -$(for inum=1,#inputs do - OUT=OUT..[[ - CommandLine.push_back( dataFinder.GetFile ("]]..inputs[inum]..[[") ); -]] end) - CommandLine.push_back ( outputFileName ); - EXPECT_EQ( 0, RunExecutable ( CommandLine, true ) ) << "non-zero returned from process"; - ASSERT_TRUE ( dataFinder.FileExists ( outputFileName ) ); - rtk::simple::ImageFileReader reader; - rtk::simple::HashImageFilter hasher; - rtk::simple::Image output( 0, 0, rtk::simple::srtkUInt8 ); - - output = reader.SetFileName ( outputFileName ).Execute(); - ASSERT_TRUE ( output.GetITKBase() != NULL ) << "Loaded output image"; - - $(if md5hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${md5hash}",MD5,output,"Output MD5 hash failed"); - ]] - end) - $(if sha1hash then - OUT = [[ - // Check the hash - IMAGECOMPAREWITHHASH("${sha1hash}",SHA1,output,"Output SHA1 hash failed"); - ]] - end) - $(if tolerance then - OUT = [[ - IMAGECOMPAREWITHTOLERANCE_WITH_TESTCASE ( output, "BasicFilters", "${tag}", ${tolerance} ); - ]] - end) - } - ) -} -#endif diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageIOTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkImageIOTests.cxx deleted file mode 100644 index 410f94d84..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageIOTests.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include -#include -#include -#include -#include - -TEST(IO,ImageFileReader) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - - typedef std::map MapType; - MapType mapping; - - // Configure the mapping between filename and MD5 hash - mapping["Input/RA-Short.nrrd"] = "a963bd6a755b853103a2d195e01a50d3"; - mapping["Input/RA-Float.nrrd"] = "3ccccde44efaa3d688a86e94335c1f16"; - mapping["Input/RA-Slice-Short.nrrd"] = "22cdc0af7d51934a744b9c4fd4748cd1"; - mapping["Input/RA-Slice-Float.nrrd"] = "999078d36a4491d691cc93d8c3ed29fc"; - mapping["Input/Ramp-Zero-One-Float.nrrd"] = "f47efe1a6f48cb5cfe1aa23232f1168b"; - mapping["Input/Ramp-One-Zero-Float.nrrd"] = "0b18fac85955571d069b3666ff987119"; - mapping["Input/Ramp-Up-Short.nrrd"] = "86f2ea8a68b3069f33f2271829a30aa2"; - mapping["Input/Ramp-Down-Short.nrrd"] = "71f5c852a6251069fa1d60f796463343"; - mapping["Input/STAPLE1.png"] = "095f00a68a84df4396914fa758f34dcc"; - mapping["Input/STAPLE2.png"] = "301858f5eee39b092d28d9837f008fb8"; - - - // Loop over the map, load each file, and compare the hash value - for ( MapType::iterator it = mapping.begin(); it != mapping.end(); ++it ) { - reader.SetFileName ( dataFinder.GetFile ( it->first ) ); - EXPECT_EQ ( reader.GetFileName(), dataFinder.GetFile ( it->first ) ); - rtk::simple::Image image = reader.Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ); - EXPECT_EQ ( it->second, hasher.Execute ( image ) ) << " reading " << it->first; - // Try the functional interface - EXPECT_EQ ( it->second, hasher.Execute ( rtk::simple::ReadImage ( dataFinder.GetFile ( it->first ) ) ) ) << "Functional interface"; - } - - EXPECT_EQ ( "ImageFileReader", reader.GetName() ); - EXPECT_NO_THROW ( reader.ToString() ); -} - -TEST(IO,ImageFileWriter) { - namespace srtk = rtk::simple; - - srtk::ImageFileWriter writer; - - srtk::Image img = srtk::Image(10,10, srtk::srtkUInt16); - - std::string filename = dataFinder.GetOutputFile ( "IO.ImageFileWriter1.mha" ); - writer.SetFileName(filename); - - ProgressUpdate progressCmd(writer); - writer.AddCommand(srtk::srtkProgressEvent, progressCmd); - - CountCommand abortCmd(writer); - writer.AddCommand(srtk::srtkAbortEvent, abortCmd); - - CountCommand deleteCmd(writer); - writer.AddCommand(srtk::srtkDeleteEvent, deleteCmd); - - CountCommand endCmd(writer); - writer.AddCommand(srtk::srtkEndEvent, endCmd); - - CountCommand iterCmd(writer); - writer.AddCommand(srtk::srtkIterationEvent, iterCmd); - - CountCommand startCmd(writer); - writer.AddCommand(srtk::srtkStartEvent, startCmd); - - CountCommand userCmd(writer); - writer.AddCommand(srtk::srtkUserEvent, userCmd); - - EXPECT_NO_THROW ( writer.Execute(img) ); - - EXPECT_EQ ( 1.0, progressCmd.m_Progress ); - EXPECT_EQ ( 0, abortCmd.m_Count ); - EXPECT_EQ ( 1, deleteCmd.m_Count ); - EXPECT_EQ ( 1, endCmd.m_Count ); - EXPECT_EQ ( 0, iterCmd.m_Count ); - EXPECT_EQ ( 1, startCmd.m_Count ); - EXPECT_EQ ( 0, userCmd.m_Count ); - - EXPECT_EQ ( "ImageFileWriter", writer.GetName() ); - EXPECT_NO_THROW ( writer.ToString() ); -} - -TEST(IO,ReadWrite) { - namespace srtk = rtk::simple; - srtk::HashImageFilter hasher; - srtk::ImageFileReader reader; - srtk::ImageFileWriter writer; - - // From the command line utility - std::string md5 = "a963bd6a755b853103a2d195e01a50d3"; - std::string sha1 = "126ea8c3ef5573ca1e4e0deece920c2c4a4f38b5"; - - - ProgressUpdate progressCmd(reader); - reader.AddCommand(srtk::srtkProgressEvent, progressCmd); - - CountCommand abortCmd(reader); - reader.AddCommand(srtk::srtkAbortEvent, abortCmd); - - CountCommand deleteCmd(reader); - reader.AddCommand(srtk::srtkDeleteEvent, deleteCmd); - - CountCommand endCmd(reader); - reader.AddCommand(srtk::srtkEndEvent, endCmd); - - CountCommand iterCmd(reader); - reader.AddCommand(srtk::srtkIterationEvent, iterCmd); - - CountCommand startCmd(reader); - reader.AddCommand(srtk::srtkStartEvent, startCmd); - - CountCommand userCmd(reader); - reader.AddCommand(srtk::srtkUserEvent, userCmd); - - - srtk::Image image = reader.SetFileName ( dataFinder.GetFile ( "Input/RA-Short.nrrd" ) ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( srtk::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( srtk::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - EXPECT_EQ ( 0, abortCmd.m_Count ); - EXPECT_EQ ( 1, deleteCmd.m_Count ); - EXPECT_EQ ( 1, endCmd.m_Count ); - EXPECT_EQ ( 0, iterCmd.m_Count ); - EXPECT_EQ ( 1, startCmd.m_Count ); - EXPECT_EQ ( 0, userCmd.m_Count ); - - - // Write it out - std::string filename = dataFinder.GetOutputFile ( "IO.ReadWrite.nrrd" ); - writer.SetFileName ( filename ).Execute ( image ); - ASSERT_TRUE ( dataFinder.FileExists ( filename ) ); - - image = reader.SetFileName ( filename ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - - // Make sure we wrote and read the file correctly - hasher.SetHashFunction ( srtk::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( srtk::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - - // Again, with the functional interface - filename = dataFinder.GetOutputFile ( "IO.ReadWrite-Functional.nrrd" ); - srtk::WriteImage ( image, filename ); - ASSERT_TRUE ( dataFinder.FileExists ( filename ) ); - - image = reader.SetFileName ( filename ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - - // Make sure we wrote and read the file correctly - hasher.SetHashFunction ( srtk::HashImageFilter::MD5 ); - EXPECT_EQ ( md5, hasher.Execute ( image ) ); - hasher.SetHashFunction ( srtk::HashImageFilter::SHA1 ); - EXPECT_EQ ( sha1, hasher.Execute ( image ) ); - -} - - -TEST(IO,2DFormats) { - rtk::simple::HashImageFilter hasher; - rtk::simple::ImageFileReader reader; - - rtk::simple::Image image = reader.SetFileName ( dataFinder.GetFile ( "Input/RA-Slice-Short.png" ) ).Execute(); - ASSERT_TRUE ( image.GetITKBase() != NULL ); - hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ); - EXPECT_EQ ( "bf0f7bae60b0322222e224941c31f37a981901aa", hasher.Execute ( image ) ); - ASSERT_EQ ( 2u, image.GetDimension() ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 64u, image.GetHeight() ); - EXPECT_EQ ( 0u, image.GetDepth() ); - -} - -namespace srtk = rtk::simple; - -TEST(IO, SeriesReader) { - - std::vector< std::string > fileNames; - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - - srtk::ImageSeriesReader reader; - - EXPECT_EQ( 0u, reader.GetFileNames().size()); - - ProgressUpdate progressCmd(reader); - reader.AddCommand(srtk::srtkProgressEvent, progressCmd); - - CountCommand abortCmd(reader); - reader.AddCommand(srtk::srtkAbortEvent, abortCmd); - - CountCommand deleteCmd(reader); - reader.AddCommand(srtk::srtkDeleteEvent, deleteCmd); - - CountCommand endCmd(reader); - reader.AddCommand(srtk::srtkEndEvent, endCmd); - - CountCommand iterCmd(reader); - reader.AddCommand(srtk::srtkIterationEvent, iterCmd); - - CountCommand startCmd(reader); - reader.AddCommand(srtk::srtkStartEvent, startCmd); - - CountCommand userCmd(reader); - reader.AddCommand(srtk::srtkUserEvent, userCmd); - - srtk::Image image = reader.SetFileNames ( fileNames ).Execute(); - EXPECT_EQ ( "b13c0a17109e3a5058e8f225c9ef2dbcf79ac240", srtk::Hash( image ) ); - EXPECT_EQ( 3u, reader.GetFileNames().size()); - EXPECT_EQ ( 3u, image.GetDimension() ); - EXPECT_EQ ( 256u, image.GetWidth() ); - EXPECT_EQ ( 256u, image.GetHeight() ); - EXPECT_EQ ( 3u, image.GetDepth() ); - EXPECT_EQ ( 1.0, progressCmd.m_Progress ); - EXPECT_EQ ( 0, abortCmd.m_Count ); - EXPECT_EQ ( 1, deleteCmd.m_Count ); - EXPECT_EQ ( 1, endCmd.m_Count ); - EXPECT_EQ ( 0, iterCmd.m_Count ); - EXPECT_EQ ( 1, startCmd.m_Count ); - EXPECT_EQ ( 0, userCmd.m_Count ); - - - fileNames.push_back( dataFinder.GetFile ( "Input/WhiteDots.png" )); - image = srtk::ReadImage( fileNames ); - EXPECT_EQ ( "62fff5903956f108fbafd506e31c1e733e527820", srtk::Hash( image ) ); - EXPECT_EQ ( 4u, image.GetDepth() ); - - fileNames.resize(0); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - fileNames.push_back( dataFinder.GetFile ( "Input/VM1111Shrink-RGB.png" ) ); - reader.SetFileNames ( fileNames ); - image = reader.Execute(); - EXPECT_EQ ( 3u, image.GetDepth() ); - EXPECT_EQ ( "bb42b8d3991132b4860adbc4b3f6c38313f52b4c", srtk::Hash( image ) ); - - - EXPECT_EQ ( "ImageSeriesReader", reader.GetName() ); - EXPECT_NO_THROW( reader.ToString() ); -} - - -TEST(IO,Write_BadName) { - - srtk::Image image = srtk::ReadImage( dataFinder.GetFile ( "Input/BlackDots.png" ) ); - EXPECT_EQ ( "0188164c9932359b3f33f176d0d73661c4dc04a8", srtk::Hash( image ) ); - - ASSERT_THROW(srtk::WriteImage( image, dataFinder.GetOutputFile ( "this.isafilenamewithnoimageio" ) ), std::exception ) << "Checking for assert on bad output image name."; -} - - -TEST(IO, DicomSeriesReader) { - - std::vector< std::string > fileNames; - std::vector< std::string > seriesIDs; - std::string dicomDir; - - srtk::ImageSeriesReader reader; - - dicomDir = dataFinder.GetDirectory( ) + "/Input/DicomSeries"; - - seriesIDs = reader.GetGDCMSeriesIDs( dicomDir ); - - EXPECT_EQ( "1.2.840.113619.2.133.1762890640.1886.1055165015.999", seriesIDs[0] ); - - fileNames = reader.GetGDCMSeriesFileNames( dicomDir ); - - srtk::Image image = reader.SetFileNames( fileNames ).Execute(); - EXPECT_EQ( "f5ad2854d68fc87a141e112e529d47424b58acfb", srtk::Hash( image ) ); - - fileNames = reader.GetGDCMSeriesFileNames( dicomDir, "1.2.840.113619.2.133.1762890640.1886.1055165015.999" ); - EXPECT_EQ( 3u, fileNames.size() ); -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkImageTests.cxx deleted file mode 100644 index 370051bef..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageTests.cxx +++ /dev/null @@ -1,1717 +0,0 @@ -/*========================================================================= -* -* Copyright Insight Software Consortium & RTK Consortium -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0.txt -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*=========================================================================*/ -#include - -#include -#include -#include - -#include "srtkAddImageFilter.h" -#include "srtkSubtractImageFilter.h" -#include "srtkMultiplyImageFilter.h" - -#include "srtkImageOperators.h" - -#include "srtkComplexToRealImageFilter.h" -#include "srtkComplexToImaginaryImageFilter.h" -#include "srtkRealAndImaginaryToComplexImageFilter.h" -#include "srtkImportImageFilter.h" - -#include - -#include "rtkConfiguration.h" -#ifdef RTK_USE_CUDA -# include "itkCudaImage.h" -#endif -#include "itkImage.h" -#include "itkVectorImage.h" -#include "itkMetaDataObject.h" - -#include - -namespace -{ -template < class T > -std::ostream& operator<< (std::ostream& os, const std::vector& v) -{ - os << "["; - std::copy( v.begin(), v.end(), std::ostream_iterator(os, ", " ) ); - return os << "]"; -} - -} - - -const double adir[] = {0.0, 0.0, 1.0, - -1.0, 0.0, 0.0, - 0.0, -1.0, 0.0}; - -using rtk::simple::InstantiatedPixelIDTypeList; - - -class Image : public ::testing::Test { -public: - typedef std::auto_ptr srtkAutoImagePointer; - - virtual void SetUp() { - itk::ImageBase<3>::IndexType index; - itk::ImageBase<3>::SizeType size; - itk::ImageBase<3>::RegionType region; - itk::ImageBase<3>::PointType origin; - itk::ImageBase<3>::SpacingType spacing; - // Create an image - for ( int i = 0; i < 3; i++ ) { - index[i] = 0; - size[i] = 64+i; - } - origin[0] = 1.1; - origin[1] = 2.2; - origin[2] = 3.3; - spacing[0] = 0.5; - spacing[1] = 0.5; - spacing[2] = 1.5; - - region.SetSize ( size ); - region.SetIndex ( index ); -#ifdef RTK_USE_CUDA - itk::CudaImage::Pointer im = itk::CudaImage::New(); -#else - itk::Image::Pointer im = itk::Image::New(); -#endif - im->SetRegions ( region ); - im->SetOrigin( origin ); - im->SetSpacing( spacing ); - im->Allocate(); - im->FillBuffer ( 100 ); - itkShortImage = im; - shortImage = srtkAutoImagePointer( new rtk::simple::Image( im.GetPointer() ) ); - -#ifdef RTK_USE_CUDA - itk::CudaImage::Pointer fim = itk::CudaImage::New(); -#else - itk::Image::Pointer fim = itk::Image::New(); -#endif - fim->SetRegions ( region ); - fim->SetOrigin( origin ); - fim->SetSpacing( spacing ); - fim->Allocate(); - fim->FillBuffer ( 0 ); - itkFloatImage = fim; - floatImage = srtkAutoImagePointer( new rtk::simple::Image( fim.GetPointer() ) ); - - itkFloatVectorImage = FloatVectorImageType::New(); - floatVectorImage = srtkAutoImagePointer( new rtk::simple::Image( itkFloatVectorImage.GetPointer() ) ); - - itkFloatVector2DImage = FloatVector2DImageType::New(); - floatVector2DImage = srtkAutoImagePointer( new rtk::simple::Image( itkFloatVector2DImage ) ); - - directionI2D = std::vector(4, 0.0 ); - directionI3D = std::vector(9, 0.0 ); - - directionI2D[0] = directionI2D[3] = 1.0; - - directionI3D[0] = directionI3D[4] = directionI3D[8] = 1.0; - } - - itk::ImageBase<3>::Pointer itkShortImage; - -#ifdef RTK_USE_CUDA - typedef itk::CudaImage ShortImageType; -#else - typedef itk::Image ShortImageType; -#endif - srtkAutoImagePointer shortImage; - -#ifdef RTK_USE_CUDA - typedef itk::CudaImage FloatImageType; -#else - typedef itk::Image FloatImageType; -#endif - srtkAutoImagePointer floatImage; - FloatImageType::Pointer itkFloatImage; - - typedef itk::VectorImage FloatVectorImageType; - srtkAutoImagePointer floatVectorImage; - FloatVectorImageType::Pointer itkFloatVectorImage; - - typedef itk::VectorImage FloatVector2DImageType; - srtkAutoImagePointer floatVector2DImage; - FloatVector2DImageType::Pointer itkFloatVector2DImage; - - srtkAutoImagePointer differentSizedImage; - ShortImageType::Pointer itkDifferentSizedImage; - - - std::vector directionI2D; - std::vector directionI3D; - -}; - - -TEST_F(Image,Create) { - ASSERT_TRUE ( shortImage->GetITKBase() != NULL ); - EXPECT_EQ ( shortImage->GetWidth(), itkShortImage->GetLargestPossibleRegion().GetSize()[0] ) << " Checking image width"; - EXPECT_EQ ( shortImage->GetHeight(), itkShortImage->GetLargestPossibleRegion().GetSize()[1] ) << " Checking image height"; - EXPECT_EQ ( shortImage->GetDepth(), itkShortImage->GetLargestPossibleRegion().GetSize()[2] ) << " Checking image depth"; - - EXPECT_EQ ( shortImage->GetSize()[0], shortImage->GetWidth() ); - EXPECT_EQ ( shortImage->GetSize()[1], shortImage->GetHeight() ); - EXPECT_EQ ( shortImage->GetSize()[2], shortImage->GetDepth() ); - - std::vector< unsigned int > size = shortImage->GetSize(); - - EXPECT_EQ ( size[0], shortImage->GetWidth() ); - EXPECT_EQ ( size[1], shortImage->GetHeight() ); - EXPECT_EQ ( size[2], shortImage->GetDepth() ); - -} - -TEST_F(Image,ImageDataType) { - - // this test checks that the DataType of the images are correct - int result; - - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::BasicPixelID >::Result; - EXPECT_EQ( shortImage->GetPixelIDValue(), result); - EXPECT_EQ( shortImage->GetPixelID(), result); - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::BasicPixelID >::Result; - EXPECT_EQ( floatImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatImage->GetPixelID(), result ); - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::VectorPixelID >::Result; - EXPECT_EQ( floatVectorImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVectorImage->GetPixelID(), result ); - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::VectorPixelID >::Result; - EXPECT_EQ( floatVector2DImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVector2DImage->GetPixelID(), result ); - - - result = rtk::simple::PixelIDToPixelIDValue< rtk::simple::BasicPixelID >::Result; - EXPECT_EQ( shortImage->GetPixelIDValue(), result); - EXPECT_EQ( shortImage->GetPixelID(), result); - - result = rtk::simple::PixelIDToPixelIDValue< rtk::simple::BasicPixelID >::Result; - EXPECT_EQ( floatImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatImage->GetPixelID(), result ); - - result = rtk::simple::PixelIDToPixelIDValue< rtk::simple::VectorPixelID >::Result; - EXPECT_EQ( floatVectorImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVectorImage->GetPixelID(), result ); - - result = rtk::simple::PixelIDToPixelIDValue< rtk::simple::VectorPixelID >::Result; - EXPECT_EQ( floatVector2DImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVector2DImage->GetPixelID(), result ); - - - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::ImageTypeToPixelID::PixelIDType >::Result; - EXPECT_EQ( shortImage->GetPixelIDValue(), result ); - EXPECT_EQ( shortImage->GetPixelID(), result ); - - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::ImageTypeToPixelID::PixelIDType >::Result; - EXPECT_EQ( floatVectorImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVectorImage->GetPixelID(), result ); - - - result = rtk::simple::ImageTypeToPixelIDValue::Result; - EXPECT_EQ( shortImage->GetPixelIDValue(), result ); - EXPECT_EQ( shortImage->GetPixelID(), result ); - - result = rtk::simple::ImageTypeToPixelIDValue::Result; - EXPECT_EQ( floatVectorImage->GetPixelIDValue(), result ); - EXPECT_EQ( floatVectorImage->GetPixelID(), result ); - - -} - -TEST_F(Image,Constructors) { - rtk::simple::HashImageFilter hasher; - int result; - - { - rtk::simple::Image image; - EXPECT_EQ ( 0u, image.GetWidth() ); - EXPECT_EQ ( 0u, image.GetHeight() ); - EXPECT_EQ ( 0u, image.GetDepth() ); - } - - rtk::simple::Image image ( 64, 65, 66, rtk::simple::srtkUInt8 ); - EXPECT_EQ ( "08183e1b0c50fd2cf6f070b58e218443fb7d5317", hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).Execute ( image ) ) << " SHA1 hash value srtkUInt8"; - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::BasicPixelID >::Result; - EXPECT_EQ ( image.GetPixelIDValue(), result ); - EXPECT_EQ ( image.GetPixelIDTypeAsString(), "8-bit unsigned integer" ); - EXPECT_EQ ( image.GetDimension(), 3u ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 65u, image.GetHeight() ); - EXPECT_EQ ( 66u, image.GetDepth() ); - EXPECT_EQ( image.GetDirection(), directionI3D ); - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkInt16 ); - EXPECT_EQ ( "645b71695b94923c868e16b943d8acf8f6788617", hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).Execute ( image ) ) << " SHA1 hash value srtkUInt16"; - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::BasicPixelID >::Result; - EXPECT_EQ ( image.GetPixelIDValue(), result ); - EXPECT_EQ ( image.GetPixelIDTypeAsString(), "16-bit signed integer" ); - EXPECT_EQ ( image.GetDimension(), 3u ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 65u, image.GetHeight() ); - EXPECT_EQ ( 66u, image.GetDepth() ); - EXPECT_EQ( image.GetDirection(), directionI3D ); - - image = rtk::simple::Image ( 64, 65, rtk::simple::srtkUInt16 ); - EXPECT_EQ ( "e3c464cc1b73df3f48bacf238a80f88b5ab0d3e6", hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).Execute ( image ) ) << " SHA1 hash value srtkUInt16"; - result = typelist::IndexOf< InstantiatedPixelIDTypeList, rtk::simple::BasicPixelID >::Result; - EXPECT_EQ ( image.GetPixelIDValue(), result ); - EXPECT_EQ ( image.GetPixelIDTypeAsString(), "16-bit unsigned integer" ); - EXPECT_EQ ( image.GetDimension(), 2u ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 65u, image.GetHeight() ); - EXPECT_EQ ( 0u, image.GetDepth() ); - EXPECT_EQ ( 1u, image.GetNumberOfComponentsPerPixel() ); - EXPECT_EQ( image.GetDirection(), directionI2D ); - - // Test the constructors for vector images - std::vector s2d(2, 10); - std::vector s3d(3, 5); - - image = rtk::simple::Image( s2d, rtk::simple::srtkVectorUInt8 ); - - EXPECT_EQ ( image.GetDimension(), 2u ); - EXPECT_EQ ( 2u, image.GetNumberOfComponentsPerPixel() ); - image = rtk::simple::Image( s3d, rtk::simple::srtkVectorFloat32 ); - EXPECT_EQ ( image.GetDimension(), 3u ); - EXPECT_EQ ( 3u, image.GetNumberOfComponentsPerPixel() ); - - image = rtk::simple::Image( s2d, rtk::simple::srtkVectorInt16, 5 ); - EXPECT_EQ ( image.GetDimension(), 2u ); - EXPECT_EQ ( 5u, image.GetNumberOfComponentsPerPixel() ); - image = rtk::simple::Image( s3d, rtk::simple::srtkVectorFloat64, 10 ); - EXPECT_EQ ( image.GetDimension(), 3u ); - EXPECT_EQ ( 10u, image.GetNumberOfComponentsPerPixel() ); - - - // check for error when incorrect number of dimensions are requested - std::vector s1d(1, 100); - std::vector s4d(4, 100); - ASSERT_ANY_THROW( rtk::simple::Image( s1d, rtk::simple::srtkVectorFloat64 ) ); - ASSERT_ANY_THROW( rtk::simple::Image( s4d, rtk::simple::srtkVectorFloat64 ) ); - - // check for error with bad pixelID - ASSERT_ANY_THROW( rtk::simple::Image( s2d, rtk::simple::srtkUnknown ) ); - ASSERT_ANY_THROW( rtk::simple::Image( s2d, rtk::simple::PixelIDValueEnum(-100) ) ); - - // check for error when non-vector type requests components ( should - // this be an error or should we just be converted to a vector ) - ASSERT_ANY_THROW( rtk::simple::Image( s2d, rtk::simple::srtkInt16, 10 ) ); - ASSERT_ANY_THROW( rtk::simple::Image( s2d, rtk::simple::srtkLabelUInt8, 10 ) ); - - // currently we don't have a good interface to check the values of - // these images, let just construct these types need todo better - // testing! - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkLabelUInt8 ); - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 65u, image.GetHeight() ); - EXPECT_EQ ( 66u, image.GetDepth() ); - EXPECT_EQ ( 1u, image.GetNumberOfComponentsPerPixel() ); - EXPECT_EQ( image.GetDirection(), directionI3D ); - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkLabelUInt16 ); - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkLabelUInt32 ); - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkVectorUInt8 ); - - EXPECT_EQ ( 64u, image.GetWidth() ); - EXPECT_EQ ( 65u, image.GetHeight() ); - EXPECT_EQ ( 66u, image.GetDepth() ); - EXPECT_EQ ( 3u, image.GetNumberOfComponentsPerPixel() ); - - image = rtk::simple::Image ( 64, 65, 66, rtk::simple::srtkVectorUInt16 ); - EXPECT_EQ ( 3u, image.GetNumberOfComponentsPerPixel() ); -} - -TEST_F(Image,Hash) { - rtk::simple::HashImageFilter hasher; - EXPECT_EQ ( "a998ea8b4999b4db9cbad033a52fe6d654211ff9", hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).Execute ( *shortImage ) ) << " SHA1 hash value"; - EXPECT_EQ ( "8cdd56962c5b3aabbfac56cd4dce1c7e", hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ).Execute ( *shortImage ) ) << " MD5 hash value"; - - EXPECT_EQ ( "3b6bfcb1922bf8b29b171062ad722c82f8aa3f50", hasher.SetHashFunction ( rtk::simple::HashImageFilter::SHA1 ).Execute ( *floatImage ) ) << " SHA1 hash value"; - EXPECT_EQ ( "e5eba8af943d7911220c9f2fb9b5b9c8", hasher.SetHashFunction ( rtk::simple::HashImageFilter::MD5 ).Execute ( *floatImage ) ) << " MD5 hash value"; -} - -TEST_F(Image,Transforms) { - - // Origin is [1.1, 2.2, 3.3] - // Spacing is [0.5, 0.5, 1.5] - - { - // Index to Physical Point - std::vector idx(3,1u); - std::vector pt = shortImage->TransformIndexToPhysicalPoint(idx); - EXPECT_EQ(1.6, pt[0]) << " Pt to Idx [0]"; - EXPECT_EQ(2.7, pt[1]) << " Pt to Idx [1]"; - EXPECT_EQ(4.8, pt[2]) << " Pt to Idx [2]"; - - - // Physical Point to Index - idx = shortImage->TransformPhysicalPointToIndex(pt); - EXPECT_EQ(1u, idx[0]) << " Idx to Pt [0]"; - EXPECT_EQ(1u, idx[1]) << " Idx to Pt [1]"; - EXPECT_EQ(1u, idx[2]) << " Idx to Pt [2]"; - } - - { - std::vector idx(3,0.5); - std::vector pt = shortImage->TransformContinuousIndexToPhysicalPoint(idx); - EXPECT_EQ(1.35, pt[0]) << " Pt to Idx [0]"; - EXPECT_EQ(2.45, pt[1]) << " Pt to Idx [1]"; - EXPECT_EQ(4.05, pt[2]) << " Pt to Idx [2]"; - - idx = shortImage->TransformPhysicalPointToContinuousIndex(pt); - EXPECT_EQ(.5, idx[0]) << " Idx to Pt [0]"; - EXPECT_EQ(.5, idx[1]) << " Idx to Pt [1]"; - EXPECT_EQ(.5, idx[2]) << " Idx to Pt [2]"; - } -} - -TEST_F(Image,Properties) { - - // GetOrigin - std::vector origin = shortImage->GetOrigin(); - EXPECT_EQ(origin[0], 1.1) << " GetOrigin[0]"; - EXPECT_EQ(origin[1], 2.2) << " GetOrigin[1]"; - EXPECT_EQ(origin[2], 3.3) << " GetOrigin[2]"; - - // SetOrigin - std::vector newOrigin; - newOrigin.push_back(0.1); - newOrigin.push_back(0.2); - newOrigin.push_back(0.3); - shortImage->SetOrigin( newOrigin ); - EXPECT_EQ(shortImage->GetOrigin()[0], 0.1) << " SetOrigin[0]"; - EXPECT_EQ(shortImage->GetOrigin()[1], 0.2) << " SetOrigin[1]"; - EXPECT_EQ(shortImage->GetOrigin()[2], 0.3) << " SetOrigin[2]"; - shortImage->SetOrigin( origin ); - - // GetSpacing - std::vector spacing = shortImage->GetSpacing(); - EXPECT_EQ(spacing[0], 0.5) << " GetSpacing[0]"; - EXPECT_EQ(spacing[1], 0.5) << " GetSpacing[1]"; - EXPECT_EQ(spacing[2], 1.5) << " GetSpacing[2]"; - - // SetSpacing - std::vector newSpacing; - newSpacing.push_back(1.9); - newSpacing.push_back(2.8); - newSpacing.push_back(3.7); - shortImage->SetSpacing( newSpacing ); - EXPECT_EQ(shortImage->GetSpacing()[0], 1.9) << " SetSpacing[0]"; - EXPECT_EQ(shortImage->GetSpacing()[1], 2.8) << " SetSpacing[1]"; - EXPECT_EQ(shortImage->GetSpacing()[2], 3.7) << " SetSpacing[2]"; - shortImage->SetOrigin( spacing ); - - // Check Error conditions for setting Spacing and Origin - newSpacing.clear(); - newSpacing.push_back( 99 ); - newSpacing.push_back( 99 ); - ASSERT_ANY_THROW( shortImage->SetSpacing( newSpacing ) ) << " setting with too short spacing"; - - newOrigin.clear(); - newOrigin.push_back( -99.99 ); - ASSERT_ANY_THROW( shortImage->SetOrigin( newOrigin ) ) << "setting with too short origin"; - - // GetDirection - EXPECT_EQ ( shortImage->GetDirection(), directionI3D ) << " Checking Get Direction matrix for identity"; - - - // SetDirection - std::vector vdir( adir, adir+9); - shortImage->SetDirection( vdir ); - for( unsigned int i = 0 ; i < 9; ++i ) - { - EXPECT_EQ ( shortImage->GetDirection()[i], vdir[i] ) << " Checking Direction matrix at index " << i; - } - - // Check Error Conditions for setting Directions - ASSERT_ANY_THROW( shortImage->SetDirection( std::vector( adir, adir + 4 ) ) ); - ASSERT_ANY_THROW( shortImage->SetDirection( std::vector( adir, adir + 8 ) ) ); -} - -namespace srtk = rtk::simple; - - -TEST_F(Image, CopyInformation) -{ - - srtk::Image img1( 10, 20, srtk::srtkFloat32 ); - srtk::Image img3d( 10, 10, 10, srtk::srtkUInt32 ); - - - // number if dimension are different - EXPECT_ANY_THROW( img1.CopyInformation( img3d ) ); - - srtk::Image img2( 10, 10, srtk::srtkUInt16 ); - - // image sizes don't match - EXPECT_ANY_THROW( img1.CopyInformation( img2 ) ); - - // fix the size to match - - img2 = srtk::Image( img1.GetSize(), srtk::srtkFloat64); - img2.SetOrigin( shortImage->GetOrigin() ); - img2.SetSpacing( shortImage->GetSpacing() ); - - EXPECT_NO_THROW( img1.CopyInformation( img2 ) ); - EXPECT_EQ( img1.GetSpacing(), img2.GetSpacing() ); - EXPECT_EQ( img1.GetOrigin(), img2.GetOrigin() ); - EXPECT_EQ( img1.GetDirection(), img2.GetDirection() ); - -} - -TEST_F(Image, CopyOnWrite) -{ - // test that a just constructed image only have 1 referecne - srtk::Image img( 10, 10, srtk::srtkInt16 ); - EXPECT_EQ(static_cast(&img)->GetITKBase()->GetReferenceCount(), 1 ) - << " Reference Count for just constructed Image"; - - // use the image from the fixture to test some copy constructor - EXPECT_EQ(static_cast(shortImage.get())->GetITKBase()->GetReferenceCount(), 2 ) - << " Reference Count for shared shortImage initial"; - srtk::Image img0 = *shortImage; - EXPECT_EQ(static_cast(shortImage.get())->GetITKBase()->GetReferenceCount(), 3 ) - << " Reference Count for shared shortImage copy"; - srtk::Image imgCopy = img0; - EXPECT_EQ(static_cast(shortImage.get())->GetITKBase()->GetReferenceCount(), 4 ) - << " Reference Count for shared shortImage second copy"; - - // check set origin for copy on write - imgCopy.SetOrigin( std::vector( 3, 2.123 ) ); - EXPECT_EQ(static_cast(&imgCopy)->GetITKBase()->GetReferenceCount(), 1 ) - << " Reference Count for copy after set origin"; - EXPECT_EQ(static_cast(&img0)->GetITKBase()->GetReferenceCount(), 3 ) - << " Reference Count for shared after set origin"; - - // check shallow copy on assignment - imgCopy = img0; - EXPECT_EQ(static_cast(&imgCopy)->GetITKBase()->GetReferenceCount(), 4 ) - << " Reference Count for copy after assigment"; - EXPECT_EQ(static_cast(&img0)->GetITKBase()->GetReferenceCount(), 4 ) - << " Reference Count for shared after assignment"; - - // check copy on write with set spacing - imgCopy.SetSpacing( std::vector( 3, 3.45 ) ); - EXPECT_EQ(static_cast(&imgCopy)->GetITKBase()->GetReferenceCount(), 1 ) - << " Reference Count for copy after set spacing"; - EXPECT_EQ(static_cast(&img0)->GetITKBase()->GetReferenceCount(), 3 ) - << " Reference Count for shared after set spacing"; - EXPECT_EQ( srtk::Hash( imgCopy ), srtk::Hash( img0 ) ) << "Hash for shared and copy after set spacing"; -} - -TEST_F(Image,Operators) -{ - - // the float image should begin as all zeros - srtk::Image imgA = *floatImage; - srtk::Image imgB = *floatImage; - srtk::Image imgC = *floatImage; - - itk::Index<3> idx; - idx.Fill( 0 ); - - std::cout << "Testing Arithmetic operators" << std::endl; - imgA += 1; // all 1s - imgB = imgA; - - // 2 = 1 + 1 - imgC = imgA + imgB; - - // 1 = 2 - 1 - imgA = imgC - imgA; - -#ifdef RTK_USE_CUDA - float v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - float v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 1 ) << "value check 1"; - - // 4 = 2 * 2 - imgB = imgC * imgC; - - // 2 = 4 / 2 - imgA = imgB / imgC; - - // .4 = 4 * .1 - imgC = imgB * .1; - - // 20 = .4 * 50; - imgA = imgC * 50; - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 20 ) << "value check 2"; - - // original value should have never changed -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( floatImage->GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( floatImage->GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 0 ) << "value check 3"; - - // 0 = 20 + -20 - imgC = imgA + -20; - - // 10 = 6 + 4 - imgB = 6 + imgB; - - // 2 = 10 - 8 - imgA = imgB - 8; - - // .5 = 2 / 4 - imgC = imgA / 4; - - std::cout << "Testing Logical Operators" << std::endl; - imgA = ~*shortImage; - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, -101 ); - - imgA = srtk::Image(10,10,10, srtk::srtkUInt8)+1; - imgB = ~imgA; // <- 253 - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgB.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgB.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( 254, v ); - - // 0 = 1 & 254 - imgC = imgA & imgB; - - // 254 = 254 | 0 - imgA = imgB | imgC; - - // 254 = 254 ^ 0 - imgB = imgA ^ imgC; - - // 0 = 254 ^ 254 - imgA = imgB ^ imgA; - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( 0 ,v ) << "value check 4"; -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgB.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgB.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 254 ) << "value check 5"; - - std::cout << "Testing Compoung assignment operators" << std::endl; - imgA = *floatImage; - - // 1.5 = 0 + 1.5 - imgA += 1.5; - - // 3.0 = 1.5 + 1.5 - imgA += imgA; - - // 0 = 1.5 - 1.5 - imgA -= imgA; - - // -8 = 0 - 8 - imgA -= 8; - - // 4 = 8 * .5 - imgA *= .5; - - // 16 = 4 * 4 - imgA *= imgA; - - // 8 = 16 / 2 - imgA /= 2; - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 8 ) << "value check 6"; - - // 1 = 8 / 8 - imgA /= imgA; - - // 100 = ~~100 - imgA = ~~*shortImage; - - // 100 = 100 & 100 - imgA &= imgA; - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( v, 100 ) << "value check 7"; - - // 100 = 100 | 100 - imgA |= *shortImage; - - // 1 = 100 ^ 100 - imgA ^= *shortImage; - - -#ifdef RTK_USE_CUDA - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#else - v = dynamic_cast*>( imgA.GetITKBase() )->GetPixel( idx); -#endif - EXPECT_EQ( 0, v ) << "value check 8"; -} - -TEST_F(Image,SetPixel) -{ - - // this test is designed to run all SetPixel methods - - srtk::Image img = srtk::Image( 10, 10, srtk::srtkFloat64 ); - - - ASSERT_NO_THROW( img.SetPixelAsDouble( std::vector( 2, 0 ), 99.0 ) ) << " correct setting"; - EXPECT_EQ( img.GetPixelAsDouble( std::vector( 2, 0 ) ), 99.0 ) << "Set value check"; - ASSERT_NO_THROW( img.SetPixelAsDouble( std::vector( 3, 0 ), 99.0 ) ) << " correct setting, with extra size index"; - EXPECT_EQ( img.GetPixelAsDouble( std::vector( 2, 0 ) ), 99.0 ) << "Set value check"; - ASSERT_ANY_THROW( img.SetPixelAsDouble( std::vector( 1, 0 ), 99.0 ) ) << " too short index"; - - ASSERT_ANY_THROW( img.SetPixelAsInt8( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt8( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt16( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt16( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt32( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt32( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt64( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt64( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsFloat( std::vector( 2, 0 ), 99.0 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt8( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt8( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt16( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt16( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt32( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt32( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt64( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt64( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat32( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsComplexFloat32( std::vector( 2, 0 ), std::complex(99.0,1.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsComplexFloat64( std::vector( 2, 0 ), std::complex(99, -1.0) ) ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkVectorFloat64 ); - - ASSERT_NO_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(2,99.0 ) ) ) << " correct setting"; - EXPECT_EQ( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ), std::vector(2,99.0 )) << "Set value check"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(3,99.0 ) ) ) << " too long length"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(1,99.0 ) ) ) << " too short length"; - ASSERT_NO_THROW( img.SetPixelAsVectorFloat64( std::vector( 3, 0 ), std::vector(2,98.0 ) ) ) << " correct setting, long idx "; - EXPECT_EQ( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ), std::vector(2,98.0 )) << "Set value check"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 1, 0 ), std::vector(2,98.0 ) ) ) << " too short idx "; - - ASSERT_ANY_THROW( img.SetPixelAsInt8( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt8( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt16( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt16( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt32( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt32( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt64( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt64( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsFloat( std::vector( 2, 0 ), 99.0 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsDouble( std::vector( 2, 0 ), 99.0 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt8( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt8( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt16( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt16( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt32( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt32( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt64( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt64( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat32( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsComplexFloat32( std::vector( 2, 0 ), std::complex(99.0,1.0) ) ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkLabelUInt8 ); - - try - { - img.SetPixelAsUInt8( std::vector( 2, 0 ), 99.0 ); - } - catch( std::exception &e) - { - std::cerr << e.what() << std::endl; - } - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 2, 0 ) ), 99.0 ) << "Set value check"; - ASSERT_NO_THROW( img.SetPixelAsUInt8( std::vector( 3, 0 ), 99.0 ) ) << " correct setting, with extra size index"; - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 2, 0 ) ), 99.0 ) << "Set value check"; - ASSERT_ANY_THROW( img.SetPixelAsUInt8( std::vector( 1, 0 ), 99.0 ) ) << " too short index"; - - std::cout << "check\n"; - ASSERT_ANY_THROW( img.SetPixelAsInt8( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt16( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt16( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt32( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt32( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsInt64( std::vector( 2, 0 ), 99 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsUInt64( std::vector( 2, 0 ), 99u ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsFloat( std::vector( 2, 0 ), 99.0 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsDouble( std::vector( 2, 0 ), 99.0 ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt8( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt8( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt16( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt16( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt32( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt32( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorInt64( std::vector( 2, 0 ), std::vector(3,99) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorUInt64( std::vector( 2, 0 ), std::vector(3,99u) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat32( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsVectorFloat64( std::vector( 2, 0 ), std::vector(3,99.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsComplexFloat32( std::vector( 2, 0 ), std::complex(99.0,1.0) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.SetPixelAsComplexFloat64( std::vector( 2, 0 ), std::complex(99, -1.0) ) ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkFloat64 ); - - // Check that out of bounds throw - uint32_t xOOB[] = {10,0,0}; - uint32_t yOOB[] = {0,10,0}; - uint32_t zOOB[] = {0,0,10}; - ASSERT_THROW( img.SetPixelAsDouble( std::vector( xOOB, xOOB+3 ), 0.0 ), rtk::simple::GenericException ) << "x out of bounds"; - ASSERT_THROW( img.SetPixelAsDouble( std::vector( yOOB, yOOB+3 ), 0.0 ), rtk::simple::GenericException ) << "y out of bounds"; - ASSERT_NO_THROW( img.SetPixelAsDouble( std::vector( zOOB, zOOB+3 ), 0.0 ) ) << "z out of bounds, expect truncation of z-dim"; - -} - - -TEST_F(Image,GetPixel) -{ - - // this test is designed to run all GetPixel methods for scalar types - - srtk::Image img = srtk::Image( 10, 10, srtk::srtkInt8 ); - EXPECT_EQ( img.GetPixelAsInt8( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsInt8( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsInt8( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkUInt8 ); - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, 10, srtk::srtkUInt8 ); - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 3, 0 ) ), 0 ) << " Get 3D with 3D "; - EXPECT_EQ( img.GetPixelAsUInt8( std::vector( 4, 0 ) ), 0 ) << " Get 3D with 4D "; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkInt16 ); - EXPECT_EQ( img.GetPixelAsInt16( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsInt16( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkUInt16 ); - EXPECT_EQ( img.GetPixelAsUInt16( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsUInt16( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 1, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkInt32 ); - EXPECT_EQ( img.GetPixelAsInt32( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsInt32( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkUInt32 ); - EXPECT_EQ( img.GetPixelAsUInt32( std::vector( 2, 0 ) ), 0u ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsUInt32( std::vector( 3, 0 ) ), 0u ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - if ( srtk::srtkInt64 != srtk::srtkUnknown ) - { - img = srtk::Image( 10, 10, srtk::srtkInt64 ); - EXPECT_EQ( img.GetPixelAsInt64( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsInt64( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - } - - if ( srtk::srtkUInt64 != srtk::srtkUnknown ) - { - img = srtk::Image( 10, 10, srtk::srtkUInt64 ); - EXPECT_EQ( img.GetPixelAsUInt64( std::vector( 2, 0 ) ), 0u ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsUInt64( std::vector( 3, 0 ) ), 0u ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - } - - img = srtk::Image( 10, 10, srtk::srtkFloat32 ); - EXPECT_EQ( img.GetPixelAsFloat( std::vector( 2, 0 ) ), 0u ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsFloat( std::vector( 3, 0 ) ), 0u ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkFloat64 ); - EXPECT_EQ( img.GetPixelAsDouble( std::vector( 2, 0 ) ), 0 ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsDouble( std::vector( 3, 0 ) ), 0 ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkComplexFloat32 ); - EXPECT_EQ( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ), std::complex(0.0) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsComplexFloat32( std::vector( 3, 0 ) ), std::complex(0.0) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkComplexFloat64 ); - EXPECT_EQ( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ), std::complex(0.0) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsComplexFloat64( std::vector( 3, 0 ) ), std::complex(0.0) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - - - img = srtk::Image( 10, 10, srtk::srtkFloat64 ); - - // Check that out of bounds throw - uint32_t xOOB[] = {10,0,0}; - uint32_t yOOB[] = {0,10,0}; - uint32_t zOOB[] = {0,0,10}; - ASSERT_THROW( img.GetPixelAsDouble( std::vector( xOOB, xOOB+3 ) ), rtk::simple::GenericException ) << "x out of bounds"; - ASSERT_THROW( img.GetPixelAsDouble( std::vector( yOOB, yOOB+3 ) ), rtk::simple::GenericException ) << "y out of bounds"; - ASSERT_NO_THROW( img.GetPixelAsDouble( std::vector( zOOB, zOOB+3 ) ) ) << "z out of bounds, expect truncation of z-dim"; - -} - - - -TEST_F(Image,GetPixelVector) -{ - - std::vector zero(2,0); - - - // this test is designed to run all GetPixel methods for Vector types - - srtk::Image img = srtk::Image( 10, 10, srtk::srtkVectorInt8 ); - EXPECT_EQ( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorInt8( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorUInt8 ); - EXPECT_EQ( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorUInt8( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, 10, srtk::srtkVectorUInt8 ); - EXPECT_EQ( img.GetPixelAsVectorUInt8( std::vector( 3, 0 ) ), std::vector(3,0) ) << " Get 3D with 3D "; - EXPECT_EQ( img.GetPixelAsVectorUInt8( std::vector( 4, 0 ) ), std::vector(3,0) ) << " Get 3D with 4D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 3, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkVectorInt16 ); - EXPECT_EQ( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorInt16( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorUInt16 ); - EXPECT_EQ( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorUInt16( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 1, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorInt32 ); - EXPECT_EQ( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorInt32( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorUInt32 ); - EXPECT_EQ( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorUInt32( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - if ( srtk::srtkVectorInt64 != srtk::srtkUnknown ) - { - img = srtk::Image( 10, 10, srtk::srtkVectorInt64 ); - EXPECT_EQ( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorInt64( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - } - - if ( srtk::srtkVectorUInt64 != srtk::srtkUnknown ) - { - img = srtk::Image( 10, 10, srtk::srtkVectorUInt64 ); - EXPECT_EQ( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorUInt64( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - } - - img = srtk::Image( 10, 10, srtk::srtkVectorFloat32 ); - EXPECT_EQ( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorFloat32( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsDouble( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorFloat64 ); - EXPECT_EQ( img.GetPixelAsVectorFloat64( std::vector( 2, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 2D "; - EXPECT_EQ( img.GetPixelAsVectorFloat64( std::vector( 3, 0 ) ), std::vector(zero.begin(),zero.end()) ) << " Get 2D with 3D "; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat64( std::vector( 1, 0 ) ) ) << " Get with idx too small"; - ASSERT_ANY_THROW( img.GetPixelAsUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsFloat( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt8( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt16( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorUInt64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsVectorFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat32( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetPixelAsComplexFloat64( std::vector( 2, 0 ) ) ) << " Get with wrong type"; - - - // Check that out of bounds throw - uint32_t xOOB[] = {10,0,0}; - uint32_t yOOB[] = {0,10,0}; - uint32_t zOOB[] = {0,0,10}; - ASSERT_THROW( img.GetPixelAsVectorFloat64( std::vector( xOOB, xOOB+3 ) ), rtk::simple::GenericException ) << "x out of bounds"; - ASSERT_THROW( img.GetPixelAsVectorFloat64( std::vector( yOOB, yOOB+3 ) ), rtk::simple::GenericException ) << "y out of bounds"; - ASSERT_NO_THROW( img.GetPixelAsVectorFloat64( std::vector( zOOB, zOOB+3 ) ) ) << "z out of bounds, expect truncation of z-dim"; - -} - -TEST_F(Image, GetBuffer) -{ - - // this test is designed to run all GetBuffer methods - srtk::Image img = srtk::Image( 10, 10, srtk::srtkUInt8 ); - EXPECT_EQ( img.GetBufferAsUInt8()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkInt8 ); - EXPECT_EQ( img.GetBufferAsInt8()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, 10, srtk::srtkUInt8 ); - EXPECT_EQ( img.GetBufferAsUInt8()[99], 0 ) << " Get 3D with 3D "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkInt16 ); - EXPECT_EQ( img.GetBufferAsInt16()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkUInt16 ); - EXPECT_EQ( img.GetBufferAsUInt16()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkInt32 ); - EXPECT_EQ( img.GetBufferAsInt32()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkUInt32 ); - EXPECT_EQ( img.GetBufferAsUInt32()[99], 0u ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - - // currently Int64 pixel types are instantiated yet, - // so an exception will be thrown. - try - { - img = srtk::Image( 10, 10, srtk::srtkUInt64 ); - EXPECT_EQ( img.GetBufferAsUInt64()[99], 0u ) << " Get last element in buffer "; - - img = srtk::Image( 10, 10, srtk::srtkInt64 ); - EXPECT_EQ( img.GetBufferAsInt64()[99], 0u ) << " Get last element in buffer "; - } - catch ( std::exception &e) - { - std::cout << "Exception: " << e.what() << std::endl; - } - - img = srtk::Image( 10, 10, srtk::srtkFloat32 ); - EXPECT_EQ( img.GetBufferAsFloat()[99], 0u ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkFloat64 ); - EXPECT_EQ( img.GetBufferAsDouble()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - -} - - -TEST_F(Image, GetBufferVector) -{ - - // this test is designed to run all GetBuffer methods for vector images - srtk::Image img = srtk::Image( 10, 10, srtk::srtkVectorUInt8 ); - - EXPECT_EQ( img.GetBufferAsUInt8()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorInt8 ); - EXPECT_EQ( img.GetBufferAsInt8()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt64() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, 10, srtk::srtkVectorUInt8 ); - EXPECT_EQ( img.GetBufferAsUInt8()[99], 0 ) << " Get 3D with 3D "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - - img = srtk::Image( 10, 10, srtk::srtkVectorInt16 ); - EXPECT_EQ( img.GetBufferAsInt16()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorUInt16 ); - EXPECT_EQ( img.GetBufferAsUInt16()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorInt32 ); - EXPECT_EQ( img.GetBufferAsInt32()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorUInt32 ); - EXPECT_EQ( img.GetBufferAsUInt32()[99], 0u ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - - // currently Int64 pixel types are instantiated yet, - // so an exception will be thrown. - try - { - img = srtk::Image( 10, 10, srtk::srtkVectorUInt64 ); - EXPECT_EQ( img.GetBufferAsUInt64()[99], 0u ) << " Get last element in buffer "; - - img = srtk::Image( 10, 10, srtk::srtkVectorInt64 ); - EXPECT_EQ( img.GetBufferAsInt64()[99], 0u ) << " Get last element in buffer "; - } - catch ( std::exception &e) - { - std::cout << "Exception: " << e.what() << std::endl; - } - - img = srtk::Image( 10, 10, srtk::srtkVectorFloat32 ); - EXPECT_EQ( img.GetBufferAsFloat()[99], 0u ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsDouble() ) << " Get with wrong type"; - - img = srtk::Image( 10, 10, srtk::srtkVectorFloat64 ); - EXPECT_EQ( img.GetBufferAsDouble()[99], 0 ) << " Get last element in buffer "; - ASSERT_ANY_THROW( img.GetBufferAsUInt8() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt16() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsUInt32() ) << " Get with wrong type"; - ASSERT_ANY_THROW( img.GetBufferAsFloat() ) << " Get with wrong type"; - -} - -TEST_F(Image,MetaDataDictionary) -{ - srtk::Image img = srtk::Image( 10,10, 10, srtk::srtkFloat32 ); - - - EXPECT_EQ( 0u, img.GetMetaDataKeys().size() ); - EXPECT_FALSE( img.HasMetaDataKey("nothing") ); - EXPECT_ANY_THROW( img.GetMetaData("anything") ); - - { - itk::DataObject::Pointer dataObject = img.GetITKBase(); - - itk::MetaDataDictionary &mdd = dataObject->GetMetaDataDictionary(); - - itk::EncapsulateMetaData(mdd,"Float",static_cast(1.234560F)); - itk::EncapsulateMetaData(mdd,"String",std::string("std::string")); - } - - EXPECT_EQ( 2u, img.GetMetaDataKeys().size() ); - EXPECT_FALSE( img.HasMetaDataKey("nothing") ); - EXPECT_TRUE( img.HasMetaDataKey("Float") ); - EXPECT_TRUE( img.HasMetaDataKey("String") ); - - EXPECT_EQ( "std::string", img.GetMetaData("String") ); - - std::vector keys = img.GetMetaDataKeys(); - for ( size_t i = 0; i < keys.size(); ++i ) - { - std::string value; - - EXPECT_NO_THROW( value = img.GetMetaData( keys[i]) ); - std::cout << "Key = \"" << keys[i] << "\" Value = \"" << value << "\"" << std::endl; - } - -} - - -TEST_F(Image,Mandelbrot) -{ - unsigned int xs = 35*100; - unsigned int ys = 20*100; - - srtk::Image real = srtk::Image( xs, ys, srtk::srtkFloat32 ); - srtk::Image imagine = srtk::Image( xs, ys, srtk::srtkFloat32 ); - - for (unsigned int i = 0; i < xs; ++i ) - { - for ( unsigned int j = 0; j < ys; ++j ) - { - std::vector idx(2); - idx[0] = i; - idx[1] = j; - - real.SetPixelAsFloat( idx, -2.5 + ( double(i)/xs ) * 3.5 ); - imagine.SetPixelAsFloat( idx, -1 + ( double(j)/ys ) * 2 ); - } - } - - srtk::Image C = srtk::RealAndImaginaryToComplex( real, imagine ); - std::cout << "Generated C" << std::endl; - - // initial image filled with 0s - srtk::Image img( xs, ys, srtk::srtkComplexFloat32 ); - - for ( unsigned int i = 0; i < 25; ++i ) - { - img *= img; - img += C; - } - - srtk::Image R = srtk::ComplexToReal( img ); - srtk::Image I = srtk::ComplexToImaginary( img ); - img = R*R + I*I; - - srtk::WriteImage( img, "mandelbrot.nrrd" ); -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImageTests.py b/utilities/SimpleRTK/Testing/Unit/srtkImageTests.py deleted file mode 100644 index a308459fc..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImageTests.py +++ /dev/null @@ -1,82 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium & RTK Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -from __future__ import print_function -import unittest - -import SimpleRTK as srtk -import sys - - -class ImageTests(unittest.TestCase): - """These tests are suppose to test the python interface to the srtk::Image""" - - - - def setUp(self): - pass - - def test_legacy(self): - """ This is old testing cruft before tehe unittest enlightenment """ - - image = srtk.Image( 10, 10, srtk.srtkInt32 ) - - image + image - image + 1 - 1 + image - image - image - image - 1 - 1 - image - image * image - image * 1 - 1 * image - image / image - 1.0 / image - image / 1.0 - image // image - image // 1 - 1 // image - image & image - image | image - image ^ image - ~image - - image += image - image -= image - image *= image - image /= image - image //= image - - image = image * 0 - - image.SetPixel( 0, 0, 1 ) - image[ [0,1] ] = 2 - image[ 9,9 ] = 3 - - image.GetPixel( 1,1 ) - #image.GetPixel( [1,1] ) - image[1,1] - image[ [ 1,1 ] ] - - self.assertEqual(sum( image ), 6) - - self.assertEqual(len( image ), 100) - - -if __name__ == '__main__': - unittest.main() diff --git a/utilities/SimpleRTK/Testing/Unit/srtkImportImageTest.cxx b/utilities/SimpleRTK/Testing/Unit/srtkImportImageTest.cxx deleted file mode 100644 index 428510e0c..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkImportImageTest.cxx +++ /dev/null @@ -1,431 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include -#include - -namespace -{ -template < class T > -std::ostream& operator<< (std::ostream& os, const std::vector& v) -{ - os << "["; - std::copy( v.begin(), v.end(), std::ostream_iterator(os, ", " ) ); - return os << "]"; -} -} - - -// Common fixture for Import tests -class Import - : public ::testing::Test { -public: - virtual void SetUp() { - spacing1 = std::vector( 3, 1.0 ); - spacing2.push_back( 1.1 ); - spacing2.push_back( 1.2 ); - - origin0 = std::vector( 3, 0.0 ); - origin1 = std::vector( 3, 1.0 ); - origin2.push_back( 2.71828183 ); - origin2.push_back( 3.14159265 ); - direction2D = std::vector(4, 0.0 ); - direction3D = std::vector(9, 0.0 ); - - direction2D[0] = direction2D[3] = 1.0; - - direction3D[0] = direction3D[4] = direction3D[8] = 1.0; - } - - std::vector spacing1; - std::vector spacing2; - - std::vector origin0; - std::vector origin1; - std::vector origin2; - - std::vector< uint8_t > uint8_buffer; - std::vector< int8_t > int8_buffer; - std::vector< uint16_t > uint16_buffer; - std::vector< int16_t > int16_buffer; - std::vector< uint32_t > uint32_buffer; - std::vector< int32_t > int32_buffer; - std::vector< uint64_t > uint64_buffer; - std::vector< int64_t > int64_buffer; - std::vector< float > float_buffer; - std::vector< double > double_buffer; - - std::vector direction2D; - std::vector direction3D; -}; - -namespace srtk = rtk::simple; - -TEST_F(Import,Required) { - // the purpose of this test is to verify that the filter has certain - // methods, and to imporve coverage - - // Check has Self - typedef rtk::simple::ImportImageFilter::Self ImportFilterType; - - // default constructable - rtk::simple::ImportImageFilter importer; - - // has ToString method - std::cout << importer.ToString() << std::endl; - - EXPECT_EQ( "ImportImageFilter", importer.GetName() ); -} - -TEST_F(Import,BasicUsage) { - - // This test is designed to set everything and verify it - - uint8_buffer = std::vector< uint8_t >( 128*128*128, 17 ); - - srtk::ImportImageFilter importer; - importer.SetSize( std::vector< unsigned int >( 3, 128u ) ); - importer.SetSpacing( spacing1 ); - importer.SetOrigin( origin0 ); - importer.SetDirection( direction3D ); - importer.SetBufferAsUInt8( &uint8_buffer[0] ); - - srtk::Image image = importer.Execute(); - - ASSERT_EQ( image.GetDimension(), 3u ) << "image dimension check"; - - EXPECT_EQ( image.GetSize()[0], 128u ) << "X size check"; - EXPECT_EQ( image.GetSize()[1], 128u ) << "Y size check"; - EXPECT_EQ( image.GetSize()[2], 128u ) << "Z size check"; - - EXPECT_EQ( image.GetOrigin(), origin0 ) << "origin check"; - EXPECT_EQ( image.GetSpacing(), spacing1 ) << "spacing check"; - - - for ( unsigned int k = 0; k < image.GetSize()[2]; ++k ) - { - std::vector idx(3, 0 ); - idx[2] = k; - for ( unsigned int j = 0; j < image.GetSize()[1]; ++j ) - { - idx[1] = j; - for ( unsigned int i = 0; i < image.GetSize()[0]; ++i ) - { - idx[0] = i; - EXPECT_EQ( image.GetPixelAsUInt8( idx ), 17 ) << " expect all pixel to be 17"; - } - } - } - - - EXPECT_EQ ( "a2178ce2d158a4a7c5a9ef3d03a33a6099b9c5be", srtk::Hash( image ) ) << " hash value for basic uin8_t"; - - // ================================================ - // - // TEST FOR 2D IMAGE - // - int32_buffer = std::vector< int32_t >( 73*73, 21 ); - - importer.SetSize( std::vector< unsigned int >( 2, 73u ) ); - importer.SetSpacing( spacing2 ); - importer.SetOrigin( origin2 ); - importer.SetDirection( direction2D ); - importer.SetBufferAsInt32( &int32_buffer[0] ); - - image = importer.Execute(); - - ASSERT_EQ( image.GetDimension(), 2u ) << "image dimension check"; - - EXPECT_EQ( image.GetSize()[0], 73u ) << "X size check"; - EXPECT_EQ( image.GetSize()[1], 73u ) << "Y size check"; - - EXPECT_EQ( image.GetOrigin(), origin2 ) << "origin check"; - EXPECT_EQ( image.GetSpacing(), spacing2 ) << "spacing check"; - - for ( unsigned int j = 0; j < image.GetSize()[1]; ++j ) - { - std::vector idx(2, 0 ); - idx[1] = j; - for ( unsigned int i = 0; i < image.GetSize()[0]; ++i ) - { - idx[0] = i; - EXPECT_EQ( image.GetPixelAsInt32( idx ), 21 ) << " expect all pixel to be 21"; - } - } - - - EXPECT_EQ ( "6f6eefc4c1833e3e29b0968023ead2141fdbee3f", srtk::Hash( image ) ) << " hash value for basic uin32_t"; -} - -TEST_F(Import,Direction) { - - // This test is to run the direction parameter though it's passes - - srtk::Image img(0,0,srtk::srtkUInt8); - - uint8_buffer = std::vector< uint8_t >( 128*128*128, 17 ); - - - { - srtk::ImportImageFilter importer; - importer.SetSize( std::vector< unsigned int >( 3, 128u ) ); - importer.SetBufferAsUInt8( &uint8_buffer[0] ); - - // check defaults to identity - ASSERT_NO_THROW( img = importer.Execute() ); - EXPECT_EQ( img.GetDirection(), direction3D ); - - - importer.SetDirection( direction2D ); - ASSERT_ANY_THROW( importer.Execute() ) << "Checking 2D direction to 3D import "; - } - - { - srtk::ImportImageFilter importer; - importer.SetSize( std::vector< unsigned int >( 2, 128u ) ); - importer.SetBufferAsUInt8( &uint8_buffer[0] ); - - // check defaults to identity - ASSERT_NO_THROW( img = importer.Execute() ); - EXPECT_EQ( img.GetDirection(), direction2D ); - - importer.SetDirection( direction3D ); - ASSERT_ANY_THROW( importer.Execute() ) << "Checking 3D direction to 2D import"; - } - -} - - -TEST_F(Import,ExhaustiveTypes) { - - srtk::ImportImageFilter importer; - - importer.SetSize( std::vector< unsigned int >( 2, 16u ) ); - importer.SetSpacing( spacing1 ); - importer.SetOrigin( origin0 ); - - EXPECT_EQ( importer.GetSize()[0], 16u ); - EXPECT_EQ( importer.GetSpacing()[0], spacing1[0] ); - EXPECT_EQ( importer.GetOrigin()[0], origin0[1] ); - importer.GetDirection(); - - - uint8_buffer = std::vector< uint8_t >( 16*16, 1 ); - importer.SetBufferAsUInt8( &uint8_buffer[0] ); - EXPECT_EQ ( "ac458b067c6b021c7e9358229b636e9d1e4cb154", srtk::Hash( importer.Execute() ) ) << " hash value for uint8"; - - int8_buffer = std::vector< int8_t >( 16*16, -1 ); - importer.SetBufferAsInt8( &int8_buffer[0] ); - EXPECT_EQ ( "c744cac6af7621524fc3a2b0a9a135a32b33c81b", srtk::Hash( importer.Execute() ) ) << " hash value for int8"; - - uint16_buffer = std::vector< uint16_t >( 16*16, 2 ); - importer.SetBufferAsUInt16( &uint16_buffer[0] ); - EXPECT_EQ ( "adbc44d359d3b3c032629bab34e3ee62c4563223", srtk::Hash( importer.Execute() ) ) << " hash value for uint16"; - - int16_buffer = std::vector< int16_t >( 16*16, -3 ); - importer.SetBufferAsInt16( &int16_buffer[0] ); - EXPECT_EQ ( "8111171305e02db2276c7366d117598b1f6789ff", srtk::Hash( importer.Execute() ) ) << " hash value for int16"; - - uint32_buffer = std::vector< uint32_t >( 16*16, 8 ); - importer.SetBufferAsUInt32( &uint32_buffer[0] ); - EXPECT_EQ ( "4b710847b34bc5e96520de8a1d7b97563077423c", srtk::Hash( importer.Execute() ) ) << " hash value for uint32"; - - int32_buffer = std::vector< int32_t >( 16*16, -123 ); - importer.SetBufferAsInt32( &int32_buffer[0] ); - EXPECT_EQ ( "d5748f3800b837611dc94c089ac7926f2bbea973" , srtk::Hash( importer.Execute() ) ) << " hash value for int32"; - - if ( srtk::srtkUInt64 != srtk::srtkUnknown ) - { - uint64_buffer = std::vector< uint64_t >( 16*16, 8 ); - importer.SetBufferAsUInt64( &uint64_buffer[0] ); - EXPECT_EQ ( "95c3884597103a98cf6f1def52cab572c41f0eb5", srtk::Hash( importer.Execute() ) ) << " hash value for uint64"; - } - - if ( srtk::srtkInt64 != srtk::srtkUnknown ) - { - - int64_buffer = std::vector< int64_t >( 16*16, -123 ); - importer.SetBufferAsInt64( &int64_buffer[0] ); - EXPECT_EQ ( "d0a23a11b2f39b46cfc09bd71fc4c9661b68a826" , srtk::Hash( importer.Execute() ) ) << " hash value for int64"; - } - - float_buffer = std::vector< float >( 16*16, 1.123 ); - importer.SetBufferAsFloat( &float_buffer[0] ); - EXPECT_EQ ( "8588f5624f56bb55693d54505388dc06b93d2f14", srtk::Hash( importer.Execute() ) ) << " hash value for float"; - - double_buffer = std::vector< double >( 16*16, 321.123 ); - importer.SetBufferAsDouble( &double_buffer[0] ); - EXPECT_EQ ( "00393fe0b94729ff0f777ce848104697ce689c70", srtk::Hash( importer.Execute() ) ) << " hash value for double"; - - - uint8_buffer = std::vector< uint8_t >( 16*16*2, 1 ); - importer.SetBufferAsUInt8( &uint8_buffer[0], 2 ); - EXPECT_EQ ( "3ef8a08ec90e244fe2a8948b701eafcc1d065712", srtk::Hash( importer.Execute() ) ) << " hash value for vector of uint8"; - - int8_buffer = std::vector< int8_t >( 16*16*3, -1 ); - importer.SetBufferAsInt8( &int8_buffer[0], 3 ); - EXPECT_EQ ( "fc1b469729f5a061d4b8b5eb1efba13a7b52d5a7", srtk::Hash( importer.Execute() ) ) << " hash value for vector of int8"; - - uint16_buffer = std::vector< uint16_t >( 16*16*4, 2 ); - importer.SetBufferAsUInt16( &uint16_buffer[0], 4 ); - EXPECT_EQ ( "f449215906661bacee88ef886c38f3049d9a232b", srtk::Hash( importer.Execute() ) ) << " hash value for vector of uint16"; - - int16_buffer = std::vector< int16_t >( 16*16*5, -3 ); - importer.SetBufferAsInt16( &int16_buffer[0], 5 ); - EXPECT_EQ ( "7bce93764d2393b987ed2b17281073ddb520af46", srtk::Hash( importer.Execute() ) ) << " hash value for vector of int16"; - - uint32_buffer = std::vector< uint32_t >( 16*16*6, 8 ); - importer.SetBufferAsUInt32( &uint32_buffer[0], 6 ); - EXPECT_EQ ( "c558884e4bf07ece6a2644307aa3b4eb84be8a11", srtk::Hash( importer.Execute() ) ) << " hash value for vector of uint32"; - - int32_buffer = std::vector< int32_t >( 16*16*7, -123 ); - importer.SetBufferAsInt32( &int32_buffer[0], 7 ); - EXPECT_EQ ( "c65dc5820f3691fc4b6b3b9aaba1f506ca3f697e" , srtk::Hash( importer.Execute() ) ) << " hash value for vector of int32"; - - if ( srtk::srtkVectorUInt64 != srtk::srtkUnknown ) - { - uint64_buffer = std::vector< uint64_t >( 16*16*6, 8 ); - importer.SetBufferAsUInt64( &uint64_buffer[0], 6 ); - EXPECT_EQ ( "cac37cb71f23cd41ed1e2b60d1e325ee8de4ca71", srtk::Hash( importer.Execute() ) ) << " hash value for vector of uint64"; - } - - if ( srtk::srtkVectorInt64 != srtk::srtkUnknown ) - { - int64_buffer = std::vector< int64_t >( 16*16*7, -123 ); - importer.SetBufferAsInt64( &int64_buffer[0], 7 ); - EXPECT_EQ ( "91a61e519faf128747bf2d2bbd860d4f05d79ac6" , srtk::Hash( importer.Execute() ) ) << " hash value for vector of int64"; - } - - float_buffer = std::vector< float >( 16*16*8, 1.123 ); - importer.SetBufferAsFloat( &float_buffer[0], 8 ); - EXPECT_EQ ( "9fb1d83b9c9a5645e7b136761d6924ea7d859284", srtk::Hash( importer.Execute() ) ) << " hash value for vector of float"; - - double_buffer = std::vector< double >( 16*16*9, 321.123 ); - importer.SetBufferAsDouble( &double_buffer[0], 9 ); - EXPECT_EQ ( "80514b97613fc659c9ceb45bb44c8a02fec9c4db", srtk::Hash( importer.Execute() ) ) << " hash value for vector of double"; - - importer.SetSize( std::vector< unsigned int >( 5, 16u ) ); - EXPECT_ANY_THROW( importer.Execute() ); - importer.SetBufferAsDouble( &double_buffer[0], 0 ); - EXPECT_ANY_THROW( importer.Execute() ); - - - -} - -TEST_F(Import,Procedual) { - - srtk::Image img(0,0,srtk::srtkUInt8); - std::vector< unsigned int > size( 2, 16u ); - - direction2D[0] = direction2D[3] = -1.0; - - uint8_buffer = std::vector< uint8_t >( 16*16, 1 ); - img = srtk::ImportAsUInt8( &uint8_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "ac458b067c6b021c7e9358229b636e9d1e4cb154", srtk::Hash( img ) ) << " hash value for uint8"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for uint8"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for uint8"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for uint8"; - - int8_buffer = std::vector< int8_t >( 16*16, -1 ); - img = srtk::ImportAsInt8( &int8_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "c744cac6af7621524fc3a2b0a9a135a32b33c81b", srtk::Hash( img ) ) << " hash value for int8"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for int8"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for int8"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for int8"; - - - uint16_buffer = std::vector< uint16_t >( 16*16, 2 ); - img = srtk::ImportAsUInt16( &uint16_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "adbc44d359d3b3c032629bab34e3ee62c4563223", srtk::Hash( img ) ) << " hash value for uint16"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for uint16"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for uint16"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for uint16"; - - - int16_buffer = std::vector< int16_t >( 16*16, -3 ); - img = srtk::ImportAsInt16( &int16_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "8111171305e02db2276c7366d117598b1f6789ff", srtk::Hash( img ) ) << " hash value for int16"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for int16"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for int16"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for int16"; - - - uint32_buffer = std::vector< uint32_t >( 16*16, 8 ); - img = srtk::ImportAsUInt32( &uint32_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "4b710847b34bc5e96520de8a1d7b97563077423c", srtk::Hash( img ) ) << " hash value for uint32"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for uint32"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for uint32"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for uint32"; - - - int32_buffer = std::vector< int32_t >( 16*16, -123 ); - img = srtk::ImportAsInt32( &int32_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "d5748f3800b837611dc94c089ac7926f2bbea973" , srtk::Hash( img ) ) << " hash value for int32"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for int32"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for int32"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for int32"; - - - float_buffer = std::vector< float >( 16*16, 1.123 ); - img = srtk::ImportAsFloat( &float_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "8588f5624f56bb55693d54505388dc06b93d2f14", srtk::Hash( img ) ) << " hash value for float"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for float"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for float"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for float"; - - - double_buffer = std::vector< double >( 16*16, 321.123 ); - img = srtk::ImportAsDouble( &double_buffer[0], - size, - spacing2, - origin2, - direction2D ); - EXPECT_EQ ( "00393fe0b94729ff0f777ce848104697ce689c70", srtk::Hash( img ) ) << " hash value for double"; - EXPECT_EQ ( img.GetSpacing(), spacing2 ) << " spacing for double"; - EXPECT_EQ ( img.GetOrigin(), origin2 ) << " origin for float"; - EXPECT_EQ ( img.GetDirection(), direction2D ) << " direction for double"; - -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkNumpyArrayConversionTest.py b/utilities/SimpleRTK/Testing/Unit/srtkNumpyArrayConversionTest.py deleted file mode 100644 index cf9a233bd..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkNumpyArrayConversionTest.py +++ /dev/null @@ -1,178 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -from __future__ import print_function -import sys -import unittest - - -import SimpleRTK as srtk -import numpy as np - -sizeX = 4 -sizeY = 5 -sizeZ = 3 - - -class TestNumpySimpleRTKInterface(unittest.TestCase): - """ This tests numpy array <-> SimpleRTK Image conversion. """ - - - def setUp(self): - pass - - - def _helper_check_srtk_to_numpy_type(self, srtkType, numpyType): - image = srtk.Image( (9, 10), srtkType, 1 ) - a = srtk.GetArrayFromImage( image ) - self.assertEqual( numpyType, a.dtype ) - self.assertEqual( (10, 9), a.shape ) - - def test_type_to_numpy(self): - "try all srtk pixel type to convert to numpy" - - self._helper_check_srtk_to_numpy_type(srtk.srtkUInt8, np.uint8) - self._helper_check_srtk_to_numpy_type(srtk.srtkUInt16, np.uint16) - self._helper_check_srtk_to_numpy_type(srtk.srtkUInt32, np.uint32) - if srtk.srtkUInt64 != srtk.srtkUnknown: - self._helper_check_srtk_to_numpy_type(srtk.srtkUInt64, np.uint64) - self._helper_check_srtk_to_numpy_type(srtk.srtkInt8, np.int8) - self._helper_check_srtk_to_numpy_type(srtk.srtkInt16, np.int16) - self._helper_check_srtk_to_numpy_type(srtk.srtkInt32, np.int32) - if srtk.srtkInt64 != srtk.srtkUnknown: - self._helper_check_srtk_to_numpy_type(srtk.srtkInt64, np.int64) - self._helper_check_srtk_to_numpy_type(srtk.srtkFloat32, np.float32) - self._helper_check_srtk_to_numpy_type(srtk.srtkFloat64, np.float64) - #self._helper_check_srtk_to_numpy_type(srtk.srtkComplexFloat32, np.complex64) - #self._helper_check_srtk_to_numpy_type(srtk.srtkComplexFloat64, np.complex128) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorUInt8, np.uint8) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorInt8, np.int8) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorUInt16, np.uint16) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorInt16, np.int16) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorUInt32, np.uint32) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorInt32, np.int32) - if srtk.srtkVectorUInt64 != srtk.srtkUnknown: - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorUInt64, np.uint64) - if srtk.srtkVectorInt64 != srtk.srtkUnknown: - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorInt64, np.int64) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorFloat32, np.float32) - self._helper_check_srtk_to_numpy_type(srtk.srtkVectorFloat64, np.float64) - #self._helper_check_srtk_to_numpy_type(srtk.srtkLabelUInt8, np.uint8) - #self._helper_check_srtk_to_numpy_type(srtk.srtkLabelUInt16, np.uint16) - #self._helper_check_srtk_to_numpy_type(srtk.srtkLabelUInt32, np.uint32) - #self._helper_check_srtk_to_numpy_type(srtk.srtkLabelUInt64, np.uint64) - - def test_to_numpy_and_back(self): - """Test converting an image to numpy and back""" - - img = srtk.GaussianSource( srtk.srtkFloat32, [100,100], sigma=[10]*3, mean = [50,50] ) - - h = srtk.Hash( img ) - - # convert the image to and fro a numpy array - img = srtk.GetImageFromArray( srtk.GetArrayFromImage( img ) ) - - self.assertEqual( h, srtk.Hash( img )) - - def test_vector_image_to_numpy(self): - """Test converting back and forth between numpy and SimpleRTK - images were the SimpleRTK image has multiple componets and - stored as a VectorImage.""" - - - # Check 2D - img = srtk.PhysicalPointSource(srtk.srtkVectorFloat32, [3,4]) - h = srtk.Hash( img ) - - nda = srtk.GetArrayFromImage(img) - - self.assertEqual(nda.shape, (4,3,2)) - self.assertEqual(nda[0,0].tolist(), [0,0]) - self.assertEqual(nda[2,1].tolist(), [1,2]) - self.assertEqual(nda[0,:,0].tolist(), [0,1,2]) - - img2 = srtk.GetImageFromArray( nda, isVector=True) - self.assertEqual( h, srtk.Hash(img2) ) - - # check 3D - img = srtk.PhysicalPointSource(srtk.srtkVectorFloat32, [3,4,5]) - h = srtk.Hash( img ) - - nda = srtk.GetArrayFromImage(img) - - self.assertEqual(nda.shape, (5,4,3,3)) - self.assertEqual(nda[0,0,0].tolist(), [0,0,0]) - self.assertEqual(nda[0,0,:,0].tolist(), [0,1,2]) - self.assertEqual(nda[0,:,1,1].tolist(), [0,1,2,3]) - - - img2 = srtk.GetImageFromArray(nda) - self.assertEqual(img2.GetSize(), img.GetSize()) - self.assertEqual(img2.GetNumberOfComponentsPerPixel(), img.GetNumberOfComponentsPerPixel()) - self.assertEqual(h, srtk.Hash(img2)) - - - def test_legacy(self): - """Test SimpleRTK Image to numpy array.""" - - # self.assertRaises(TypeError, srtk.GetArrayFromImage, 3) - - # 2D image - image = srtk.Image(sizeX, sizeY, srtk.srtkInt32) - for j in range(sizeY): - for i in range(sizeX): - image[i, j] = j*sizeX + i - - print(srtk.GetArrayFromImage(image)) - - self.assertEqual( type (srtk.GetArrayFromImage(image)), np.ndarray ) - - # 3D image - image = srtk.Image(sizeX, sizeY, sizeZ, srtk.srtkFloat32) - for k in range(sizeZ): - for j in range(sizeY): - for i in range(sizeX): - image[i, j, k] = (sizeY*k +j)*sizeX + i - - print(srtk.GetArrayFromImage(image)) - - self.assertEqual( type (srtk.GetArrayFromImage(image)), np.ndarray ) - - def test_legacy_array2srtk(self): - """Test numpy array to SimpleRTK Image.""" - - arr = np.arange(20, dtype=np.float64) - arr.shape = (sizeY, sizeX) - - image = srtk.GetImageFromArray(arr) - self.assertEqual(image.GetSize(), (sizeX, sizeY)) - self.assertEqual(image[0,0], 0.0) - self.assertEqual(image[1,1], 5.0) - self.assertEqual(image[2,2], 10.0) - - arr = np.arange(60, dtype=np.int16) - arr.shape = (sizeZ, sizeY, sizeX) - - image = srtk.GetImageFromArray(arr) - - self.assertEqual(image.GetSize(), (sizeX, sizeY, sizeZ)) - self.assertEqual(image[0,0,0], 0) - self.assertEqual(image[1,1,1], 25) - self.assertEqual(image[2,2,2], 50) - -if __name__ == '__main__': - unittest.main() diff --git a/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.java b/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.java deleted file mode 100644 index 4073bf351..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -import org.rtk.simple.*; - - -class srtkProcessObjectTest { - - public static void main(String argv[]) { - - CastImageFilter filter = new CastImageFilter(); - filter.getProgress(); - - } - -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.py b/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.py deleted file mode 100644 index 2b9948b2b..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkProcessObjectTest.py +++ /dev/null @@ -1,98 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -from __future__ import print_function -import sys -import unittest - - -import SimpleRTK as srtk - - -class ProcessObjectTest(unittest.TestCase): - """Test the SimpleRTK Process Object and related Command classes""" - - def setUp(self): - pass - - def test_ProcessObject_base(self): - " Check that ProcessObject is super class of filters" - - # check some manually written filters - self.assertTrue(issubclass(srtk.CastImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.HashImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.StatisticsImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.LabelStatisticsImageFilter,srtk.ProcessObject)) - - # Check some of the different types of generated - self.assertTrue(issubclass(srtk.AddImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.FastMarchingImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.BinaryDilateImageFilter,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.GaussianImageSource,srtk.ProcessObject)) - self.assertTrue(issubclass(srtk.JoinSeriesImageFilter,srtk.ProcessObject)) - - - def test_ProcessObject_lambda_Command(self): - """Check that the lambda Command on event works""" - - f = srtk.CastImageFilter(); - - def s(var,value): - var[0] = value - - # int/floats are passed by value, use lists to be passed by reference - start = [0] - stop = [0] - p = [0.0] - f.AddCommand(srtk.srtkStartEvent, lambda start=start: s(start,start[0]+1) ) - f.AddCommand(srtk.srtkStartEvent, lambda stop=stop: s(stop, stop[0]+1) ) - f.AddCommand(srtk.srtkProgressEvent, lambda p=p: s(p, f.GetProgress()) ); - f.Execute(srtk.Image(10,10,srtk.srtkFloat32)) - - print( "start: {0} stop: {1} p: {2}".format(start,stop,p)) - self.assertEqual(start,[1]) - self.assertEqual(stop,[1]) - self.assertEqual(p,[1.0]) - - - def test_ProcessObject_PyCommand(self): - """Testing PyCommand Class""" - - f = srtk.CastImageFilter(); - - p = [0.0] - def prog(): - p[0] = f.GetProgress(); - - cmd = srtk.PyCommand() - cmd.SetCallbackPyCallable(prog) - - - f.AddCommand(srtk.srtkProgressEvent, cmd ); - f.Execute(srtk.Image(10,10,srtk.srtkFloat32)) - self.assertEqual(p,[1.0]) - - p = [0.0] - del cmd - - - f.Execute(srtk.Image(10,10,srtk.srtkFloat32)) - self.assertEqual(p,[0.0]) - - -if __name__ == '__main__': - unittest.main() diff --git a/utilities/SimpleRTK/Testing/Unit/srtkSystemInformationTest.cxx b/utilities/SimpleRTK/Testing/Unit/srtkSystemInformationTest.cxx deleted file mode 100644 index 6ffbea3ea..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkSystemInformationTest.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ - -#include "itksys/SystemTools.hxx" -#include "itksys/SystemInformation.hxx" - -#include -#include -#include -#include - - - -namespace -{ - -void SystemInformationPrintFile(const std::string &name, std::ostream& os) -{ - const char* div = "======================================================================="; - os << "System Information File \"" << name << "\""; - - if(! itksys::SystemTools::FileExists( name.c_str(), true) ) - { - os << " does not exist.\n"; - return; - } - - std::ifstream fin(name.c_str()); - if(fin) - { - os << ":\n[" << div << "[\n"; - os << fin.rdbuf(); - os << "]" << div << "]\n"; - os.flush(); - } - else - { - os << " but cannot be opened for read.\n"; - } -} - - -void SystemInformationPrint(std::ostream& os) -{ - itksys::SystemInformation mySys; - mySys.RunCPUCheck(); - mySys.RunOSCheck(); - mySys.RunMemoryCheck(); - - os << "---------- System Information ----------" << std::endl; - - os << "VendorString: " - << mySys.GetVendorString() << std::endl; - os << "VendorID: " - << mySys.GetVendorID() << std::endl; - os << "TypeID: " - << mySys.GetTypeID() << std::endl; - os << "FamilyID: " - << mySys.GetFamilyID() << std::endl; - os << "ModelID: " - << mySys.GetModelID() << std::endl; - os << "SteppingCode: " - << mySys.GetSteppingCode() << std::endl; - os << "ExtendedProcessorName: " - << mySys.GetExtendedProcessorName() << std::endl; - os << "DoesCPUSupportCPUID: " - << mySys.DoesCPUSupportCPUID() << std::endl;; - os << "ProcessorSerialNumber: " - << mySys.GetProcessorSerialNumber() << std::endl; - os << "ProcessorCacheSize: " - << mySys.GetProcessorCacheSize() << std::endl; - os << "LogicalProcessorsPerPhysical: " - << mySys.GetLogicalProcessorsPerPhysical() << std::endl; - os << "ProcessorClockFrequency: " - << mySys.GetProcessorClockFrequency() << std::endl; - os << "ProcessorAPICID: " - << mySys.GetProcessorAPICID() << std::endl; - - os << "OSName: " - << mySys.GetOSName() << std::endl; - os << "Hostname: " - << mySys.GetHostname() << std::endl; - os << "OSRelease: " - << mySys.GetOSRelease() << std::endl; - os << "OSVersion: " - << mySys.GetOSVersion() << std::endl; - os << "OSPlatform: " - << mySys.GetOSPlatform() << std::endl; - - os << "Is64Bits: " - << mySys.Is64Bits() << std::endl; - - os << "NumberOfLogicalCPU: " - << mySys.GetNumberOfLogicalCPU() << std::endl; - os << "NumberOfPhysicalCPU: " - << mySys.GetNumberOfPhysicalCPU() << std::endl; - - // Retrieve memory information in megabyte. - os << "TotalVirtualMemory: " - << mySys.GetTotalVirtualMemory() << std::endl; - os << "AvailableVirtualMemory: " - << mySys.GetAvailableVirtualMemory() << std::endl; - os << "TotalPhysicalMemory: " - << mySys.GetTotalPhysicalMemory() << std::endl; - os << "AvailablePhysicalMemory: " - << mySys.GetAvailablePhysicalMemory() << std::endl; -} - - - -} - -int main(int argc, char* argv[]) -{ - if(argc != 2) - { - std::cerr << "Usage: itkSystemInformationTest \n"; - return EXIT_FAILURE; - } - std::string build_dir = argv[1]; - build_dir += "/"; - - const char* files[] = - { - "CMakeCache.txt", - "CMakeCacheInit.txt", - "srtkConfigure.h", - "CMakeFiles/CMakeOutput.log", - "CMakeFiles/CMakeError.log", - "SimpleRTKConfig.cmake", - "SimpleRTKConfigVersion.cmake", - "SimpleRTKTargets.cmake", - 0 - }; - - // Preserve valuable output regardless of the limits set in - // CMake/CTestCustom.cmake - std::cout << "CTEST_FULL_OUTPUT" << std::endl; - - for(const char** f = files; *f; ++f) - { - std::string fname = build_dir + *f; - SystemInformationPrintFile(fname.c_str(), std::cout); - } - - SystemInformationPrint( std::cout ); - - return EXIT_SUCCESS; -} diff --git a/utilities/SimpleRTK/Testing/Unit/srtkTypeListsTests.cxx b/utilities/SimpleRTK/Testing/Unit/srtkTypeListsTests.cxx deleted file mode 100644 index 9e931f2eb..000000000 --- a/utilities/SimpleRTK/Testing/Unit/srtkTypeListsTests.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium & RTK Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "SimpleRTKTestHarness.h" -#include - -class TypeListTest - : public ::testing::Test -{ -public: - TypeListTest() {}; - struct CountPredicate - { - CountPredicate( void ) : count(0) {} - - template - void operator()( void ) - { - ++count; - } - - template - void operator()( void ) - { - ++count; - } - - template - void operator()( void ) const - { - ++count; - } - - template - void operator()( void ) const - { - ++count; - std::cout << typeid(TType1).name() << " " << typeid( TType2 ).name() << std::endl; - } - - mutable int count; - }; - - CountPredicate pred; - const CountPredicate constPred; -}; - - -TEST_F(TypeListTest, Visit) { - - typedef typelist::MakeTypeList::Type MyTypeList; - - typelist::Visit ListVisitor; - ListVisitor( pred ); - ListVisitor( constPred ); - - EXPECT_EQ( pred.count, 3 ); - EXPECT_EQ( constPred.count, 3 ); - -} - -TEST_F(TypeListTest, DualVisit) { - - typedef typelist::MakeTypeList::Type MyTypeList; - - typelist::DualVisit ListVisitor; - ListVisitor( pred ); - ListVisitor( constPred ); - - EXPECT_EQ( pred.count, 9 ); - EXPECT_EQ( constPred.count, 9 ); - -} diff --git a/utilities/SimpleRTK/UseSimpleRTK.cmake.in b/utilities/SimpleRTK/UseSimpleRTK.cmake.in deleted file mode 100644 index 2a97ae8cd..000000000 --- a/utilities/SimpleRTK/UseSimpleRTK.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file sets up include directories, link directories, and -# compiler settings for a project to use SimpleRTK. It should not be -# included directly, but rather through the SimpleRTK_USE_FILE setting -# obtained from SimpleRTKConfig.cmake. -# - -# Add compiler flags needed to use SimpleRTK. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SimpleRTK_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SimpleRTK_REQUIRED_CXX_FLAGS}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SimpleRTK_REQUIRED_LINK_FLAGS}") - -# Add include directories needed to use SimpleRTK. -include_directories(${SimpleRTK_INCLUDE_DIRS}) - -# Add link directories needed to use SimpleRTK. -link_directories(${SimpleRTK_LIBRARY_DIRS}) diff --git a/utilities/SimpleRTK/Utilities/C99/CMakeLists.txt b/utilities/SimpleRTK/Utilities/C99/CMakeLists.txt deleted file mode 100644 index 3ad953591..000000000 --- a/utilities/SimpleRTK/Utilities/C99/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES "stdint.h" "inttypes.h" - DESTINATION ${SimpleRTK_INSTALL_INCLUDE_DIR} - COMPONENT Development) diff --git a/utilities/SimpleRTK/Utilities/C99/inttypes.h b/utilities/SimpleRTK/Utilities/C99/inttypes.h deleted file mode 100644 index 4b3828a21..000000000 --- a/utilities/SimpleRTK/Utilities/C99/inttypes.h +++ /dev/null @@ -1,305 +0,0 @@ -// ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_INTTYPES_H_ // [ -#define _MSC_INTTYPES_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include "stdint.h" - -// 7.8 Format conversion of integer types - -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -// 7.8.1 Macros for format specifiers - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 - -// The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" - -// The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" - -// The fscanf macros for signed integers are: -#define SCNd8 "d" -#define SCNi8 "i" -#define SCNdLEAST8 "d" -#define SCNiLEAST8 "i" -#define SCNdFAST8 "d" -#define SCNiFAST8 "i" - -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" - -#ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] - -// The fscanf macros for unsigned integers are: -#define SCNo8 "o" -#define SCNu8 "u" -#define SCNx8 "x" -#define SCNX8 "X" -#define SCNoLEAST8 "o" -#define SCNuLEAST8 "u" -#define SCNxLEAST8 "x" -#define SCNXLEAST8 "X" -#define SCNoFAST8 "o" -#define SCNuFAST8 "u" -#define SCNxFAST8 "x" -#define SCNXFAST8 "X" - -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" - -#ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] - -#endif // __STDC_FORMAT_MACROS ] - -// 7.8.2 Functions for greatest-width integer types - -// 7.8.2.1 The imaxabs function -#define imaxabs _abs64 - -// 7.8.2.2 The imaxdiv function - -// This is modified version of div() function from Microsoft's div.c found -// in %MSVC.NET%\crt\src\div.c -#ifdef STATIC_IMAXDIV // [ -static -#else // STATIC_IMAXDIV ][ -_inline -#endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - - result.quot = numer / denom; - result.rem = numer % denom; - - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } - - return result; -} - -// 7.8.2.3 The strtoimax and strtoumax functions -#define strtoimax _strtoi64 -#define strtoumax _strtoui64 - -// 7.8.2.4 The wcstoimax and wcstoumax functions -#define wcstoimax _wcstoi64 -#define wcstoumax _wcstoui64 - - -#endif // _MSC_INTTYPES_H_ ] diff --git a/utilities/SimpleRTK/Utilities/C99/stdint.h b/utilities/SimpleRTK/Utilities/C99/stdint.h deleted file mode 100644 index d02608a59..000000000 --- a/utilities/SimpleRTK/Utilities/C99/stdint.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/utilities/SimpleRTK/Utilities/CMakeLists.txt b/utilities/SimpleRTK/Utilities/CMakeLists.txt deleted file mode 100644 index 8b1378917..000000000 --- a/utilities/SimpleRTK/Utilities/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/utilities/SimpleRTK/Utilities/CSVtoTable.py b/utilities/SimpleRTK/Utilities/CSVtoTable.py deleted file mode 100644 index 16ac839f2..000000000 --- a/utilities/SimpleRTK/Utilities/CSVtoTable.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python -#========================================================================= -# -# Copyright Insight Software Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#========================================================================= -from __future__ import print_function -import sys, csv, getopt, re -import os, os.path - -"""Create a HTML table from a CSV file that has been generated by CompareITKandSITKFilters.py - -By default it reads in filters.csv (the default file produced by CompareITKandSITKFilters.py) -and writes out filters.html. -""" - -class bcolors: - """A class to print colored text.""" - HEADER='\033[95m'; OKBLUE='\033[94m'; OKGREEN='\033[92m'; - WARNING='\033[93m'; FAIL='\033[91m'; ENDC='\033[0m'; - -def usage(): - """How to use this script""" - print("") - print("CSVtoTable.py [options] [input_file [output_file]]") - print("") - print(" -h This help message") - print(" -d Make a Doxygen file") - print("") - -# Variables -# -inname = "filters.csv" -outname = "filters.html" -doxyFlag = False - -fieldnames = ( 'Filter', 'ITK', 'SITK', 'Remark', 'ToDo' ) # fields in the CSV file - - -# -# Handle command line options -# - -try: - opts, args = getopt.getopt(sys.argv[1:], "hd", - [ "help", "doxygen" ] ) -except getopt.GetoptError as err: - print(str(err)) - usage() - sys.exit(2) - -for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-d", "--doxygen"): - doxyFlag = True - else: - assert False, "unhandled option" - -# get the input and output file names -if len(args): - inname = args[0] - if len(args)>1: - outname = args[1] - - -print( inname, outname ) - -# if outname includes a path that doesn't exist, create that path -if not os.path.isdir( os.path.dirname( outname ) ): - if len(os.path.dirname(outname)): - os.makedirs( os.path.dirname( outname ) ) - -outfile = open(outname, "w") -color = "FFFFFF" - -try: - if doxyFlag: - outfile.write( "/** \page Filter_Coverage Filter Coverage\n" ) - outfile.write( "\n" ) - - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - - with open(inname,"rU") as fp: - reader = csv.DictReader(fp) - for row in reader: - - filt = row[fieldnames[0]] - remark = "" - todo = False - - iflag = sflag = False - if len(row[fieldnames[1]]): - iflag = row[fieldnames[1]].lower() == "true" - if len(row[fieldnames[2]]): - sflag = row[fieldnames[2]].lower() == "true" - - # Get the remark field from the file. - if row[fieldnames[3]] != None: - if len(row[fieldnames[3]]): - remark = row[fieldnames[3]] - - # Get the ToDo flag - if len(row[fieldnames[4]]): - todo = row[fieldnames[4]].lower() == "true" - - if sflag: - if iflag: - color = "20FF20" # Green - else: - color = "C0FFC0" # Light Green - else: - if todo: - color = "FFFFFF" # White - else: - color = "FF7070" # Red - - - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - outfile.write( "\n" ) - if not sflag: - outfile.write( "\n" ) - else: - outfile.write( "\n" ) - outfile.write( "\n" ) - -except: - print("Failed to read input file ", inname) - print(sys.exc_info()[0]) - sys.exit(1) - -outfile.write( "
Filter nameRTKSimpleRTKRemarksToDo
"+filt+""+str(iflag)+""+str(sflag)+""+remark+""+str(todo)+"
\n" ) - -# Legend table -outfile.write( "

Legend

\n" ) - -outfile.write( "\n" ) - -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) - -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) - -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) - -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) - -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "\n" ) -outfile.write( "
ColorMeaning
\n" ) -outfile.write( "Supported by SimpleRTK and RTK
\n" ) -outfile.write( "SimpleRTK only filter
\n" ) -outfile.write( "ITK filter that we plan to support in the future
\n" ) -outfile.write( "ITK filter that we will not support
\n" ) - -if doxyFlag: - outfile.write( "*/\n" ) - -outfile.close() diff --git a/utilities/SimpleRTK/Utilities/CompareRTKandSRTKFilters.py b/utilities/SimpleRTK/Utilities/CompareRTKandSRTKFilters.py deleted file mode 100644 index 8b3b854da..000000000 --- a/utilities/SimpleRTK/Utilities/CompareRTKandSRTKFilters.py +++ /dev/null @@ -1,308 +0,0 @@ -#!/usr/bin/env python -#========================================================================= -# -# Copyright Insight Software Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#========================================================================= - -import re, getopt, sys, csv -import SimpleITK -import itk - - -class bcolors: - """A class to print colored text.""" - HEADER='\033[95m'; OKBLUE='\033[94m'; OKGREEN='\033[92m'; - WARNING='\033[93m'; FAIL='\033[91m'; ENDC='\033[0m'; - - -class FilterSet: - """The main data structure for holding the filter data""" - filters = list() # a list of all the filters - itk = set() # a set of all the ITK filters - sitk = set() # a set of all the SimpleITK filters - todo = set() # a set of the ITK filters not yet in SimpleITK but to be done - remarks = dict() # a dictionary of remarks, indexed by filter name - - -# Global variables -fs = FilterSet() # the filter data structure -remarkFile = "" -onlyRemarksFlag = False -sortByType = False -quietMode = False -writelessMode = False - -fieldnames = ( 'Filter', 'ITK', 'SITK', 'Remark', 'ToDo' ) # fields in the CSV file - - -# -# -class unix_dialect(csv.Dialect): - """Describe the usual properties of unix-generated CSV files.""" - delimiter = ',' - quotechar = '"' - doublequote = True - skipinitialspace = False - lineterminator = '\n' - quoting = csv.QUOTE_MINIMAL - -def writeCSV(name): - """Write the results out to a common-spaced-value file (readable by any spreadsheet program)""" - csv.register_dialect("unix_dialect", unix_dialect) - try: - with open(name, "w") as fp: - writer = csv.DictWriter(fp, fieldnames=fieldnames, dialect="unix_dialect") - headers = dict( (n,n) for n in fieldnames) - writer.writerow(headers) - for filt in fs.filters: - if filt in fs.remarks: - rem = fs.remarks[filt] - else: - rem = "" - if len(rem) or not onlyRemarksFlag: - writer.writerow( { fieldnames[0]:filt, - fieldnames[1]:filt in fs.itk, - fieldnames[2]:filt in fs.sitk, - fieldnames[3]:rem, - fieldnames[4]:filt in fs.todo, - } ) - except: - print bcolors.FAIL, "Error:", bcolors.ENDC, "Couldn't write output file", name, "\n" - sys.exit(-1) - -# -# -def readCSV(name): - """Read the filters from a CSV file. - - Note that the only the Remark and ToDo fields are taken from the CSV file. - The filter names and which toolkits have each filter comes from is not read - from the file. Rather that information is loaded from the ITK and SimpleITK - Python symbol tables. - """ - try: - with open(name, "rU") as fp: - reader = csv.DictReader(fp) - for row in reader: - filt = row[fieldnames[0]] - - # Check the file to see if the ITK/SITK flags match what we've pulled from Python. - iflag = sflag = False - if len(row[fieldnames[1]]): - iflag = row[fieldnames[1]].lower() == "true" - if len(row[fieldnames[2]]): - sflag = row[fieldnames[2]].lower() == "true" - - initk = filt in fs.itk - insitk = filt in fs.sitk - - if not initk and not insitk: - print bcolors.FAIL, "Warning: ", bcolors.ENDC, "Filter ", filt, \ - "not found in either ITK or SimpleITK" - - if (iflag != initk) or (sflag != insitk): - print bcolors.FAIL, "Warning: ", bcolors.ENDC, \ - "mismatch between file and symbol table for filter ", filt - print " ", row - - # Get the remark field from the file. - if row[fieldnames[3]] != None: - if len(row[fieldnames[3]]): - fs.remarks[filt] = row[fieldnames[3]] - - # Get the ToDo flag - if len(row[fieldnames[4]]): - if row[fieldnames[4]].lower() == "true": - fs.todo.add(filt) - - except: - print bcolors.FAIL, "Warning:", bcolors.ENDC, "Couldn't read input file", name, \ - ". Proceeding without it.\n" - else: - if not quietMode: - print "Read file", remarkFile, "\n" - - -# -# -def filterKey(filter_name): - """Function that produces a key for sorting filters by toolkit. - - If a filter is in ITK, an 'I' gets prepended to the name, if not an 'i'. - Similarly if the filter is in SimpleITK it gets a 'S', if not an 's'. - The SimpleITK letter comes after the ITK. So if the filter # is in both toolkits, - it gets "IS"; only in ITK gets "Is"; only in SimpleITK gets "iS". - """ - itag = 'I' if filter_name in fs.itk else 'i' - stag = 'S' if filter_name in fs.sitk else 's' - return itag + stag + filter_name - - -# -# -def usage(): - """command line usage message""" - print "" - print "CompareITKandSITKFilters.py [options] [output_file.csv]" - print "" - print " -h This help message." - print " -t Sort printed filters by toolkit type." - print " -r string Add a remark entry in the format \"filter_name:remark string\"." - print " -o Only output filters with remarks." - print " -q Quiet mode, don't print filter list." - print " -w Writeless mode, don't write the output file." - print "" - print "This script compares what image filters ITK (via WrapITK) and SimpleITK implement." - print "It works by comparing the symbol tables of their respective python modules." - print "If no output file name is given, by default, the script writes results to filters.csv." - print "" - - - -# -# Handle command line options -# - -try: - opts, args = getopt.getopt(sys.argv[1:], "htoqwr:", - [ "help", "type", "only", "quiet", "writeless", "remark" ] ) -except getopt.GetoptError, err: - print str(err) - usage() - sys.exit(2) - -for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-t", "--type"): - sortByType = True - elif o in ("-o", "--only"): - onlyRemarksFlag = True - elif o in ("-q", "--quiet"): - quietMode = True - elif o in ("-w", "--writeless"): - writelessMode = True - elif o in ("-r", "--remark"): - words = a.partition(':') - remarks[words[0]] = words[2] - print words[0], remarks[words[0]] - else: - assert False, "unhandled option" - -# take the last word left from the args list as the output file name -if len(args): - remarkFile = args[len(args)-1] - - - -# -# Get all the ITK and SimpleITK classes from Python symbol tables. -# - -sclasses = dir(SimpleITK) -iclasses = dir(itk) - -# Find all the SimpleITK class names that end with "ImageFilter". -# SimpleITK has a base class that is just "ImageFilter" that we want to omit. -for s in sclasses: - if re.search(r'ImageFilter$', s): - if s != "ImageFilter": - fs.sitk.add(s) - -if not quietMode: - print "\nSimpleITK has", bcolors.OKBLUE, len(fs.sitk), bcolors.ENDC, "filters." - - -# Find all the ITK class names that end with "ImageFilter" or "ImageSource" -# ITK has a base class that is just "ImageSource" that we want to omit. -for i in iclasses: - if re.search(r'ImageFilter$', i) or re.search(r'ImageSource$', i): - if i != "ImageSource": - fs.itk.add(i) - -if not quietMode: - print "ITK has", bcolors.OKBLUE, len(fs.itk), bcolors.ENDC, "filters.\n" - -fs.filters = list(fs.itk.union(fs.sitk)) - - -# -# Sort the filters either by name or toolkit and name -# - -if sortByType: - fs.filters = sorted(fs.filters, key=filterKey) -else: - fs.filters.sort() - - - -# -# Read the remarks from file - -if remarkFile != "": - readCSV(remarkFile) - - - -# -# Print all the filters -# - -if not quietMode: - bothcount = icount = scount = 0 - word = "" - - for filt in fs.filters: - inI = filt in fs.itk - inS = filt in fs.sitk - if inI and inS: - color = bcolors.OKBLUE - word = "Both" - bothcount+=1 - elif inI: - color = bcolors.OKGREEN - word = "ITK " - icount+=1 - else: - color = bcolors.FAIL - word = "SITK" - scount+=1 - - rem = "" - if filt in fs.remarks: - rem = fs.remarks[filt] - print "%50s %s %s %s %s" % (filt, color, word, bcolors.ENDC, rem) - - print "" - print "%3d filters in both toolkits." % bothcount - print "%3d filters in ITK only." % icount - print "%3d filters in SimpleITK only." % scount - print "" - - -# -# Write out the new CSV file -# - -if not writelessMode: - if remarkFile == "": - remarkFile = "filters.csv" - writeCSV(remarkFile) - if not quietMode: - print "Wrote file", remarkFile - print "" diff --git a/utilities/SimpleRTK/Utilities/Doxygen/Doxygen.cmake b/utilities/SimpleRTK/Utilities/Doxygen/Doxygen.cmake deleted file mode 100644 index 601fbb07d..000000000 --- a/utilities/SimpleRTK/Utilities/Doxygen/Doxygen.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# -# Build the documentation -# - -option( BUILD_DOXYGEN "Build SimpleRTK Doxygen" OFF ) - -if (BUILD_DOXYGEN) - - find_package( Doxygen ) - - # - # Add option to use ITK tags, will download during configuration - # time if needed. - # - - option(USE_ITK_DOXYGEN_TAGS "Download ITK's Doxygen tags" ON) - - if (USE_ITK_DOXYGEN_TAGS) - add_custom_command( OUTPUT "${PROJECT_BINARY_DIR}/Documentation/Doxygen/InsightDoxygen.tag" - COMMAND ${CMAKE_COMMAND} -D "PROJECT_SOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}" - -D "OUTPUT_PATH:PATH=${PROJECT_BINARY_DIR}/Documentation/Doxygen" - -P "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/ITKDoxygenTags.cmake" - DEPENDS "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/ITKDoxygenTags.cmake" - ) - set(DOXYGEN_TAGFILES_PARAMETER "${PROJECT_BINARY_DIR}/Documentation/Doxygen/InsightDoxygen.tag=https://www.itk.org/Doxygen/html/") - endif() - - # - # Configure the script and the doxyfile, then add target - # - configure_file(${PROJECT_SOURCE_DIR}/Utilities/Doxygen/doxygen.config.in - ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config) - - add_custom_command( OUTPUT "${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" - COMMAND ${CMAKE_COMMAND} -D "PROJECT_SOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}" - -D "OUTPUT_FILE:PATH=${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" - -P "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/Examples" - DEPENDS "${PROJECT_SOURCE_DIR}/Examples" "${PROJECT_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" - ) - - add_custom_command( OUTPUT "${PROJECT_BINARY_DIR}/Documentation/Doxygen/FilterCoverage.dox" - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Utilities/CSVtoTable.py -d ${PROJECT_SOURCE_DIR}/Utilities/filters.csv ${PROJECT_BINARY_DIR}/Documentation/Doxygen/FilterCoverage.dox - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/Utilities" - DEPENDS "${PROJECT_SOURCE_DIR}/Utilities/filters.csv" "${PROJECT_SOURCE_DIR}/Utilities/CSVtoTable.py" - ) - - if (USE_ITK_DOXYGEN_TAGS) - set(TAGS_DEPENDS DEPENDS ${PROJECT_BINARY_DIR}/Documentation/Doxygen/InsightDoxygen.tag) - endif () - - add_custom_target(Documentation ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config - MAIN_DEPENDENCY ${PROJECT_BINARY_DIR}/Utilities/Doxygen/doxygen.config - DEPENDS "${PROJECT_BINARY_DIR}/Documentation/Doxygen/Examples.dox" - DEPENDS "${PROJECT_BINARY_DIR}/Documentation/Doxygen/FilterCoverage.dox" - ${TAGS_DEPENDS} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/Utilities/Doxygen - ) - - - message( STATUS - "To generate Doxygen's documentation, you need to build the Documentation target" - ) - -endif (BUILD_DOXYGEN) diff --git a/utilities/SimpleRTK/Utilities/Doxygen/GenerateExamplesDox.cmake b/utilities/SimpleRTK/Utilities/Doxygen/GenerateExamplesDox.cmake deleted file mode 100644 index 0788f1c97..000000000 --- a/utilities/SimpleRTK/Utilities/Doxygen/GenerateExamplesDox.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# -# Usage: cmake -D "PROJECT_SOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}" -# -D "OUTPUT_FILE:PATH=${PROJECT_BINARY_DIR}/Examples.dox" -# -P GenerateExamplesDox.cmake - -# This cmake script gets a lists of examples for the project and -# generates a file suitable for doxygen. The file is a list of -# "\examples filename", where doxygen will search for fileanme in it's -# example path. Doxygen should then generate an examples page with the -# referenced files. - -# glob the examples for each language -file( GLOB_RECURSE EXAMPLES_LIST - RELATIVE "${PROJECT_SOURCE_DIR}/Examples" - "*.cxx" - "*.py" - "*.java" - "*.tcl" - "*.rb" - "*.R" - "*.cs" -) - -# remove the file before we begin appending -file( REMOVE ${OUTPUT_FILE} ) - -# begin comment -file( APPEND ${OUTPUT_FILE} "namespace sitk = itk::simple;/**\n") - -FOREACH( f IN LISTS EXAMPLES_LIST ) - file( APPEND ${OUTPUT_FILE} "\\example ${f}\n" ) -ENDFOREACH( ) - -# end comment -file( APPEND ${OUTPUT_FILE} "*/\n" ) diff --git a/utilities/SimpleRTK/Utilities/Doxygen/ITKDoxygenTags.cmake b/utilities/SimpleRTK/Utilities/Doxygen/ITKDoxygenTags.cmake deleted file mode 100644 index 3cdb7a165..000000000 --- a/utilities/SimpleRTK/Utilities/Doxygen/ITKDoxygenTags.cmake +++ /dev/null @@ -1,39 +0,0 @@ - -# Information on how to retrieve the ITK documentation tag file -set(ITK_DOXYGEN_TAG_LOCATION "http://public.kitware.com/pub/itk/NightlyDoxygen/InsightDoxygenDocTag.gz") -set(ITK_DOXYGEN_COMPRESSED_TAG_FILE ${OUTPUT_PATH}/InsightDoxygen.tag.gz) -set(ITK_DOXYGEN_TAG_FILE ${OUTPUT_PATH}/InsightDoxygen.tag) - - -# Get the compressed ITK documentation tag file -if(NOT EXISTS ${ITK_DOXYGEN_COMPRESSED_TAG_FILE}) - message("Download ITK tag file") - file( DOWNLOAD - ${ITK_DOXYGEN_TAG_LOCATION} - ${ITK_DOXYGEN_COMPRESSED_TAG_FILE} - TIMEOUT 60 - STATUS statusITKDoxygenTagFile - SHOW_PROGRESS ) - list(GET statusITKDoxygenTagFile 0 statusVal) - list(GET statusITKDoxygenTagFile 1 statusMessage) - if(statusVal) - message(WARNING "Warning: failed to download ITK tag file.") - message("Message: " ${statusMessage} ) - file(REMOVE ${ITK_DOXYGEN_COMPRESSED_TAG_FILE}) - endif() -endif(NOT EXISTS ${ITK_DOXYGEN_COMPRESSED_TAG_FILE}) - -# Uncompress the ITK tag file -if(EXISTS ${ITK_DOXYGEN_COMPRESSED_TAG_FILE}) - find_program(GZIP_TOOL NAMES gzip) - if(GZIP_TOOL) - message("Decompressing ITK tag file") - execute_process(COMMAND ${GZIP_TOOL} -df ${ITK_DOXYGEN_COMPRESSED_TAG_FILE} RESULT_VARIABLE GZIP_OUT) - if (${GZIP_OUT} ) - MESSAGE(WARNING "gzip result message: " ${GZIP_OUT}) - endif() - set(DOXYGEN_TAGFILES_PARAMETER "${ITK_DOXYGEN_TAG_FILE}=https://www.itk.org/Doxygen/html/") - endif() -else() - set(DOXYGEN_TAGFILES_PARAMETER "") -endif() diff --git a/utilities/SimpleRTK/Utilities/Doxygen/doxygen.config.in b/utilities/SimpleRTK/Utilities/Doxygen/doxygen.config.in deleted file mode 100644 index 89547ffbe..000000000 --- a/utilities/SimpleRTK/Utilities/Doxygen/doxygen.config.in +++ /dev/null @@ -1,2379 +0,0 @@ -# Doxyfile 1.8.9.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = SimpleITK - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = @SimpleITK_VERSION@ - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/Documentation - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = NO - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = "@PROJECT_BINARY_DIR@" - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 2 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = YES - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = YES - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 2 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = YES - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = "@PROJECT_SOURCE_DIR@/Code" \ - "@PROJECT_SOURCE_DIR@/Documentation/Doxygen" \ - "@PROJECT_BINARY_DIR@/Documentation/Doxygen" \ - "@PROJECT_BINARY_DIR@/Code" - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = *.h \ - *.dox - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = "*.json" \ - "*/Ancillary/*" - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = "@PROJECT_SOURCE_DIR@/Examples/" - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = "*.cxx" \ - "*.R" \ - "*.py" \ - "*.java" \ - "*.lua" \ - "*.rb" \ - "*.cs" \ - "*.tcl" - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = "@PROJECT_SOURCE_DIR@/Documentation/Images" - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = YES - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 1 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /