69  unsigned int nbok = 0;
 
   72  trace.beginBlock ( 
"ITK Image init..." );
 
   81  const Integer t[ ] = { 1, 1, 1};
 
   82  const Integer t2[ ] = { 5, 5, 5};
 
   83  const Integer t3[ ] = { 2, 2, 2};
 
   84  Point lowerBound ( t );
 
   85  Point upperBound ( t2 );
 
   91  trace.info() << myImage << std::endl;
 
   92  trace.info() << 
"getvalue= " << myImage(c) << endl;
 
   93  trace.info() << 
"set value 23 " << endl;
 
  100  trace.info() << 
"getvalue= " << val << endl;
 
  104  trace.info() << 
"Simple Iterator=";
 
  108    trace.warning() << myImage(it) << 
" ";
 
  109  trace.info() << endl;
 
  118  trace.info() << 
"Set Iterator=";
 
  122    trace.warning() << myImage(it) << 
" ";
 
  123  trace.info() << endl;
 
  125  auto & container = myImage.container();
 
  129  trace.info() << 
"(" << nbok << 
"/" << nb << 
") " 
  130  << 
"true == true" << std::endl;
 
 
  138  unsigned int nbok = 0;
 
  141  trace.beginBlock ( 
"Test the use of a pure ITK method..." );
 
  151  Point lowerBound ( 0, 0 );
 
  152  Point upperBound ( 9, 9);
 
  156  trace.info() << myImage << std::endl;
 
  165  trace.info() << 
"Input image=";
 
  169    trace.warning() << myImage(it) << 
" ";
 
  170  trace.info() << endl;
 
  174  typedef itk::ExtractImageFilter< Image::ITKImage, Image::ITKImage > CropFilter;
 
  177  Image::ITKImage::SizeType size;
 
  181  Image::ITKImage::IndexType 
index;
 
  185  Image::ITKImage::RegionType regionToExtract(
index,size);
 
  188  CropFilter::Pointer cropFilter = CropFilter::New();
 
  189  cropFilter->SetInput( myImage.getITKImagePointer() );
 
  190  cropFilter->SetExtractionRegion( regionToExtract  );
 
  191  cropFilter->Update();
 
  194  Image::ITKImagePointer handleOut = cropFilter->GetOutput();
 
  195  Image myImageOut ( handleOut );
 
  198  trace.info() << 
"Output image=";
 
  204    nbok += (it.Value() == (it.GetIndex()[1]*10 + it.GetIndex()[0]));
 
  206    trace.warning() << it.Value() << 
"(" << (it.GetIndex()[1]*10 + it.GetIndex()[0]) << 
")" << 
" ";
 
  208  trace.info() << endl;
 
  210  trace.info() << 
"(" << nbok << 
"/" << nb << 
") " << 
"true == true" << std::endl;
 
  213  return nbok == 25 && nb == 25;
 
 
  218  trace.beginBlock ( 
"ITK Image With Metadata init..." );
 
  220  unsigned int nbok = 0;
 
  232  const Integer t[ ] = { 1, 1, 1};
 
  233  const Integer t2[ ] = { 5, 5, 5};
 
  234  const Integer t3[ ] = { 2, 2, 2};
 
  235  Point lowerBound ( t );
 
  236  Point upperBound ( t2 );
 
  248  auto itk_image = myImage.getITKImagePointer();
 
  249  Image::ITKImage::PointType origin;
 
  251  Image::ITKImage::SpacingType spacing;
 
  253  Image::ITKImage::DirectionType direction;
 
  254  direction.SetIdentity();
 
  255  itk_image->SetOrigin(origin);
 
  256  itk_image->SetSpacing(spacing);
 
  257  itk_image->SetDirection(direction);
 
  260  val = myImage.operator()(lowerBound);
 
  261  nbok += (val == 0); nb++;
 
  262  trace.info() << 
"Index: " << lowerBound << 
". Value: " << val << 
". Expected: " << 0 << std::endl;
 
  263  val = myImage.operator()(upperBound);
 
  264  nbok += (val == 124); nb++;
 
  265  trace.info() << 
"Index: " << upperBound << 
". Value: " << val << 
". Expected: " << 124 << std::endl;
 
  266  val = myImage.operator()(c);
 
  267  nbok += (val == 31); nb++;
 
  268  trace.info() << 
"Index: " << c << 
". Value: " << val << 
". Expected: " << 31 << std::endl;
 
  270  Image::PhysicalPoint physical_point;
 
  271  Image::PhysicalPoint expected_physical_point;
 
  275  index_point = myImage.getIndexFromDomainPoint(lowerBound);
 
  276  nbok += (index_point == lowerBound); nb++;
 
  277  physical_point = myImage.getPhysicalPointFromDomainPoint(index_point);
 
  278  expected_physical_point = myImage.getLowerBoundAsPhysicalPoint();
 
  279  nbok += (physical_point[0] == 12.0); nb++;
 
  280  nbok += (physical_point == expected_physical_point); nb++;
 
  281  trace.info() << 
"Index: " << index_point << 
". PhysicalPoint: " << physical_point << 
". Expected: " << expected_physical_point << std::endl;
 
  283  index_point = myImage.getIndexFromDomainPoint(upperBound);
 
  284  nbok += (index_point == upperBound); nb++;
 
  285  physical_point = myImage.getPhysicalPointFromDomainPoint(index_point);
 
  286  expected_physical_point = myImage.getUpperBoundAsPhysicalPoint();
 
  287  nbok += (physical_point[0] == 20.0); nb++;
 
  288  nbok += (physical_point == expected_physical_point); nb++;
 
  289  trace.info() << 
