コード例 #1
0
ファイル: wdocument.cpp プロジェクト: q4a/ananas-labs-qt4
/*!
 *\~english
 *\~russian
 *\~
 *\param - \~english \~russian \~
 */
void
wDocument::initObject( aDatabase *adb )
{
    aWidget::initObject( adb );
    QObject *obj;
    QObjectList lb = this->queryList( "wDBField" );
    QListIterator<QObject*> itb( lb ); // iterate over the buttons
    while ( itb.hasNext() )
    {
        obj = itb.next();
//		if ( (wActionButtton*) obj )->isActionUpdate() )
        connect( (wDBField *)obj, SIGNAL(valueChanged( const QVariant & )),
                 this, SLOT(valueChanged( const QVariant & )) );
    }
    //--delete lb; // delete the list, not the objects
    lb = this->queryList( "wDBTable" );
    QListIterator<QObject*> itb1( lb ); // iterate over the buttons
    while ( itb1.hasNext() )
    {
        obj = itb1.next();
//		if ( (wActionButtton*) obj )->isActionUpdate() )
        connect( this, SIGNAL(changeObj(const QString &)),
                 (wDBTable *)obj, SLOT(newFilter(const QString &)));
        connect( this, SIGNAL(changeObjId(const qulonglong)),
                 (wDBTable *)obj, SLOT(newDataId(const qulonglong)));
    }
    //--delete lb; // delete the list, not the objects
    //--focusData()->next()->setFocus();
    focusNextChild();
}
コード例 #2
0
void fillGraph_(Graph & graph, const Node & a, const Node & b, double slowness, SIndex leftID){
    if (a.id() == b.id()) return;

    double dist = a.pos().distance(b.pos());

    // ensure connection between 3d boundaries
    dist = max(1e-8, dist);

    double newTime = dist * slowness;
    double oldTime = graph[a.id()][b.id()].time();
    
    // if (V_){
    //     __MS("a:" << a.id() << " b:"  << b.id() << " L:" << leftID << " t:" << " " << newTime << " " << oldTime)
    // }

    if (oldTime > 0.0) {
        newTime = std::min(newTime, oldTime);

        // way pair already exist so set time to min and add leftID

        NodeDistMap::iterator ita(graph[a.id()].find(b.id()));
        ita->second.cellIDs().insert(leftID);
        ita->second.setTime(newTime);
        
        NodeDistMap::iterator itb(graph[b.id()].find(a.id()));
        itb->second.cellIDs().insert(leftID);
        itb->second.setTime(newTime);
        
    } else {
        // first time fill
        graph[a.id()][b.id()] = GraphDistInfo(newTime, dist, leftID);   
        graph[b.id()][a.id()] = GraphDistInfo(newTime, dist, leftID);    
    }
}
コード例 #3
0
PotentialValue operator-(const PotentialValue& a, const PotentialValue& b) {
	PotentialValue res ;
	for(PotentialValue::Iterator ita(a); ita; ita++)
		for(PotentialValue::Iterator itb(b); itb; itb++)
			res.insert(*ita - *itb ) ;
	return res ;
}
コード例 #4
0
//int itkHessian3DToVesselnessMeasureImageFilterTest(int, char* [] )
TEST(VertexnessTest, Regular) {


  // Define the dimension of the images
  const unsigned int myDimension = 3;

  // Declare the types of the images
  typedef itk::Image<float, myDimension>           myImageType;

  // Declare the type of the index to access images
  typedef itk::Index<myDimension>             myIndexType;

  // Declare the type of the size
  typedef itk::Size<myDimension>              mySizeType;

  // Declare the type of the Region
  typedef itk::ImageRegion<myDimension>        myRegionType;

  // Create the image
  myImageType::Pointer inputImage  = myImageType::New();


  // Define their size, and start index
  mySizeType size;
  size[0] = 16;
  size[1] = 16;
  size[2] = 16;

  myIndexType start;
  start.Fill(0);

  myRegionType region;
  region.SetIndex( start );
  region.SetSize( size );

  // Initialize Image A
  inputImage->SetLargestPossibleRegion( region );
  inputImage->SetBufferedRegion( region );
  inputImage->SetRequestedRegion( region );
  inputImage->Allocate();

  // Declare Iterator type for the input image
  typedef itk::ImageRegionIteratorWithIndex<myImageType>  myIteratorType;

  // Create one iterator for the Input Image A (this is a light object)
  myIteratorType it( inputImage, inputImage->GetRequestedRegion() );

  // Initialize the content of Image A
   while( !it.IsAtEnd() )
     {
     it.Set( 0.0 );
     ++it;
     }

   size[0] = 1;
   size[1] = 8;
   size[2] = 1;

   start[0] = 3;
   start[1] = 0;
   start[2] = 3;

   // Create one iterator for an internal region
   region.SetSize( size );
   region.SetIndex( start );
   myIteratorType itb( inputImage, region );

   // Initialize the content the internal region
   while( !itb.IsAtEnd() )
     {
     itb.Set( 100.0 );
     ++itb;
     }

   typedef ttt::VertexnessMeasurementFunction<double> VertexnessFunctionType;
   typedef ttt::MultiScaleHessianSmoothed3DToObjectnessMeasureImageFilter<VertexnessFunctionType,myImageType> VertexnessFilterType;

   VertexnessFunctionType::Pointer vertexnessFunction = VertexnessFunctionType::New();

   VertexnessFilterType::Pointer filter = VertexnessFilterType::New();

   filter->SetInput(inputImage);
   filter->SetSigmaMin(0.0001);
   filter->SetSigmaMax(0.5);
   filter->SetNumberOfSigmaSteps(5);
   filter->SetObjectnessMeasurementFunction(vertexnessFunction);
   filter->Update();

   return EXIT_SUCCESS;
}