Skip to content

Commit

Permalink
Merge pull request RTKConsortium#341 from SimonRit/NewAzureImages
Browse files Browse the repository at this point in the history
Upgrade Azure compilation
  • Loading branch information
SimonRit committed May 11, 2020
2 parents 6c5d5c2 + 78d7b39 commit 8099212
Show file tree
Hide file tree
Showing 20 changed files with 130 additions and 118 deletions.
8 changes: 1 addition & 7 deletions include/rtkSoftThresholdTVImageFilter.h
Expand Up @@ -41,7 +41,7 @@ namespace rtk
*
* \ingroup RTK
*/
template <typename TInputImage, typename TRealType = float, typename TOutputImage = TInputImage>
template <typename TInputImage, typename TOutputImage = TInputImage>
class ITK_EXPORT SoftThresholdTVImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
{
public:
Expand Down Expand Up @@ -76,18 +76,12 @@ class ITK_EXPORT SoftThresholdTVImageFilter : public itk::ImageToImageFilter<TIn
/** Length of the vector pixel type of the input image. */
itkStaticConstMacro(VectorDimension, unsigned int, InputPixelType::Dimension);

/** Define the data type and the vector of data type used in calculations. */
using RealType = TRealType;
using RealVectorType = itk::Vector<TRealType, InputPixelType::Dimension>;
using RealVectorImageType = itk::Image<RealVectorType, TInputImage::ImageDimension>;

/** Superclass type alias. */
using OutputImageRegionType = typename Superclass::OutputImageRegionType;

#ifdef ITK_USE_CONCEPT_CHECKING
/** Begin concept checking */
itkConceptMacro(InputHasNumericTraitsCheck, (itk::Concept::HasNumericTraits<typename InputPixelType::ValueType>));
itkConceptMacro(RealTypeHasNumericTraitsCheck, (itk::Concept::HasNumericTraits<RealType>));
/** End concept checking */
#endif

Expand Down
16 changes: 9 additions & 7 deletions include/rtkSoftThresholdTVImageFilter.hxx
Expand Up @@ -26,20 +26,21 @@
#include <itkImageRegionIterator.h>
#include <itkImageRegionConstIterator.h>
#include <itkProgressReporter.h>
#include <itkPixelTraits.h>

namespace rtk
{

template <typename TInputImage, typename TRealType, typename TOutputImage>
SoftThresholdTVImageFilter<TInputImage, TRealType, TOutputImage>::SoftThresholdTVImageFilter()
template <typename TInputImage, typename TOutputImage>
SoftThresholdTVImageFilter<TInputImage, TOutputImage>::SoftThresholdTVImageFilter()
{
m_RequestedNumberOfThreads = this->GetNumberOfWorkUnits();
m_Threshold = 0;
}

template <typename TInputImage, typename TRealType, typename TOutputImage>
template <typename TInputImage, typename TOutputImage>
void
SoftThresholdTVImageFilter<TInputImage, TRealType, TOutputImage>::DynamicThreadedGenerateData(
SoftThresholdTVImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
itk::ImageRegionConstIterator<TInputImage> InputIt;
Expand All @@ -50,14 +51,15 @@ SoftThresholdTVImageFilter<TInputImage, TRealType, TOutputImage>::DynamicThreade

while (!InputIt.IsAtEnd())
{
float TV = 0;
using ValueType = typename itk::PixelTraits<typename OutputImageType::PixelType>::ValueType;
ValueType TV = 0;
for (unsigned int i = 0; i < ImageDimension; ++i)
{
TV += InputIt.Get()[i] * InputIt.Get()[i];
}
TV = sqrt(TV); // TV is non-negative
float ratio = NAN;
float temp = TV - m_Threshold;
ValueType ratio = NAN;
ValueType temp = TV - m_Threshold;
if (temp > 0)
ratio = temp / TV;
else
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -47,6 +47,6 @@
keywords='RTK Reconstruction Toolkit',
url=r'https://www.openrtk.org/',
install_requires=[
r'itk>=5.1rc03'
r'itk>=5.1'
]
)
1 change: 1 addition & 0 deletions src/rtkCudaFDKWeightProjectionFilter.cxx
Expand Up @@ -18,6 +18,7 @@

#include "rtkCudaFDKWeightProjectionFilter.h"
#include "rtkCudaFDKWeightProjectionFilter.hcu"
#include <itkProgressReporter.h>

namespace rtk
{
Expand Down
8 changes: 4 additions & 4 deletions test/ContinuousIntegration/AzurePipelinesBuildAndTest.yml
Expand Up @@ -18,20 +18,20 @@ jobs:
strategy:
matrix:
Linux:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-18.04'
cCompiler: gcc
cxxCompiler: g++
compilerInitialization: 'g++ --version'
macOS:
imageName: 'macos-10.13'
imageName: 'macos-10.15'
cCompiler: clang
cxxCompiler: clang++
compilerInitialization: ''
Windows:
imageName: 'vs2017-win2016'
imageName: 'windows-2019'
cCompiler: cl.exe
cxxCompiler: cl.exe
compilerInitialization: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
compilerInitialization: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'

pool:
vmImage: $(imageName)
Expand Down
68 changes: 58 additions & 10 deletions test/ContinuousIntegration/AzurePipelinesPythonPackages.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
cancelTimeoutInMinutes: 300
variables:
PythonVersion: cp35
displayName: "Build Linux Python 3.5 packages"
displayName: "Build Linux Python 3.5 package"
pool:
vmImage: 'Ubuntu-16.04'
steps:
Expand All @@ -27,7 +27,7 @@ jobs:
cancelTimeoutInMinutes: 300
variables:
PythonVersion: cp36
displayName: "Build Linux Python 3.6 packages"
displayName: "Build Linux Python 3.6 package"
pool:
vmImage: 'Ubuntu-16.04'
steps:
Expand All @@ -39,32 +39,80 @@ jobs:
cancelTimeoutInMinutes: 300
variables:
PythonVersion: cp37
displayName: "Build Linux Python 3.7 packages"
displayName: "Build Linux Python 3.7 package"
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'Ubuntu-18.04'
steps:
- template: Common/AzurePipelinesLinuxPython_Common.yml

# Linux Python 3.8
- job: 'PackageLinux_cp38'
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
variables:
PythonVersion: cp38
displayName: "Build Linux Python 3.8 package"
pool:
vmImage: 'Ubuntu-18.04'
steps:
- template: Common/AzurePipelinesLinuxPython_Common.yml

# MacOS Python
- job: 'PackageMacOS'
displayName: "Build macOS Python packages"
displayName: "Build macOS Python package"
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
pool:
vmImage: 'macos-10.14'
vmImage: 'macos-10.15'

steps:
- template: Common/AzurePipelinesMacOSPython_Common.yml

# Windows Python 3.5
- job: 'PackageWindows_35'
variables:
PythonVersion: 35-x64
displayName: "Build Windows Python 3.5 package"
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
pool:
vmImage: 'windows-2019'
steps:
- template: Common/AzurePipelinesWindowsPython_Common.yml

# Windows Python 3.6
- job: 'PackageWindows_36'
variables:
PythonVersion: 36-x64
displayName: "Build Windows Python 3.6 package"
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
pool:
vmImage: 'windows-2019'
steps:
- template: Common/AzurePipelinesWindowsPython_Common.yml

# Windows Python
- job: 'PackageWindows'
displayName: "Build Windows Python packages"
# Windows Python 3.7
- job: 'PackageWindows_37'
variables:
PythonVersion: 37-x64
displayName: "Build Windows Python 3.7 package"
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
pool:
vmImage: 'vs2017-win2016'
vmImage: 'windows-2019'
steps:
- template: Common/AzurePipelinesWindowsPython_Common.yml

# Windows Python 3.8
- job: 'PackageWindows_38'
variables:
PythonVersion: 38-x64
displayName: "Build Windows Python 3.8 package"
timeoutInMinutes: 0
cancelTimeoutInMinutes: 300
pool:
vmImage: 'windows-2019'
steps:
- template: Common/AzurePipelinesWindowsPython_Common.yml

@@ -1,16 +1,16 @@
# Build Windows Python packages
steps:
- script: |
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O
curl -L https://raw.githubusercontent.com/SimonRit/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O
displayName: 'Fetch build script'
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.2
set ITK_PACKAGE_VERSION=$(ITKPythonGitTag)
set CC=cl.exe
set CXX=cl.exe
powershell.exe -file .\windows-download-cache-and-build-module-wheels.ps1
powershell.exe -file .\windows-download-cache-and-build-module-wheels.ps1 --py-envs $(PythonVersion)
displayName: 'Build Python packages'
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'WindowsWheels'
artifactName: 'WindowsWheels_$(PythonVersion)'
targetPath: './dist'
16 changes: 4 additions & 12 deletions wrapping/itkCudaImageDataManager.wrap
Expand Up @@ -18,22 +18,14 @@ if(RTK_USE_CUDA)
foreach(component ${vectorComponents})

foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(vt ${WRAP_ITK_VECTOR_REAL})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}" "itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
endforeach()
foreach(cvt ${WRAP_ITK_COV_VECTOR_REAL})
itk_wrap_template("CI${ITKM_${cvt}${component}}${d}" "itk::CudaImage<${ITKT_${cvt}${component}}, ${d}>")
endforeach()
itk_wrap_template("CI${ITKM_VF${component}}${d}" "itk::CudaImage<${ITKT_VF${component}}, ${d}>")
itk_wrap_template("CI${ITKM_CVF${component}}${d}" "itk::CudaImage<${ITKT_CVF${component}}, ${d}>")
endforeach()

list(FIND ITK_WRAP_IMAGE_DIMS "4" _index)
if(${_index} EQUAL -1)
foreach(vt ${WRAP_ITK_VECTOR_REAL})
itk_wrap_template("CI${ITKM_${vt}${component}}4" "itk::CudaImage<${ITKT_${vt}${component}}, 4>")
endforeach()
foreach(cvt ${WRAP_ITK_COV_VECTOR_REAL})
itk_wrap_template("CI${ITKM_${cvt}${component}}4" "itk::CudaImage<${ITKT_${cvt}${component}}, 4>")
endforeach()
itk_wrap_template("CI${ITKM_VF${component}}4" "itk::CudaImage<${ITKT_VF${component}}, 4>")
itk_wrap_template("CI${ITKM_CVF${component}}4" "itk::CudaImage<${ITKT_CVF${component}}, 4>")
endif()

endforeach()
Expand Down
8 changes: 3 additions & 5 deletions wrapping/itkCudaImageToImageFilter.wrap
Expand Up @@ -11,11 +11,9 @@ if(RTK_USE_CUDA)
UNIQUE(imageDimensions "${ITK_WRAP_IMAGE_DIMS};2;3;4")
UNIQUE(vectorComponents "${ITK_WRAP_VECTOR_COMPONENTS};2;3;4;5")
foreach(component ${vectorComponents})
foreach(vt ${WRAP_ITK_VECTOR_REAL})
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}CI${ITKM_${vt}${component}}${d}"
"itk::CudaImage<${ITKT_${vt}${component}}, ${d}>, itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
endforeach()
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_VF${component}}${d}CI${ITKM_VF${component}}${d}"
"itk::CudaImage<${ITKT_VF${component}}, ${d}>, itk::CudaImage<${ITKT_VF${component}}, ${d}>")
endforeach()
endforeach()

