コード例 #1
0
void mitkImageStatisticsCalculatorTestSuite::TestImageMaskingNonEmpty()
{
  mitk::Image::Pointer mask_image = mitk::ImageGenerator::GenerateImageFromReference<unsigned char>( m_Image, 0 );

  std::vector< itk::Index<3U> > activated_indices;
  itk::Index<3U> index = {{10, 8, 0}};
  activated_indices.push_back( index );

  index[0] = 9;  index[1] = 8; index[2] =  0;
  activated_indices.push_back( index );

  index[0] = 9;  index[1] = 7; index[2] =  0;
  activated_indices.push_back( index );

  index[0] = 10;  index[1] = 7; index[2] =  0;
  activated_indices.push_back( index );

  std::vector< itk::Index<3U> >::const_iterator indexIter = activated_indices.begin();

  // activate voxel in the mask image
  mitk::ImagePixelWriteAccessor< unsigned char, 3> writeAccess( mask_image );
  while( indexIter != activated_indices.end() )
  {
    writeAccess.SetPixelByIndex( (*indexIter++), 1);
  }

  this->VerifyStatistics( ComputeStatistics( m_Image, mask_image ), 127.5, 147.22, 254.5);
}
コード例 #2
0
void mitkImageStatisticsCalculatorTestSuite::TestCase12()
{
  /*****************************
   * half pixel (white) + whole pixel (white) + half pixel (black)
   * -> mean of 212.66 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
  figure2->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 9.5; pnt1[1] = 0.5;
  figure2->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 2.5;
  figure2->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 11.5; pnt3[1] = 2.5;
  figure2->SetControlPoint( 2, pnt3, true );
  figure2->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 212.66, 73.32);
}
コード例 #3
0
void mitkImageStatisticsCalculatorTestSuite::TestCase3()
{
  /*****************************
   * half pixel in diagonal-direction (white)
   * -> mean of 255 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
  figure1->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 10.5 ; pnt1[1] = 3.5;
  figure1->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
  figure1->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
  figure1->SetControlPoint( 2, pnt3, true );
  figure1->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 255.0, 0.0);
}
コード例 #4
0
void mitkImageStatisticsCalculatorTestSuite::TestCase10()
{
  /*****************************
   * 2 whole pixel (white) + 2 whole pixel (black) in y-direction
   * -> mean of 127.66 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
  figure2->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 11.5; pnt1[1] = 10.5;
  figure2->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 11.5; pnt2[1] = 13.5;
  figure2->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 12.5; pnt3[1] = 13.5;
  figure2->SetControlPoint( 2, pnt3, true );
  mitk::Point2D pnt4; pnt4[0] = 12.5; pnt4[1] = 10.5;
  figure2->SetControlPoint( 3, pnt4, true );
  figure2->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 127.66, 127.5);
}
コード例 #5
0
void mitkImageStatisticsCalculatorTestSuite::TestCase6()
{
  /*****************************
   * quarter pixel (black) + whole pixel (white) + half pixel (gray) in x-direction
   * -> mean of 191.5 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
  figure1->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
  figure1->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 9.25; pnt2[1] = 3.5;
  figure1->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 9.25; pnt3[1] = 4.5;
  figure1->SetControlPoint( 2, pnt3, true );
  mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.5;
  figure1->SetControlPoint( 3, pnt4, true );
  figure1->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 191.5, 89.80);
}
コード例 #6
0
void mitkImageStatisticsCalculatorTestSuite::TestCase4()
{
  /*****************************
   * one pixel (white) + 2 half pixels (white) + 1 half pixel (black)
   * -> mean of 191.25 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
  figure1->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 1.1; pnt1[1] = 1.1;
  figure1->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 2.0; pnt2[1] = 2.0;
  figure1->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 3.0; pnt3[1] = 1.0;
  figure1->SetControlPoint( 2, pnt3, true );
  mitk::Point2D pnt4; pnt4[0] = 2.0; pnt4[1] = 0.0;
  figure1->SetControlPoint( 3, pnt4, true );
  figure1->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 191.25, 127.5);
}
コード例 #7
0
void mitkImageStatisticsCalculatorTestSuite::TestCase11()
{
  /*****************************
   * 9 whole pixels (white) + 3 half pixels (white)
   * + 3 whole pixel (black) [ + 3 slightly less than half pixels (black)]
   * -> mean of 204.0 expected
   ******************************/
  mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
  figure2->SetPlaneGeometry( m_Geometry );
  mitk::Point2D pnt1; pnt1[0] = 0.5; pnt1[1] = 0.5;
  figure2->PlaceFigure( pnt1 );

  mitk::Point2D pnt2; pnt2[0] = 3.5; pnt2[1] = 3.5;
  figure2->SetControlPoint( 1, pnt2, true );
  mitk::Point2D pnt3; pnt3[0] = 8.4999; pnt3[1] = 3.5;
  figure2->SetControlPoint( 2, pnt3, true );
  mitk::Point2D pnt4; pnt4[0] = 5.4999; pnt4[1] = 0.5;
  figure2->SetControlPoint( 3, pnt4, true );
  figure2->GetPolyLine(0);

  this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 204.0, 105.58 );
}
コード例 #8
0
ファイル: MSDM2_Component.cpp プロジェクト: MEPP-team/MEPP
	double MSDM2_Component::ProcessMSDM2_Multires(PolyhedronPtr m_PolyOriginal, PolyhedronPtr m_PolyDegrad,int NbLevel, double maxdim,double & FastMSDM, Curvature_ComponentPtr component_ptr_curvature)
{
	
	 
	double somme_MSDM2=0;
	int NbVertex=0;	

	Facet * TabMatchedFacet=new Facet[m_PolyDegrad->size_of_vertices()];

	Matching_Multires_Init(m_PolyDegrad, m_PolyOriginal,TabMatchedFacet);

	
	double RadiusCurvature=0.002;
	for (int i=0;i<NbLevel;i++)
	{
		m_PolyDegrad->set_index_vertices();

		component_ptr_curvature->principal_curvature(m_PolyOriginal,true,RadiusCurvature*maxdim);
		component_ptr_curvature->principal_curvature(m_PolyDegrad,true,RadiusCurvature*maxdim);
				
		KmaxKmean(m_PolyOriginal,maxdim);
		KmaxKmean(m_PolyDegrad,maxdim);

		Matching_Multires_Update(m_PolyDegrad,TabMatchedFacet);

		for(Vertex_iterator	pVertex	=	m_PolyDegrad->vertices_begin();
					pVertex	!= m_PolyDegrad->vertices_end();
					pVertex++)
		{
			

				std::vector<double>  TabDistance1;std::vector<double> TabDistance2;

				TabPoint1.clear();
				TabPoint2.clear();


				ProcessMSDM2_per_vertex(pVertex,RadiusCurvature*5*maxdim,TabDistance1,TabDistance2,TabPoint1,TabPoint2);
				ComputeStatistics((&(*pVertex)), 0.5,TabDistance1,TabDistance2,TabPoint1,TabPoint2,RadiusCurvature*5*maxdim,maxdim);	
				

		}


		RadiusCurvature+=0.001;

	}

	for(Vertex_iterator	pVertex	=	m_PolyDegrad->vertices_begin();
					pVertex	!= m_PolyDegrad->vertices_end();
					pVertex++)
		{
				somme_MSDM2+=pow(pVertex->MSDM2_Local/NbLevel,3);	
				NbVertex++;
	}
			

	FastMSDM=pow(somme_MSDM2/(double)NbVertex,0.33333);

	delete [] TabMatchedFacet;
	m_PolyDegrad->IsDistanceComputed=true;
	return 0;
}
コード例 #9
0
void mitkImageStatisticsCalculatorTestSuite::TestImageMaskingEmpty()
{
  mitk::Image::Pointer mask_image = mitk::ImageGenerator::GenerateImageFromReference<unsigned char>( m_Image, 0 );

  this->VerifyStatistics( ComputeStatistics( m_Image, mask_image ), 0.0, 0.0, 0.0);
}