diff --git a/stackviz/MainWindow.cpp b/stackviz/MainWindow.cpp index b3d3283b63fcee429edc63284fd9c89e5c15cd74..e6d41a5339f299e471c9fa92611a83375e2cb55a 100644 --- a/stackviz/MainWindow.cpp +++ b/stackviz/MainWindow.cpp @@ -157,6 +157,31 @@ void MainWindow::openHDF5File( const std::string& networkFile, _player = player; configurePlayer( ); + + std::vector< unsigned int > sizes = { 300, 4000, 9 }; + std::vector< uint32_t > artGIDs; + + unsigned int offset = 0; + for( auto csize : sizes ) + { + artGIDs.clear( ); + artGIDs.resize( csize ); + unsigned int last = 0; + for( unsigned int i = 0; i < csize; i++ ) + { + last = i + offset; + artGIDs[ i ] = last; + + } + visimpl::Selection selection; + selection.gids.insert( artGIDs.begin( ), artGIDs.end( )); + + _summary->AddNewHistogram( selection ); + + std::cout << "Selection: " << last << " - " << offset << std::endl; + + offset = last; + } } void MainWindow::configurePlayer( void ) diff --git a/sumrice/Summary.cpp b/sumrice/Summary.cpp index a476c6051040f32b12f7d83aefc28806a5ada86e..ef5b6d0f76928015eab2e3c41bfa344bcfd8bf30 100644 --- a/sumrice/Summary.cpp +++ b/sumrice/Summary.cpp @@ -356,34 +356,12 @@ void Summary::AddNewHistogram( const visimpl::Selection& selection _pendingSelections.push_back( selection ); -// if( !_insertionTimer.isActive( )) -// _insertionTimer.start( ); - } else #endif { - visimpl::MultiLevelHistogram* histogram = new visimpl::MultiLevelHistogram( *_spikeReport ); -// histogram->filteredGIDs( gids ); - histogram->colorMapper( _mainHistogram->colorMapper( )); -// histogram->colorScale( visimpl::Histogram::T_COLOR_EXPONENTIAL ); -// histogram->normalizeRule( visimpl::Histogram::T_NORM_MAX ); -// histogram->mousePosition( &_lastMousePosition ); - histogram->setMinimumHeight( _heightPerRow ); - histogram->setMaximumHeight( _heightPerRow ); -// histogram->setMinimumWidth( 500 ); - std::cout << "Thread " << this->thread( ) << std::endl; - _mainLayout->addWidget( histogram, _histograms.size( ), 0, _maxColumns - 2, 1 ); -// _mainLayout->addWidget( histogram ); - _histograms.push_back( histogram ); - - histogram->init( _bins, _zoomFactor ); -// CreateSummarySpikes( ); -// UpdateGradientColors( ); - - update( ); - + InsertSummary( selection ); } } @@ -398,86 +376,88 @@ void Summary::deferredInsertion( void ) if( _pendingSelections.size( ) > 0 ) { - StackRow currentRow; visimpl::Selection selection = _pendingSelections.front( ); _pendingSelections.pop_front( ); - QString labelText = - QString( "Selection-").append( QString::number( selection.id )); - - bool ok = true; - if ( !_autoNameSelection ) - labelText = QInputDialog::getText( this, - tr( "Selection Name" ), - tr( "Please, introduce selection name: "), - QLineEdit::Normal, - labelText, - &ok ); - if( !ok ) - return; - - std::cout << "Deferred insertion: " << selection.name - << " GIDs: " << selection.gids.size( ) - << std::endl; - - visimpl::MultiLevelHistogram* histogram = new visimpl::MultiLevelHistogram( *_spikeReport ); - histogram->filteredGIDs( selection.gids ); - histogram->colorMapper( _mainHistogram->colorMapper( )); - histogram->colorScaleLocal( _colorScaleLocal ); - histogram->colorScaleGlobal( _colorScaleGlobal ); - histogram->colorLocal( _colorLocal ); - histogram->colorGlobal( _colorGlobal ); - histogram->normalizeRule( visimpl::T_NORM_MAX ); - histogram->representationMode( visimpl::T_REP_CURVE ); - histogram->regionWidth( _regionWidth ); - histogram->gridLinesNumber( _gridLinesNumber ); + InsertSummary( selection ); + } - histogram->setMinimumHeight( _heightPerRow ); - histogram->setMaximumHeight( _heightPerRow ); - // histogram->setMinimumWidth( 500 ); +} - currentRow.histogram = histogram; - currentRow.label = new QLabel( labelText ); - currentRow.checkBox = new QCheckBox( ); +#endif - unsigned int row = _histograms.size( ); - _mainLayout->addWidget( currentRow.label, row , 0, 1, 1 ); - _mainLayout->addWidget( histogram, row, 1, 1, _summaryColumns ); - _mainLayout->addWidget( currentRow.checkBox, row, _maxColumns - 1, 1, 1 ); +void Summary::InsertSummary( const visimpl::Selection& selection ) +{ + StackRow currentRow; - _rows.push_back( currentRow ); + QString labelText = + QString( "Selection-").append( QString::number( selection.id )); - histogram->mousePosition( &_lastMousePosition ); - histogram->regionPosition( &_regionGlobalPosition ); + bool ok = true; + if ( !_autoNameSelection ) + labelText = QInputDialog::getText( this, + tr( "Selection Name" ), + tr( "Please, introduce selection name: "), + QLineEdit::Normal, + labelText, + &ok ); + if( !ok ) + return; - connect( histogram, SIGNAL( mousePositionChanged( QPoint )), - this, SLOT( updateMouseMarker( QPoint ))); + std::cout << "Deferred insertion: " << selection.name + << " GIDs: " << selection.gids.size( ) + << std::endl; - connect( histogram, SIGNAL( mousePressed( QPoint, float )), - this, SLOT( childHistogramPressed( QPoint, float ))); + visimpl::MultiLevelHistogram* histogram = new visimpl::MultiLevelHistogram( *_spikeReport ); + histogram->filteredGIDs( selection.gids ); + histogram->colorMapper( _mainHistogram->colorMapper( )); + histogram->colorScaleLocal( _colorScaleLocal ); + histogram->colorScaleGlobal( _colorScaleGlobal ); + histogram->colorLocal( _colorLocal ); + histogram->colorGlobal( _colorGlobal ); + histogram->normalizeRule( visimpl::T_NORM_MAX ); + histogram->representationMode( visimpl::T_REP_CURVE ); + histogram->regionWidth( _regionWidth ); + histogram->gridLinesNumber( _gridLinesNumber ); - connect( histogram, SIGNAL( mouseReleased( QPoint, float )), - this, SLOT( childHistogramReleased( QPoint, float ))); + histogram->setMinimumHeight( _heightPerRow ); + histogram->setMaximumHeight( _heightPerRow ); + // histogram->setMinimumWidth( 500 ); - connect( histogram, SIGNAL( mouseModifierPressed( float, Qt::KeyboardModifiers )), - this, SLOT( childHistogramClicked( float, Qt::KeyboardModifiers ))); + currentRow.histogram = histogram; + currentRow.label = new QLabel( labelText ); + currentRow.checkBox = new QCheckBox( ); - _histograms.push_back( histogram ); + unsigned int row = _histograms.size( ); + _mainLayout->addWidget( currentRow.label, row , 0, 1, 1 ); + _mainLayout->addWidget( histogram, row, 1, 1, _summaryColumns ); + _mainLayout->addWidget( currentRow.checkBox, row, _maxColumns - 1, 1, 1 ); - histogram->init( _bins, _zoomFactor ); -// CreateSummarySpikes( ); -// UpdateGradientColors( ); + _rows.push_back( currentRow ); - GIDUSet tmp; - histogram->filteredGIDs( tmp ); + histogram->mousePosition( &_lastMousePosition ); + histogram->regionPosition( &_regionGlobalPosition ); - update( ); - } + connect( histogram, SIGNAL( mousePositionChanged( QPoint )), + this, SLOT( updateMouseMarker( QPoint ))); + + connect( histogram, SIGNAL( mousePressed( QPoint, float )), + this, SLOT( childHistogramPressed( QPoint, float ))); + + connect( histogram, SIGNAL( mouseReleased( QPoint, float )), + this, SLOT( childHistogramReleased( QPoint, float ))); + + connect( histogram, SIGNAL( mouseModifierPressed( float, Qt::KeyboardModifiers )), + this, SLOT( childHistogramClicked( float, Qt::KeyboardModifiers ))); + + _histograms.push_back( histogram ); + histogram->init( _bins, _zoomFactor ); + + update( ); } -#endif int pixelMargin = 10; diff --git a/sumrice/Summary.h b/sumrice/Summary.h index e84c179ccfc850318d95e19a1d5c1d63d289b8eb..df5d7213beb0953e9f30690b2d3117b5a8bc58f5 100644 --- a/sumrice/Summary.h +++ b/sumrice/Summary.h @@ -167,7 +167,7 @@ protected: void Init( void ); void CreateSummarySpikes( ); - void InsertSummarySpikes( const GIDUSet& gids ); + void InsertSummary( const visimpl::Selection& selection ); // void CreateSummaryVoltages( void ); void UpdateGradientColors( bool replace = false );