Skip to content

Commit

Permalink
simplified itkJoinCopyFilter according to InplaceImageFilter example:
Browse files Browse the repository at this point in the history
  • Loading branch information
romangrothausmann committed Jan 31, 2018
1 parent 9f0332c commit 5bcf696
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
26 changes: 13 additions & 13 deletions Logic/Common/itkJoinCopyFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@

namespace itk{

template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
JoinCopyFilter<TInputImage1, TInputImage2, TOutputImage>
template<typename TInputImage1, typename TInputImage2>
JoinCopyFilter<TInputImage1, TInputImage2>
::JoinCopyFilter(){
m_SeedActive= false;
m_SeedIndex.Fill(0);
m_SeedValue= NumericTraits<typename TOutputImage::PixelType>::Zero;
m_SeedValue= NumericTraits<typename TInputImage2::PixelType>::Zero;
}

template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
void JoinCopyFilter<TInputImage1, TInputImage2, TOutputImage>
template<typename TInputImage1, typename TInputImage2>
void JoinCopyFilter<TInputImage1, TInputImage2>
::SetJsrc(const TInputImage1 *image1){
this->SetNthInput( 0, const_cast< TInputImage1 * >( image1 ) );
}

template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
void JoinCopyFilter<TInputImage1, TInputImage2, TOutputImage>
template<typename TInputImage1, typename TInputImage2>
void JoinCopyFilter<TInputImage1, TInputImage2>
::SetJdst(const TInputImage2 *image2){
this->SetNthInput( 1, const_cast< TInputImage2 * >( image2 ) );
}


template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
void JoinCopyFilter<TInputImage1, TInputImage2, TOutputImage>
template<typename TInputImage1, typename TInputImage2>
void JoinCopyFilter<TInputImage1, TInputImage2>
::BeforeThreadedGenerateData(){

if(m_SeedActive){
Expand All @@ -43,16 +43,16 @@ namespace itk{
}


template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
void JoinCopyFilter<TInputImage1, TInputImage2, TOutputImage>
template<typename TInputImage1, typename TInputImage2>
void JoinCopyFilter<TInputImage1, TInputImage2>
::ThreadedGenerateData(const typename Superclass::OutputImageRegionType& outputRegionForThread, ThreadIdType threadId){

if(m_SeedActive){
typename TInputImage1::ConstPointer input = dynamic_cast<const TInputImage1 *>( ProcessObject::GetInput(0) );
typename TOutputImage::Pointer output = this->GetOutput();
typename TInputImage2::Pointer output = this->GetOutput();

itk::ImageRegionConstIterator<TInputImage1> iti(input, outputRegionForThread);
itk::ImageRegionIterator<TOutputImage> ito(output, outputRegionForThread);
itk::ImageRegionIterator<TInputImage2> ito(output, outputRegionForThread);

// support progress methods/callbacks with 1000 updates
ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels(), 1000);
Expand Down
12 changes: 6 additions & 6 deletions Logic/Common/itkJoinCopyFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace itk{
*
* \ingroup ImageFilters
*/
template<typename TInputImage1, typename TInputImage2, typename TOutputImage>
template<typename TInputImage1, typename TInputImage2>
class JoinCopyFilter:
public InPlaceImageFilter<TInputImage2, TOutputImage>{
public InPlaceImageFilter<TInputImage2>{
public:
/** Standard class typedefs. */
typedef JoinCopyFilter Self;
typedef InPlaceImageFilter<TInputImage2, TOutputImage> Superclass;
typedef InPlaceImageFilter<TInputImage2> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer< const Self > ConstPointer;

Expand All @@ -33,8 +33,8 @@ namespace itk{
itkGetConstMacro(SeedIndex, typename TInputImage1::IndexType);

/** Set/Get DrawingColor value */
itkSetMacro(DrawingColor, typename TOutputImage::ValueType);
itkGetConstMacro(DrawingColor, typename TOutputImage::ValueType);
itkSetMacro(DrawingColor, typename TInputImage2::ValueType);
itkGetConstMacro(DrawingColor, typename TInputImage2::ValueType);

/** Get UpdateFlag value */
itkGetConstMacro(UpdateFlag, bool);
Expand All @@ -50,7 +50,7 @@ namespace itk{
bool m_SeedActive;
typename TInputImage1::IndexType m_SeedIndex;
typename TInputImage1::ValueType m_SeedValue;
typename TOutputImage::ValueType m_DrawingColor;
typename TInputImage2::ValueType m_DrawingColor;
bool m_UpdateFlag;


Expand Down
2 changes: 1 addition & 1 deletion Logic/Framework/JOINImageData.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class JOINImageData : public GenericImageData
typedef JdstImageWrapper::ImageType JdstImageType;
typedef WsrcImageWrapper::ImageType WsrcImageType;

typedef itk::JoinCopyFilter<JsrcImageType, JdstImageType, JdstImageType> JoinCopyFilterType;
typedef itk::JoinCopyFilter<JsrcImageType, JdstImageType> JoinCopyFilterType;
typedef JoinCopyFilterType::Pointer JoinCopyFilterPointer;

/** Initialize to a ROI from another image data object */
Expand Down

0 comments on commit 5bcf696

Please sign in to comment.