Expand Down
8 changes: 3 additions & 5 deletions wrapping/itkCudaInPlaceImageFilter.wrap
Expand Up @@ -29,11 +29,9 @@ if(RTK_USE_CUDA)
UNIQUE(imageDimensions "${ITK_WRAP_IMAGE_DIMS};2;3;4")
UNIQUE(vectorComponents "${ITK_WRAP_VECTOR_COMPONENTS};2;3;4;5")
foreach(component ${vectorComponents})
foreach(vt ${WRAP_ITK_VECTOR_REAL})
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}CI${ITKM_${vt}${component}}${d}IPIFCI${ITKM_${vt}${component}}${d}"
"itk::CudaImage<${ITKT_${vt}${component}}, ${d}>, itk::CudaImage<${ITKT_${vt}${component}}, ${d}>, itk::InPlaceImageFilter< itk::CudaImage<${ITKT_${vt}${component}}, ${d}> >")
endforeach()
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_VF${component}}${d}CI${ITKM_VF${component}}${d}IPIFCI${ITKM_VF${component}}${d}"
"itk::CudaImage<${ITKT_VF${component}}, ${d}>, itk::CudaImage<${ITKT_VF${component}}, ${d}>, itk::InPlaceImageFilter< itk::CudaImage<${ITKT_VF${component}}, ${d}> >")
endforeach()
endforeach()

