32 #include "DGtal/base/Common.h"
33 #include "DGtal/kernel/SpaceND.h"
34 #include "DGtal/kernel/domains/HyperRectDomain.h"
35 #include "DGtal/images/ImageContainerByITKImage.h"
36 #include <boost/foreach.hpp>
39 #include <itkBinaryThresholdImageFilter.h>
40 #include <itkImageFileWriter.h>
44 using namespace DGtal;
55 unsigned int nbok = 0;
63 typedef Domain::Point
Point;
68 const Integer t[ ] = { 1, 1, 1};
69 const Integer t2[ ] = { 5, 5, 5};
70 const Integer t3[ ] = { 2, 2, 2};
76 Image myImage ( a, b );
79 trace.
info() <<
"getvalue= " << myImage(c) << endl;
81 myImage.setValue( c, 23);
87 trace.
info() <<
"getvalue= " << val << endl;
103 myImage.setValue(it, nbVal++);
113 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
114 <<
"true == true" << std::endl;
122 unsigned int nbok = 0;
130 typedef Domain::Point Point;
138 Image myImage ( a, b );
146 myImage.setValue(it, nbVal++);
156 typedef itk::BinaryThresholdImageFilter< Image::ITKImage, Image::ITKImage> Filter;
157 Filter::Pointer filter = Filter::New();
159 filter->SetInput( myImage.getImagePointer() );
160 filter->SetOutsideValue( 0 );
161 filter->SetInsideValue( 10 );
162 filter->SetLowerThreshold( 34 );;
163 filter->SetUpperThreshold( 400 );;
167 Image::ITKImagePointer handleOut = filter->GetOutput();
168 Image myImageOut ( a, b, handleOut );
179 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
180 <<
"true == true" << std::endl;
192 int main(
int argc,
char** argv )
196 for (
int i = 0; i < argc; ++i )
200 bool res = testITKImage() && testITKMethod();
201 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;