void QmitkTbssRoiAnalysisWidget::DrawProfiles() { std::vector <std::vector<mitk::ScalarType> > groupProfiles = CalculateGroupProfiles(); Plot(groupProfiles); }
void QmitkTbssRoiAnalysisWidget::DrawProfiles(std::string preprocessed) { this->Clear(); m_Vals.clear(); std::vector<double> v1; std::vector <std::vector<double> > groupProfiles = CalculateGroupProfiles(preprocessed); std::vector<double> xAxis; for(int i=0; i<groupProfiles.at(0).size(); ++i) { xAxis.push_back((double)i); } // fill m_Vals. This might be used by the user to copy data to the clipboard for(int i=0; i<groupProfiles.size(); i++) { v1.clear(); for(int j=0; j<groupProfiles.at(i).size(); j++) { v1.push_back(groupProfiles.at(i).at(j)); } m_Vals.push_back(v1); } std::string title = m_Measure + " profiles on the "; title.append(m_Structure); this->SetPlotTitle( title.c_str() ); QPen pen( Qt::SolidLine ); pen.setWidth(2); std::vector< std::pair<std::string, int> >::iterator it; it = m_Groups.begin(); int c = 0; //the current profile number QColor colors[4] = {Qt::green, Qt::blue, Qt::yellow, Qt::red}; while(it != m_Groups.end() && groupProfiles.size() > 0) { std::pair< std::string, int > group = *it; pen.setColor(colors[c]); int curveId = this->InsertCurve( group.first.c_str() ); this->SetCurveData( curveId, xAxis, groupProfiles.at(c) ); this->SetCurvePen( curveId, pen ); c++; it++; } QwtLegend *legend = new QwtLegend; this->SetLegend(legend, QwtPlot::RightLegend, 0.5); std::cout << m_Measure << std::endl; this->m_Plot->setAxisTitle(0, m_Measure.c_str()); this->m_Plot->setAxisTitle(3, "Position"); this->Replot(); }