Expand Down
19 changes: 7 additions & 12 deletions wrapping/itkImageSourceRTK.wrap
Expand Up @@ -86,20 +86,15 @@ itk_wrap_class("itk::ImageSource" POINTER)

UNIQUE(vectorComponents "${ITK_WRAP_VECTOR_COMPONENTS};2;3;4;5")
foreach(component ${vectorComponents})
foreach(vt ${WRAP_ITK_VECTOR_REAL})

foreach(d ${ITK_WRAP_IMAGE_DIMS})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}" "itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
endforeach()

list(FIND ITK_WRAP_IMAGE_DIMS "4" _index)
if(${_index} EQUAL -1)
itk_wrap_template("CI${ITKM_${vt}${component}}4" "itk::CudaImage<${ITKT_${vt}${component}}, 4>")
endif()

foreach(d ${ITK_WRAP_IMAGE_DIMS})
itk_wrap_template("CI${ITKM_VF${component}}${d}" "itk::CudaImage<${ITKT_VF${component}}, ${d}>")
endforeach()
endforeach()

list(FIND ITK_WRAP_IMAGE_DIMS "4" _index)
if(${_index} EQUAL -1)
itk_wrap_template("CI${ITKM_VF${component}}4" "itk::CudaImage<${ITKT_VF${component}}, 4>")
endif()
endforeach()
endif()

