-
Notifications
You must be signed in to change notification settings - Fork 1
/
itkImgFilter.cxx
52 lines (46 loc) · 1.2 KB
/
itkImgFilter.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* \file: itkImgFilter.cxx
* \author: Sankhesh Jhaveri
* \brief: defines itkImgFilter class
**/
#include "itkImgFilter.h"
//Constructor
itkImgFilter::itkImgFilter() :
cannyFilter( cannyFilterType::New() ),
reader( readerType::New() )
{
this->cannyFilter->SetInput( this->reader->GetOutput() );
this->cannyFilter->SetVariance( 1 );
this->cannyFilter->SetUpperThreshold( 1 );
}
void itkImgFilter::setFilterInput(const std::string &filename)
{
this->reader->SetFileName( filename );
}
vtkSmartPointer<vtkImageActor> itkImgFilter::getFilterOutput( void )
{
vcl_try
{
this->cannyFilter->Update();
}
vcl_catch (itk::ExceptionObject &err)
{
vcl_cout << vcl_endl
<< "***" << vcl_endl
<< "Exception caught:" << vcl_endl
<< err << vcl_endl
<< "***" << vcl_endl
<< vcl_flush;
return NULL;
}
UTILS::ScalarImageType::Pointer img = this->cannyFilter->GetOutput();
return UTILS::ITKToVTKConvert( UTILS::ComposeRGBImage( img ) );
}
void itkImgFilter::SetVariance( const float x )
{
this->cannyFilter->SetVariance( x );
}
void itkImgFilter::SetThreshold( const float x )
{
this->cannyFilter->SetUpperThreshold( x );
}