Skip to content

Commit

Permalink
progress report for itkJoinCopyFilter (from 82f72dc)
Browse files Browse the repository at this point in the history
  • Loading branch information
romangrothausmann committed Jan 31, 2018
1 parent 1b63ff4 commit a714e11
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Logic/Framework/JOINImageData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@

#include "IRISApplication.h"
#include "JOINImageData.h"
//#include "itkJCFilterWatcher.h"
#include <itkCommand.h>


void FilterEventHandlerITK2(itk::Object *caller, const itk::EventObject &event, void*){

const itk::ProcessObject* filter = static_cast<const itk::ProcessObject*>(caller);

if(itk::ProgressEvent().CheckEvent(&event))
fprintf(stderr, "\r%s progress: %5.1f%%", filter->GetNameOfClass(), 100.0 * filter->GetProgress());//stderr is flushed directly
else if(itk::EndEvent().CheckEvent(&event))
std::cerr << std::endl << std::flush;
}


JOINImageData
::JOINImageData(){
Expand Down Expand Up @@ -311,10 +325,19 @@ ::InitializeJoinCF(){

////Initialize JoinCopyFilter
m_JoinCF= JoinCopyFilterType::New();

m_JoinCF->SetJsrc(m_JsrcWrapper->GetImage());
m_JoinCF->SetJdst(m_JdstWrapper->GetImage());
//m_JdstWrapper->SetImage(m_JoinCF->GetOutput()); //causes segfault due to missing transform of uninitialized output
m_JoinCF->InPlaceOn(); //makes 2nd input (SetJdst) be the output

itk::CStyleCommand::Pointer eventCallbackITK;
eventCallbackITK = itk::CStyleCommand::New();
eventCallbackITK->SetCallback(FilterEventHandlerITK2);

m_JoinCF->AddObserver(itk::ProgressEvent(), eventCallbackITK);
m_JoinCF->AddObserver(itk::EndEvent(), eventCallbackITK);

}

JOINImageData::JoinCopyFilterPointer
Expand Down

0 comments on commit a714e11

Please sign in to comment.