# Wrap ITK CovariantVector missing types
Expand Down
8 changes: 3 additions & 5 deletions wrapping/itkImageToImageFilterRTK.wrap
Expand Up @@ -75,11 +75,9 @@ itk_wrap_class("itk::ImageToImageFilter" POINTER)
UNIQUE(imageDimensions "${ITK_WRAP_IMAGE_DIMS};2;3;4")
UNIQUE(vectorComponents "${ITK_WRAP_VECTOR_COMPONENTS};2;3;4;5")
foreach(component ${vectorComponents})
foreach(vt ${WRAP_ITK_VECTOR_REAL})
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}CI${ITKM_${vt}${component}}${d}"
"itk::CudaImage<${ITKT_${vt}${component}}, ${d}>, itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
endforeach()
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_VF${component}}${d}CI${ITKM_VF${component}}${d}"
"itk::CudaImage<${ITKT_VF${component}}, ${d}>, itk::CudaImage<${ITKT_VF${component}}, ${d}>")
endforeach()
endforeach()

Expand Down
10 changes: 4 additions & 6 deletions wrapping/itkInPlaceImageFilterRTK.wrap
Expand Up @@ -65,12 +65,10 @@ itk_wrap_class("itk::InPlaceImageFilter" POINTER)
UNIQUE(imageDimensions "${ITK_WRAP_IMAGE_DIMS};2;3;4")
UNIQUE(vectorComponents "${ITK_WRAP_VECTOR_COMPONENTS};2;3;4;5")
foreach(component ${vectorComponents})
foreach(vt ${WRAP_ITK_VECTOR_REAL})
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_${vt}${component}}${d}" "itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
itk_wrap_template("CI${ITKM_${vt}${component}}${d}CI${ITKM_${vt}${component}}${d}"
"itk::CudaImage<${ITKT_${vt}${component}}, ${d}>, itk::CudaImage<${ITKT_${vt}${component}}, ${d}>")
endforeach()
foreach(d ${imageDimensions})
itk_wrap_template("CI${ITKM_VF${component}}${d}" "itk::CudaImage<${ITKT_VF${component}}, ${d}>")
itk_wrap_template("CI${ITKM_VF${component}}${d}CI${ITKM_VF${component}}${d}"
"itk::CudaImage<${ITKT_VF${component}}, ${d}>, itk::CudaImage<${ITKT_VF${component}}, ${d}>")
endforeach()
endforeach()

Expand Down
@@ -0,0 +1,6 @@
itk_wrap_class("rtk::ADMMTotalVariationConeBeamReconstructionFilter" POINTER)
if(RTK_USE_CUDA)
itk_wrap_template("CIF3" "itk::CudaImage<${ITKT_F}, 3>")
endif()
itk_wrap_image_filter("${WRAP_ITK_REAL}" 1 3)
itk_end_wrap_class()

0 comments on commit 8099212

Please sign in to comment.