idx = 0;
char buffer[6];
- int n = 0;
+ // int n = 0; // used to debug sprintf : n = sprintf( ...
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 6 ) n=sprintf (buffer, "%05d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 5 ) n=sprintf (buffer, "%04d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 4 ) n=sprintf (buffer, "%03d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 3 ) n=sprintf (buffer, "%02d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 2 ) n=sprintf (buffer, "%01d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 6 ) sprintf (buffer, "%05d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 5 ) sprintf (buffer, "%04d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 4 ) sprintf (buffer, "%03d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 3 ) sprintf (buffer, "%02d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 2 ) sprintf (buffer, "%01d", i + stmsParameters->startTimePoint - 1);
std::string imagePath = expDescription->experimentPath+expDescription->inputFolder+expDescription->inputCommonRoot+buffer+expDescription->imageExtension;
- ImagePointer image
- = ImageType::New();
- ReaderPointer reader
- = itk::ImageFileReader< ImageType >::New();
+ ImagePointer image = ImageType::New();
+ ReaderPointer reader = itk::ImageFileReader< ImageType >::New();
reader->SetFileName( imagePath );
reader->Update();
for( unsigned int i=1 ; i<=stmsParameters->numTimePoints - stmsParameters->startTimePoint + 1; ++i )
{
char buffer[6];
- int n;
+ // int n;
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 6 ) n=sprintf (buffer, "%05d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 5 ) n=sprintf (buffer, "%04d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 4 ) n=sprintf (buffer, "%03d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 3 ) n=sprintf (buffer, "%02d", i + stmsParameters->startTimePoint - 1);
- if( sizeof(STMS_NUMBERING_FORM_ONE) == 2 ) n=sprintf (buffer, "%01d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 6 ) sprintf( buffer, "%05d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 5 ) sprintf( buffer, "%04d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 4 ) sprintf( buffer, "%03d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 3 ) sprintf( buffer, "%02d", i + stmsParameters->startTimePoint - 1);
+ if( sizeof(STMS_NUMBERING_FORM_ONE) == 2 ) sprintf( buffer, "%01d", i + stmsParameters->startTimePoint - 1);
outputPath = expDescription->experimentPath+expDescription->outputFolder+
expDescription->outputCommonRoot+
"_R-"+std::to_string(stmsParameters->rScale)+"_"+
buffer+expDescription->outputImageExtension;
- ImagePointer outImage
- = ImageType::New();
-
+ ImagePointer outImage = ImageType::New();
outImage->SetRegions( region );
outImage->Allocate();
outImage->FillBuffer( 15.0 );
- WriterPointer writer
- = WriterType::New();
+ WriterPointer writer = WriterType::New();
writer->SetFileName( outputPath );
//#pragma omp parrallel for ...
"_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::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 << delimiter << std::count (classSet->begin(), classSet->end(), j+1);
+ ofs << delimiter << stmsParameters->startTimePoint << delimiter << stmsParameters->numTimePoints;
for( unsigned int i=1 ; i<=stmsParameters->numTimePoints - stmsParameters->startTimePoint + 1; ++i )
ofs << delimiter << rangeSet->at(j)[i-1]*stmsParameters->rScale ;
ofs << std::endl;
#ifndef itkSTMS_BlurringSTMS_TXX
#define itkSTMS_BlurringSTMS_TXX
+#include <limits>
#include <random>
#include <algorithm>
#include <iterator>
itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType >
::FinalMerging()
{
- unsigned int size = INFINITY;
+ unsigned int size = std::numeric_limits<unsigned int>::max() - 1; // INFINITY;
std::string imagePath = expDescription->experimentPath+expDescription->inputFolder+expDescription->inputCommonRoot+STMS_NUMBERING_FORM_ONE+expDescription->imageExtension;
while(size > classSet->size()){
idx[0] = refClass->at(m)[0]+x;
idx[1] = refClass->at(m)[1]+y;
- if(idx[0]<image->GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]<image->GetBufferedRegion().GetSize()[1] && idx[1]>0)
+ if( ( idx[0] < static_cast<long>(image->GetBufferedRegion().GetSize()[0]) ) && (idx[0]>0)
+ && (idx[1] < static_cast<long>(image->GetBufferedRegion().GetSize()[1]) ) && (idx[1]>0) )
{
if(image->GetPixel(idx) == 2)
{
idx[0] = candClass->at(m)[0]+x;
idx[1] = candClass->at(m)[1]+y;
- if(idx[0]<image->GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]<image->GetBufferedRegion().GetSize()[1] && idx[1]>0)
+ if( ( idx[0] < static_cast<long>(image->GetBufferedRegion().GetSize()[0]) ) && ( idx[0] > 0 )
+ && ( idx[1] < static_cast<long>(image->GetBufferedRegion().GetSize()[1]) ) && ( idx[1] > 0 ) )
{
if(image->GetPixel(idx) == 1)
{
idx[1] = refClass->at(m)[1]+y;
idx[2] = refClass->at(m)[2]+z;
- if(idx[0]<image->GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]<image->GetBufferedRegion().GetSize()[1] && idx[1]>0 && idx[2]<image->GetBufferedRegion().GetSize()[2] && idx[2]>0)
+ if( ( idx[0] < static_cast<long>(image->GetBufferedRegion().GetSize()[0]) ) && (idx[0] > 0) &&
+ ( idx[1] < static_cast<long>(image->GetBufferedRegion().GetSize()[1]) ) && (idx[1] > 0) &&
+ ( idx[2] < static_cast<long>(image->GetBufferedRegion().GetSize()[2]) ) && (idx[2] > 0) )
{
if(image->GetPixel(idx) == 2)
{
idx[1] = candClass->at(m)[1]+y;
idx[2] = candClass->at(m)[2]+z;
- if(idx[0]<image->GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]<image->GetBufferedRegion().GetSize()[1] && idx[1]>0 && idx[2]<image->GetBufferedRegion().GetSize()[2] && idx[2]>0)
+ if( ( idx[0] < static_cast<long>(image->GetBufferedRegion().GetSize()[0]) ) && ( idx[0] > 0 ) &&
+ ( idx[1] < static_cast<long>(image->GetBufferedRegion().GetSize()[1]) ) && ( idx[1] > 0 ) &&
+ ( idx[2] < static_cast<long>(image->GetBufferedRegion().GetSize()[2]) ) && ( idx[2] > 0 ) )
{
if(image->GetPixel(idx) == 1)
{
#include <iomanip>
#include <ctime>
-#define STMS_NUMBERING_FORM_ONE "001"
+#define STMS_NUMBERING_FORM_ONE "01"
#include "itkImage.h"
#include "itkSTMS_ArgumentsAnalysis.h"