// -----------------------------------------------------------------------------
// CSvgTimeContainer::UserSeek
// Called to handle user/client generated seek event
// -----------------------------------------------------------------------------
//
void CSvgTimeContainer::UserSeek( 
    TInt aTime ) // Time in msecs to seek
    {
    if ( iTimer )
        {
        //if ( iOwnerDoc && iCurrentTime != aTime )
        if ( iOwnerDoc)
            {
            iCurrentTime = aTime;
            iCurrentTick.iParentTcTick = aTime;
            iCurrentTick.iRealTimeTick = aTime;
            TSvgTimerEvent timeEvent( iCurrentTime );
            iOwnerDoc->Reset( &timeEvent );
            }            

        iTimer->SetSeekTime( aTime );
        }
    // Need to send user resume events to timed entities
    SetUserState(ESvgUserRunning);
    TInt lTimedEntityListCnt = iTcTimedEntities.Count();
    for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
    	{
		UserResumeElement( &iTcTimedEntities[ lItemIndex ] );
    	}
    
    UserResumeElement(&iLrteListItem);
    }
void QmitkImageStatisticsView::JumpToCoordinates(int row ,int col)
{
  if(m_SelectedDataNodes.isEmpty())
  {
    MITK_WARN("QmitkImageStatisticsView") << "No data node selected for statistics calculation." ;
    return;
  }

  mitk::Point3D world;
  if (row==4 && !m_WorldMinList.empty())
    world = m_WorldMinList[col];
  else if (row==3 && !m_WorldMaxList.empty())
    world = m_WorldMaxList[col];
  else
    return;

  mitk::IRenderWindowPart* part = this->GetRenderWindowPart();
  if (part)
  {
    part->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SelectSliceByPoint(world);
    part->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SelectSliceByPoint(world);
    part->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SelectSliceByPoint(world);

    mitk::SliceNavigationController::GeometryTimeEvent timeEvent(this->m_SelectedImage->GetTimeGeometry(), col);
    part->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetGeometryTime(timeEvent);
  }
}
// -----------------------------------------------------------------------------
// CSvgTimeContainer::UserPlay
// Called to handle user/client generated play event
// -----------------------------------------------------------------------------
//
void CSvgTimeContainer::UserPlay()
    {

    
    if ( !iTimer )
        {
        // Check whether this time container has a parent
        // then we do not have to create the timer
        if ( !iIsParentTcPresent )
            {
            // Obtain the post order list of media elements 
             RPointerArray<CSvgElementImpl> lMediaEleList;
            lMediaEleList.Reset(); 
            
            CSvgElementImpl *handle = (CSvgElementImpl *)(iOwnerDoc->RootElement());
            
            //Parse postorderr only if there are media elements
            if(iTcTimedEntities.Count() > 1 )
            {
              iOwnerDoc->ParsePostOrderMediaElements( handle, lMediaEleList );    
            }
            
            
            // Rearrange as per Post order
            RearrangeTimedEntityList( lMediaEleList );
            
            // Done with the list
            lMediaEleList.Close();  
            
            TRAPD( lTimerCreateErr, iTimer = CSvgTimer::NewL( this ) );
            
            if ( lTimerCreateErr != KErrNone )
                {
                // Error Processing
                return;
                }
            
            iTimer->SetStartTime();
            
            // the current home time needs to be updated.
            if ( iOwnerDoc && iCurrentTime != 0 )
                {
                iCurrentTime = 0;
                iCurrentTick.iParentTcTick = 0;
                iCurrentTick.iRealTimeTick = 0;
                TSvgTimerEvent timeEvent( iCurrentTime );
                iOwnerDoc->Reset( &timeEvent );
                }            

            if ( !iTimer->IsActive() )
                {
                iTimer->After( 1000 );
                }           
            }
        }
    }
Exemple #4
0
BallDialog ::BallDialog( int _rad, int _vx, int _vy ){
    xradius = _rad;
    yradius = _rad;
    radius = _rad;
    setMinimumSize(4*radius,4*radius);
    vx = _vx;
    vy = _vy;
    p = new QPainter();
    bTimer = new QTimer(this);
    connect( bTimer, SIGNAL(timeout()), this, SLOT( timeEvent()) );
    bTimer->start( 20 );
    x = width()/2;
    y = height()/2;
}
Exemple #5
0
	ARPAnnounce::ARPAnnounce(ARP *arp, const QHostAddress &ip)
	: ARPTimer(arp), m_ip(ip), m_remaining_announces(ARPConst::ANNOUNCE_NUM) {
		timeEvent();
	}
