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>
40 #pragma GCC diagnostic push
41 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
43 #if defined(__clang__)
44 #pragma clang diagnostic push
45 #pragma clang diagnostic ignored "-Wdocumentation"
47 #include <itkExtractImageFilter.h>
48 #if defined(__clang__)
49 #pragma clang diagnostic pop
53 #pragma GCC diagnostic pop
58 using namespace DGtal;
69 unsigned int nbok = 0;
81 const Integer t[ ] = { 1, 1, 1};
82 const Integer t2[ ] = { 5, 5, 5};
83 const Integer t3[ ] = { 2, 2, 2};
89 Image myImage ( Domain(a, b) );
92 trace.
info() <<
"getvalue= " << myImage(c) << endl;
94 myImage.setValue( c, 23);
100 trace.
info() <<
"getvalue= " << val << endl;
116 myImage.setValue(it, nbVal++);
126 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
127 <<
"true == true" << std::endl;
135 unsigned int nbok = 0;
152 Image myImage(domain);
160 myImage.setValue(it, nbVal++);
171 typedef itk::ExtractImageFilter< Image::ITKImage, Image::ITKImage > CropFilter;
174 Image::ITKImage::SizeType size;
178 Image::ITKImage::IndexType index;
182 Image::ITKImage::RegionType regionToExtract(index,size);
185 CropFilter::Pointer cropFilter = CropFilter::New();
186 cropFilter->SetInput( myImage.getITKImagePointer() );
187 cropFilter->SetExtractionRegion( regionToExtract );
188 cropFilter->Update();
191 Image::ITKImagePointer handleOut = cropFilter->GetOutput();
192 Image myImageOut ( handleOut );
201 nbok += (it.Value() == (it.GetIndex()[1]*10 + it.GetIndex()[0]));
203 trace.
warning() << it.Value() <<
"(" << (it.GetIndex()[1]*10 + it.GetIndex()[0]) <<
")" <<
" ";
207 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " <<
"true == true" << std::endl;
210 return nbok == 25 && nb == 25;
216 int main(
int argc,
char** argv )
220 for (
int i = 0; i < argc; ++i )
224 bool res = testITKImage() && testITKMethod();
225 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
std::vector< Value >::iterator Iterator
Aim: implements association bewteen points lying in a digital domain and values.
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::vector< Value >::const_iterator ConstIterator
boost::int32_t int32_t
signed 32-bit integer.
Aim: implements a model of CImageContainer using a ITK Image.