Skip to content

Commit

Permalink
Update latest ITKModuleTemplate
Browse files Browse the repository at this point in the history
Remove some placeholders
  • Loading branch information
phcerdan committed Nov 2, 2018
1 parent 5f6054f commit 24e0139
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 392 deletions.
63 changes: 63 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
version: 2
jobs:
build-and-test:
working_directory: /ITKTotalVariation-build
docker:
- image: insighttoolkit/module-ci:latest
steps:
- checkout:
path: /ITKTotalVariation
- run:
name: Fetch CTest driver script
command: |
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
- run:
name: Configure CTest script
command: |
SHASNIP=$(echo $CIRCLE_SHA1 | cut -c1-7)
cat > dashboard.cmake << EOF
set(CTEST_SITE "CircleCI")
set(CTEST_BUILD_NAME "External-ITKTotalVariation-${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}-${SHASNIP}")
set(CTEST_BUILD_CONFIGURATION "MinSizeRel")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_BUILD_FLAGS: "-j5")
set(CTEST_SOURCE_DIRECTORY /ITKTotalVariation)
set(CTEST_BINARY_DIRECTORY /ITKTotalVariation-build)
set(dashboard_model Experimental)
set(dashboard_no_clean 1)
set(dashboard_cache "
ITK_DIR:PATH=/ITK-build
BUILD_TESTING:BOOL=ON
")
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
EOF
- run:
name: Build and Test
no_output_timeout: 1.0h
command: |
ctest -j 2 -VV -S dashboard.cmake
package:
working_directory: ~/ITKTotalVariation
machine: true
steps:
- checkout
- run:
name: Fetch build script
command: |
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
- run:
name: Build Python packages
no_output_timeout: 1.0h
command: |
./dockcross-manylinux-download-cache-and-build-module-wheels.sh
- store_artifacts:
path: dist
destination: dist

workflows:
version: 2
build-test-package:
jobs:
- build-and-test
- package
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sudo: true
language: cpp
os:
- osx
compiler:
- gcc
cache:
directories:
- "$HOME/Library/Caches/Homebrew"
script:
- curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O
- chmod u+x macpython-download-cache-and-build-module-wheels.sh
- ./macpython-download-cache-and-build-module-wheels.sh
- tar -zcvf dist.tar.gz dist/
- curl --upload-file dist.tar.gz https://transfer.sh/dist.tar.gz
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.10.2)
project(TotalVariation)

set(TotalVariation_LIBRARIES TotalVariation)
Expand All @@ -10,5 +10,6 @@ if(NOT ITK_SOURCE_DIR)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: "0.0.1.{build}"

install:

- curl -L https://rawgit.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O
- curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O
- ps: .\windows-download-cache-and-build-module-wheels.ps1

build: off
Expand Down
94 changes: 0 additions & 94 deletions include/itkMinimalStandardRandomVariateGenerator.h

This file was deleted.

86 changes: 86 additions & 0 deletions include/itkMyFilter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*=========================================================================
*
* 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 itkMyFilter_h
#define itkMyFilter_h

#include "itkImageToImageFilter.h"

namespace itk
{

/** \class MyFilter
*
* \brief Filters a image by iterating over its pixels.
*
* Filters a image by iterating over its pixels in a multi-threaded way
* and {to be completed by the developer}.
*
* \ingroup TotalVariation
*
*/
template< typename TInputImage, typename TOutputImage >
class MyFilter: public ImageToImageFilter< TInputImage, TOutputImage >
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(MyFilter);

static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;

using InputImageType = TInputImage;
using OutputImageType = TInputImage;
using InputPixelType = typename InputImageType::PixelType;
using OutputPixelType = typename OutputImageType::PixelType;

/** Standard class typedefs. */
using Self = MyFilter< InputImageType, OutputImageType >;
using Superclass = ImageToImageFilter< InputImageType, OutputImageType >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;

/** Run-time type information. */
itkTypeMacro( MyFilter, ImageToImageFilter );

/** Standard New macro. */
itkNewMacro( Self );

protected:
MyFilter();
virtual ~MyFilter() override {}

void PrintSelf( std::ostream& os, Indent indent ) const override;

typedef typename OutputImageType::RegionType OutputRegionType;

virtual void DynamicThreadedGenerateData( const OutputRegionType & outputRegion) override;

private:


#ifdef ITK_USE_CONCEPT_CHECKING
// Add concept checking such as
// itkConceptMacro( FloatingPointPixel, ( itk::Concept::IsFloatingPoint< typename InputImageType::PixelType > ) );
#endif
};
}

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMyFilter.hxx"
#endif

#endif // itkMyFilter
66 changes: 66 additions & 0 deletions include/itkMyFilter.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*=========================================================================
*
* 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 itkMyFilter_hxx
#define itkMyFilter_hxx

#include "itkMyFilter.h"

#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"

namespace itk
{

template< typename TInputImage, typename TOutputImage >
MyFilter< TInputImage, TOutputImage >
::MyFilter()
{
}


template< typename TInputImage, typename TOutputImage >
void
MyFilter< TInputImage, TOutputImage >
::PrintSelf( std::ostream& os, Indent indent ) const
{
Superclass::PrintSelf( os, indent );
}


template< typename TInputImage, typename TOutputImage >
void
MyFilter< TInputImage, TOutputImage >
::DynamicThreadedGenerateData( const OutputRegionType & outputRegion)
{
OutputImageType * output = this->GetOutput();
const InputImageType * input = this->GetInput();
using InputRegionType = typename InputImageType::RegionType;
InputRegionType inputRegion = InputRegionType(outputRegion.GetSize());

itk::ImageRegionConstIterator<InputImageType> in(input, inputRegion);
itk::ImageRegionIterator<OutputImageType> out(output, outputRegion);

for (in.GoToBegin(), out.GoToBegin(); !in.IsAtEnd() && !out.IsAtEnd(); ++in, ++out)
{
out.Set( in.Get() );
}
}

} // end namespace itk

#endif // itkMyFilter_hxx
Loading

0 comments on commit 24e0139

Please sign in to comment.