Exemple #6
0
	ARPRequest::ARPRequest(ARP *arp, const QHostAddress &sourceip, const QHostAddress &targetip)
	: ARPTimer(arp, Time()), m_sourceip(sourceip), m_targetip(targetip), m_remaining_trys(ARPConst::PROBE_NUM), m_finished(false) {
		timeEvent();
	}
Exemple #7
0
void Game::schedule(float timeOffset, TimeListener* timeListener, void* cookie)
{
    GP_ASSERT(_timeEvents);
    TimeEvent timeEvent(getGameTime() + timeOffset, timeListener, cookie);
    _timeEvents->push(timeEvent);
}
void QmitkImageStatisticsView::FillStatisticsTableView(
    const std::vector<mitk::ImageStatisticsCalculator::Statistics> &s,
    const mitk::Image *image )
{
  this->m_Controls->m_StatisticsTable->setColumnCount(image->GetTimeSteps());
  this->m_Controls->m_StatisticsTable->horizontalHeader()->setVisible(image->GetTimeSteps() > 1);

  // Set Checkbox for complete copy of statistic table
  if(image->GetTimeSteps()>1)
  {
    this->m_Controls->m_CheckBox4dCompleteTable->setEnabled(true);
  }
  else
  {
    this->m_Controls->m_CheckBox4dCompleteTable->setEnabled(false);
    this->m_Controls->m_CheckBox4dCompleteTable->setChecked(false);
  }
  int decimals = 2;

  mitk::PixelType doublePix = mitk::MakeScalarPixelType< double >();
  mitk::PixelType floatPix = mitk::MakeScalarPixelType< float >();
  if (image->GetPixelType()==doublePix || image->GetPixelType()==floatPix)
  {
    decimals = 5;
  }

  for (unsigned int t = 0; t < image->GetTimeSteps(); t++)
  {
    this->m_Controls->m_StatisticsTable->setHorizontalHeaderItem(t,
        new QTableWidgetItem(QString::number(t)));

    if (s[t].GetMaxIndex().size()==3)
    {
      mitk::Point3D index, max, min;
      index[0] = s[t].GetMaxIndex()[0];
      index[1] = s[t].GetMaxIndex()[1];
      index[2] = s[t].GetMaxIndex()[2];
      m_SelectedImage->GetGeometry()->IndexToWorld(index, max);
      this->m_WorldMaxList.push_back(max);
      index[0] = s[t].GetMinIndex()[0];
      index[1] = s[t].GetMinIndex()[1];
      index[2] = s[t].GetMinIndex()[2];
      m_SelectedImage->GetGeometry()->IndexToWorld(index, min);
      this->m_WorldMinList.push_back(min);
    }

    this->m_Controls->m_StatisticsTable->setItem( 0, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetMean(), 0, 'f', decimals) ) );
    this->m_Controls->m_StatisticsTable->setItem( 1, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetMedian(), 0, 'f', decimals) ) );
    this->m_Controls->m_StatisticsTable->setItem( 2, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetSigma(), 0, 'f', decimals) ) );
    this->m_Controls->m_StatisticsTable->setItem( 3, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetRMS(), 0, 'f', decimals) ) );

    QString max; max.append(QString("%1").arg(s[t].GetMax(), 0, 'f', decimals));
    max += " (";
    for (int i=0; i<s[t].GetMaxIndex().size(); i++)
    {
      max += QString::number(s[t].GetMaxIndex()[i]);
      if (i<s[t].GetMaxIndex().size()-1)
        max += ",";
    }
    max += ")";
    this->m_Controls->m_StatisticsTable->setItem( 4, t, new QTableWidgetItem( max ) );

    QString min; min.append(QString("%1").arg(s[t].GetMin(), 0, 'f', decimals));
    min += " (";
    for (int i=0; i<s[t].GetMinIndex().size(); i++)
    {
      min += QString::number(s[t].GetMinIndex()[i]);
      if (i<s[t].GetMinIndex().size()-1)
        min += ",";
    }
    min += ")";
    this->m_Controls->m_StatisticsTable->setItem( 5, t, new QTableWidgetItem( min ) );

    this->m_Controls->m_StatisticsTable->setItem( 6, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetN()) ) );

    const mitk::BaseGeometry *geometry = image->GetGeometry();
    if ( geometry != NULL )
    {
      const mitk::Vector3D &spacing = image->GetGeometry()->GetSpacing();
      double volume = spacing[0] * spacing[1] * spacing[2] * (double) s[t].GetN();
      this->m_Controls->m_StatisticsTable->setItem( 7, t, new QTableWidgetItem(
          QString("%1").arg(volume, 0, 'f', decimals) ) );
    }
    else
    {
      this->m_Controls->m_StatisticsTable->setItem( 7, t, new QTableWidgetItem(
          "NA" ) );
    }

    //statistics of higher order should have 5 decimal places because they used to be very small
    this->m_Controls->m_StatisticsTable->setItem( 8, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetSkewness(), 0, 'f', 5) ) );

    this->m_Controls->m_StatisticsTable->setItem( 9, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetKurtosis(), 0, 'f', 5) ) );

    this->m_Controls->m_StatisticsTable->setItem( 10, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetUniformity(), 0, 'f', 5) ) );

    this->m_Controls->m_StatisticsTable->setItem( 11, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetEntropy(), 0, 'f', 5) ) );

    this->m_Controls->m_StatisticsTable->setItem( 12, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetMPP(), 0, 'f', decimals) ) );

    this->m_Controls->m_StatisticsTable->setItem( 13, t, new QTableWidgetItem(
        QString("%1").arg(s[t].GetUPP(), 0, 'f', 5) ) );

  }


  this->m_Controls->m_StatisticsTable->resizeColumnsToContents();
  int height = STAT_TABLE_BASE_HEIGHT;

  if (this->m_Controls->m_StatisticsTable->horizontalHeader()->isVisible())
    height += this->m_Controls->m_StatisticsTable->horizontalHeader()->height();

  if (this->m_Controls->m_StatisticsTable->horizontalScrollBar()->isVisible())
    height += this->m_Controls->m_StatisticsTable->horizontalScrollBar()->height();

  this->m_Controls->m_StatisticsTable->setMinimumHeight(height);

  // make sure the current timestep's column is highlighted (and the correct histogram is displayed)
  unsigned int t = this->GetRenderWindowPart()->GetTimeNavigationController()->GetTime()->
      GetPos();
  mitk::SliceNavigationController::GeometryTimeEvent timeEvent(this->m_SelectedImage->GetTimeGeometry(),
      t);
  this->OnTimeChanged(timeEvent);

  t = std::min(image->GetTimeSteps() - 1, t);

  // See bug 18340
  /*QString hotspotMean; hotspotMean.append(QString("%1").arg(s[t].GetHotspotStatistics().GetMean(), 0, 'f', decimals));
  hotspotMean += " (";
  for (int i=0; i<s[t].GetHotspotIndex().size(); i++)
  {
  hotspotMean += QString::number(s[t].GetHotspotIndex()[i]);
  if (i<s[t].GetHotspotIndex().size()-1)
  hotspotMean += ",";
  }
  hotspotMean += ")";

  this->m_Controls->m_StatisticsTable->setItem( 7, t, new QTableWidgetItem( hotspotMean ) );

  QString hotspotMax; hotspotMax.append(QString("%1").arg(s[t].GetHotspotStatistics().GetMax(), 0, 'f', decimals));
  hotspotMax += " (";
  for (int i=0; i<s[t].GetHotspotStatistics().GetMaxIndex().size(); i++)
  {
  hotspotMax += QString::number(s[t].GetHotspotStatistics().GetMaxIndex()[i]);
  if (i<s[t].GetHotspotStatistics().GetMaxIndex().size()-1)
  hotspotMax += ",";
  }
  hotspotMax += ")";

  this->m_Controls->m_StatisticsTable->setItem( 8, t, new QTableWidgetItem( hotspotMax ) );

  QString hotspotMin; hotspotMin.append(QString("%1").arg(s[t].GetHotspotStatistics().GetMin(), 0, 'f', decimals));
  hotspotMin += " (";
  for (int i=0; i<s[t].GetHotspotStatistics().GetMinIndex().size(); i++)
  {
  hotspotMin += QString::number(s[t].GetHotspotStatistics().GetMinIndex()[i]);
  if (i<s[t].GetHotspotStatistics().GetMinIndex().size()-1)
  hotspotMin += ",";
  }
  hotspotMin += ")";

  this->m_Controls->m_StatisticsTable->setItem( 9, t, new QTableWidgetItem( hotspotMin ) );*/
}