Applications/DTIAtlasFiberAnalyzer/DTIAtlasFiberAnalyzerguiwindow.cxx
/************************************************************************************
 * OpenPlotWindow : Get and calculate every data sample and call PlotWindow class
 * 	Data should be stored in a 4D vector as following :
 * 		1st dimension correspond to each fiber.
 * 		2nd dimension correspond to each data table. For case data, each case have
 * 			3 data table in this order: Value, Value+Std, Value-Std. For Atlas data
 * 			there are 4 tables : Value, Value+Std, Value-Std, Nb of fiber points.
 * 			For Stat data there are 3 tables: Cross Mean, Cross Mean+Cross Std,
 * 			Cross Mean-Cross Std.
 * 		3rd and 4th dimensions correspond to lines and columns of data samples.
 * THIS data structure does not take care correctly of multiple fiber properties
 ************************************************************************************/
OpenPlotWindow : Get and calculate every data sample and call PlotWindow class
Data should be stored in a 4D vector as following :
1st dimension correspond to each fiber.
2nd dimension correspond to each data table. For case data, each case have
3 data table in this order: Value, Value+Std, Value-Std. For Atlas data
there are 4 tables : Value, Value+Std, Value-Std, Nb of fiber points.
For Stat data there are 3 tables: Cross Mean, Cross Mean+Cross Std,
Cross Mean-Cross Std.
3rd and 4th dimensions correspond to lines and columns of data samples.
THIS data structure does not take care correctly of multiple fiber properties
OpenPlotWindow : Get and calculate every data sample and call PlotWindow class Data should be stored in a 4D vector as following : 1st dimension correspond to each fiber . 2nd dimension correspond to each data table . For case data each case have 3 data table in this order : Value Value + Std Value - Std . For Atlas data there are 4 tables : Value Value + Std Value - Std Nb of fiber points . For Stat data there are 3 tables : Cross Mean Cross Mean + Cross Std Cross Mean - Cross Std . 3rd and 4th dimensions correspond to lines and columns of data samples . THIS data structure does not take care correctly of multiple fiber properties
bool DTIAtlasFiberAnalyzerguiwindow::OpenPlotWindow()
{
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    std::cout<<"Begining of PlotWindow function..."<<std::endl;
    qv3double fiberdata;
    QVector <QVector <double> > data, temp;
    std::string casename,directory;
    m_PlotError=false;
    m_parameters.clear();
    m_casedata.clear();
    m_atlasdata.clear();
    m_statdata.clear();
    setCases();
    setFibers();
    directory=m_OutputFolder + "/Cases/"+m_Cases[0];
    setParamFromDirectory(directory,m_Fibers[0]);
    if(m_parameters.size()==0)
    {
        std::cout<<"parameters vector error"<<std::endl;
        QApplication::restoreOverrideCursor();
        return false;
    }
    for(unsigned int i=0; i<m_Fibers.size(); i++)
    {
        for(unsigned int j=0; j<m_Cases.size(); j++)
        {
            data=TableConversion(m_FiberProfile[i][j]);
            if(m_PlotError)
            {
                std::cout<<"Plot function canceled."<<std::endl;
                QApplication::restoreOverrideCursor();
                return false;
            }
            fiberdata.push_back(data);
            temp=getStdData(data, 1);
            fiberdata.push_back(temp);
            temp=getStdData(data, -1);
            fiberdata.push_back(temp);
        }
        m_casedata.push_back(fiberdata);
        fiberdata.clear();
        data=TableConversion(m_FiberProfile[i][m_FiberProfile[i].size()-2]);
        if(m_PlotError)
        {
            std::cout<<"Plot function canceled."<<std::endl;
            QApplication::restoreOverrideCursor();
            return false;
        }
        fiberdata.push_back(data);
        temp=getStdData(data, 1);
        fiberdata.push_back(temp);
        temp=getStdData(data, -1);
        fiberdata.push_back(temp);
        data=TableConversion(m_FiberProfile[i][m_FiberProfile[i].size()-1]);
        fiberdata.push_back(data);
        m_atlasdata.push_back(fiberdata);
        fiberdata.clear();
        data=getCrossMeanData(m_casedata[i]);
        fiberdata.push_back(data);
         + std
        temp=getCrossStdData(m_casedata[i], data, 1);
        fiberdata.push_back(temp);
         - std
        temp=getCrossStdData(m_casedata[i], data, -1);
        fiberdata.push_back(temp);
        m_statdata.push_back(fiberdata);
        fiberdata.clear();
    }    
    QApplication::restoreOverrideCursor();
    return true;
}
bool DTIAtlasFiberAnalyzerguiwindow :: OpenPlotWindow ( ) { QApplication :: setOverrideCursor ( QCursor ( Qt :: WaitCursor ) ) ; std :: cout << " " << std :: endl ; qv3double fiberdata ; QVector < QVector < double > > data , temp ; std :: string casename , directory ; m_PlotError = false ; m_parameters . clear ( ) ; m_casedata . clear ( ) ; m_atlasdata . clear ( ) ; m_statdata . clear ( ) ; setCases ( ) ; setFibers ( ) ; directory = m_OutputFolder + " " + m_Cases [ 0 ] ; setParamFromDirectory ( directory , m_Fibers [ 0 ] ) ; if ( m_parameters . size ( ) == 0 ) { std :: cout << " " << std :: endl ; QApplication :: restoreOverrideCursor ( ) ; return false ; } for ( unsigned int i = 0 ; i < m_Fibers . size ( ) ; i ++ ) { for ( unsigned int j = 0 ; j < m_Cases . size ( ) ; j ++ ) { data = TableConversion ( m_FiberProfile [ i ] [ j ] ) ; if ( m_PlotError ) { std :: cout << " " << std :: endl ; QApplication :: restoreOverrideCursor ( ) ; return false ; } fiberdata . push_back ( data ) ; temp = getStdData ( data , 1 ) ; fiberdata . push_back ( temp ) ; temp = getStdData ( data , -1 ) ; fiberdata . push_back ( temp ) ; } m_casedata . push_back ( fiberdata ) ; fiberdata . clear ( ) ; data = TableConversion ( m_FiberProfile [ i ] [ m_FiberProfile [ i ] . size ( ) - 2 ] ) ; if ( m_PlotError ) { std :: cout << " " << std :: endl ; QApplication :: restoreOverrideCursor ( ) ; return false ; } fiberdata . push_back ( data ) ; temp = getStdData ( data , 1 ) ; fiberdata . push_back ( temp ) ; temp = getStdData ( data , -1 ) ; fiberdata . push_back ( temp ) ; data = TableConversion ( m_FiberProfile [ i ] [ m_FiberProfile [ i ] . size ( ) - 1 ] ) ; fiberdata . push_back ( data ) ; m_atlasdata . push_back ( fiberdata ) ; fiberdata . clear ( ) ; data = getCrossMeanData ( m_casedata [ i ] ) ; fiberdata . push_back ( data ) ; temp = getCrossStdData ( m_casedata [ i ] , data , 1 ) ; fiberdata . push_back ( temp ) ; temp = getCrossStdData ( m_casedata [ i ] , data , -1 ) ; fiberdata . push_back ( temp ) ; m_statdata . push_back ( fiberdata ) ; fiberdata . clear ( ) ; } QApplication :: restoreOverrideCursor ( ) ; return true ; }
OpenPlotWindow : Get and calculate every data sample and call PlotWindow class
      Data should be stored in a 4D vector as following :
              1st dimension correspond to each fiber.
OpenPlotWindow : Get and calculate every data sample and call PlotWindow class Data should be stored in a 4D vector as following : 1st dimension correspond to each fiber .
//std::string filepath, filename; //Clear all relevant variables //Fill m_parameters, m_Cases, and m_Fibers vector //filename=m_Cases[j]+"_"+m_Fibers[i]+".fvp"; //filepath=m_OutputFolder+"/Cases/"+m_Cases[j]+"/"+filename; //std::cout << data.size() << "," << data[0].size() << "," << data[0][0] << "," << data[1][0] << std::endl; //Filling m_casedata with data samples + std //Filling m_casedata with data samples - std //filename=m_Fibers[i]; //filepath=m_OutputFolder+"/Fibers/" + filename + ".fvp"; //Filling m_atlasdata with data samples + std //Filling m_atlasdata with data samples - std //Filling m_atlasdata with nb of fiber points //Filling m_statdata with mean samples //Filling m_statdata with mean samples + std //Filling m_statdata with mean samples - std