#include <string>
#include <vector>
+#include <algorithm>
#include <math.h>
#include "itkImage.h"
itkSTMS::ParserOutputType* desc );
void GenerateImageSequence();
+ void GenerateCSVFile();
private:
// Attributes
"_Class_X-"+std::to_string((unsigned int)stmsParameters->spScales[0])+
"_Y-"+std::to_string((unsigned int)stmsParameters->spScales[1])+
"_Z-"+std::to_string((unsigned int)stmsParameters->spScales[2])+
- "_R-"+std::to_string(stmsParameters->rScale)+"_"+
+ "_R-"+std::to_string(stmsParameters->rScale)+
expDescription->outputImageExtension;
ClassWriterPointer classWriter
classWriter->SetFileName( classPath );
// Filetered image sequence and class image saving
- for( unsigned int i=1 ; i<=stmsParameters->numTimePoints - stmsParameters->startTimePoint + 1; ++i ){
-
+ for( unsigned int i=1 ; i<=stmsParameters->numTimePoints - stmsParameters->startTimePoint + 1; ++i )
+ {
char buffer[6];
int n;
}
}
+
+template < class ImageType, class ClassImageType>
+void
+itkSTMS_TemporalSetToImageSequence< ImageType, ClassImageType >
+::GenerateCSVFile()
+{
+ std::string CSVFilename = expDescription->experimentPath+expDescription->outputFolder+
+ expDescription->outputCommonRoot+
+ "_X-"+std::to_string((unsigned int)stmsParameters->spScales[0])+
+ "_Y-"+std::to_string((unsigned int)stmsParameters->spScales[1])+
+ "_Z-"+std::to_string((unsigned int)stmsParameters->spScales[2])+
+ "_R-"+std::to_string(stmsParameters->rScale)+".csv";
+
+ std::cout << "Writing CSV File (classID, nb of pixels, values of time serie), : " << CSVFilename << std::endl;
+ std::ofstream ofs;
+ ofs.open (CSVFilename.c_str(), std::ofstream::out | std::ofstream::trunc);
+
+ for(unsigned int j=0 ; j<rangeSet->size() ; ++j)
+ {
+ ofs << j+1 <<", " << std::count (classSet->begin(), classSet->end(), j+1);
+ for( unsigned int i=1 ; i<=stmsParameters->numTimePoints - stmsParameters->startTimePoint + 1; ++i )
+ ofs << ", " << rangeSet->at(j)[i-1]*stmsParameters->rScale ;
+ ofs << std::endl;
+ }
+
+ ofs.close();
+
+}
+
+
} // end of namespace itkSTMS
#endif
std::string maskImage;
std::string outputFolder;
std::string outputCommonRoot;
+ std::string outputCSV;
};
xmlParams.maskImage = "";
xmlParams.outputFolder = "";
xmlParams.outputCommonRoot = "";
+ xmlParams.outputCSV = "";
}
xmlParams.outputImageExtension = DomObject->GetAttribute( "outputImageExtension" );
if ( xmlParams.outputImageExtension == "" )
{
- std::cout << std::endl << std::endl << "outputImageExtension not found" << std::endl << std::endl;
+ std::cout << std::endl << std::endl << "outputImageExtension not set" << std::endl << std::endl;
std::exit( EXIT_FAILURE );
}
std::cout << std::endl << std::endl << "outputCommonRoot not found" << std::endl << std::endl;
std::exit( EXIT_FAILURE );
}
+
+ xmlParams.outputCSV = listOutput->GetAttribute( "outputCSV" );
+ if ( xmlParams.outputCSV == "" )
+ {
+ std::cout << std::endl << std::endl << "outputCSV not set: no CSV file will be created" << std::endl << std::endl;
+ }
+
}
} // end of namespace itkSTMS
#endif // itkSTMS_XMLFileParser_HXX
#include <iomanip>
#include <ctime>
-#define STMS_NUMBERING_FORM_ONE "01"
+#define STMS_NUMBERING_FORM_ONE "001"
#include "itkImage.h"
#include "itkSTMS_ArgumentsAnalysis.h"
preProcess->GetExperimentDescription());
postProcess->GenerateImageSequence();
+ if(preProcess->GetExperimentDescription()->outputCSV == "true" )
+ postProcess->GenerateCSVFile( );
dtime = gettime_hp()-dtime;
std::cout<<std::endl<< std::setw(30) << std::left << "Image sequence saving: " << dtime/1000 << " s" <<std::endl;
preProcess->GetExperimentDescription());
postProcess->GenerateImageSequence();
+ if(preProcess->GetExperimentDescription()->outputCSV == "true" )
+ postProcess->GenerateCSVFile();
dtime = gettime_hp()-dtime;
std::cout<<std::endl<< std::setw(30) << std::left << "Image sequence saving: " << dtime/1000 << " s" <<std::endl;