"Index: " << index_point << 
". PhysicalPoint: " << physical_point << 
". Expected: " << expected_physical_point << std::endl;
 
  291  auto index_back = myImage.getDomainPointFromPhysicalPoint(physical_point);
 
  292  nbok += (index_back == upperBound); nb++;
 
  293  trace.info() << 
"PhysicalPoint: " << physical_point << 
". Index (back): " << index_back << 
". Expected: " << upperBound << std::endl;
 
  297  return nbok == 10 && nb == 10;
 
 
  302  trace.beginBlock ( 
"ITK Image With ShiftDomain init..." );
 
  304  unsigned int nbok = 0;
 
  314  const Integer t[ ] = { 1, 1, 1};
 
  315  const Integer t2[ ] = { 5, 5, 5};
 
  316  const Integer t3[ ] = { 2, 2, 2};
 
  317  Point lowerBound ( t );
 
  318  Point upperBound ( t2 );
 
  332  auto itk_image = myImage.getITKImagePointer();
 
  333  Image::ITKImage::PointType origin;
 
  335  Image::ITKImage::SpacingType spacing;
 
  337  Image::ITKImage::DirectionType direction;
 
  338  direction.SetIdentity();
 
  339  itk_image->SetOrigin(origin);
 
  340  itk_image->SetSpacing(spacing);
 
  341  itk_image->SetDirection(direction);
 
  345  const Integer sd[ ] = { -20, -20, -20};
 
  346  Point domainShift(sd);
 
  347  myImage.updateDomain(domainShift);
 
  350  nbok += ( new_lowerBound == lowerBound + domainShift); nb++;
 
  351  trace.info() << 
"lowerBound: " << new_lowerBound << 
". Expected: " << lowerBound + domainShift << std::endl;
 
  352  nbok += ( new_upperBound == upperBound + domainShift); nb++;
 
  353  trace.info() << 
"upperBound: " << new_upperBound << 
". Expected: " << upperBound + domainShift << std::endl;
 
  356  val = myImage.operator()(new_lowerBound);
 
  358  nbok += (val == 0); nb++;
 
  359  trace.info() << 
"Index: " << new_lowerBound << 
". Value: " << val << 
". Expected: " << 0 << std::endl;
 
  360  val = myImage.operator()(new_upperBound);
 
  361  nbok += (val == 124); nb++;
 
  362  trace.info() << 
"Index: " << new_upperBound << 
". Value: " << val << 
". Expected: " << 124 << std::endl;
 
  363  val = myImage.operator()(myImage.getDomainPointFromIndex(c));
 
  364  nbok += (val == 31); nb++;
 
  365  trace.info() << 
"Index: " << c << 
". Value: " << val << 
". Expected: " << 31 << std::endl;
 
  367  Image::PhysicalPoint physical_point;
 
  368  Image::PhysicalPoint expected_physical_point;
 
  372  index_point = lowerBound;
 
  373  domain_point = new_lowerBound;
 
  374  physical_point = myImage.getPhysicalPointFromDomainPoint(domain_point);
 
  375  expected_physical_point = Image::PhysicalPoint(12.0, 12.0, 12.0);
 
  376  nbok += (physical_point == expected_physical_point); nb++;
 
  377  trace.info() << 
"Domain: " << domain_point <<
 
  378    ". Index: " << index_point <<
 
  379    ". PhysicalPoint: " << physical_point <<
 
  380    ". Expected: " << expected_physical_point << std::endl;
 
  382  index_point = myImage.getIndexFromDomainPoint(new_lowerBound);
 
  383  nbok += ( index_point == lowerBound ); nb++;
 
  384  trace.info() << 
"index_point: " << index_point << 
". Expected: " << lowerBound << std::endl;
 
  385  physical_point = myImage.getPhysicalPointFromDomainPoint(new_lowerBound);
 
  386  expected_physical_point = myImage.getLowerBoundAsPhysicalPoint();
 
  387  nbok += (physical_point[0] == 12.0); nb++;
 
  388  nbok += (physical_point == expected_physical_point); nb++;
 
  389  trace.info() << 
"Domain: " << new_lowerBound <<
 
  390    ". Index: " << index_point <<
 
  391    ". PhysicalPoint: " << physical_point <<
 
  392    ". Expected: " << expected_physical_point << std::endl;
 
  394  index_point = upperBound;
 
  395  domain_point = new_upperBound;
 
  396  physical_point = myImage.getPhysicalPointFromDomainPoint(domain_point);
 
  397  expected_physical_point = myImage.getUpperBoundAsPhysicalPoint();
 
  398  nbok += (physical_point[0] == 20.0); nb++;
 
  399  nbok += (physical_point == expected_physical_point); nb++;
 
  400  trace.info() << 
"Domain: " << new_lowerBound <<
 
  401    ". Index: " << index_point <<
 
  402    ". PhysicalPoint: " << physical_point <<
 
  403    ". Expected: " << expected_physical_point << std::endl;
 
  405  return nbok == 11 && nb == 11;
 
 
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
const Point & lowerBound() const
const Point & upperBound() const