diff --git a/Code/BasicFilters/otbFrostImageFilter.h b/Code/BasicFilters/otbFrostImageFilter.h index f40e04eed8dc2acbc11464dcd737a778328ecf86..49a3bba53ccef04f27146bea2b20ade81b93f4d7 100644 --- a/Code/BasicFilters/otbFrostImageFilter.h +++ b/Code/BasicFilters/otbFrostImageFilter.h @@ -47,12 +47,21 @@ template <class TInputImage, class TOutputImage> class ITK_EXPORT FrostImageFilter : public itk::ImageToImageFilter< TInputImage, TOutputImage > { public: + /** Extrait les dimensions aussi bien des images + d'entrée (Input) que de sortie (Output). */ + itkStaticConstMacro( InputImageDimension, + unsigned int, + TInputImage::ImageDimension); + itkStaticConstMacro( OutputImageDimension, + unsigned int, + TOutputImage::ImageDimension); - /** Some Image related typedefs. */ + /** "typedef" pour simplifier la définition et la déclaration de variables. */ typedef TInputImage InputImageType; + /** "typedef" pour simplifier la définition et la déclaration de variables. */ typedef TOutputImage OutputImageType; - /** Standard class typedefs. */ + /** "typedef" pour les classes standards. */ typedef FrostImageFilter Self; typedef itk::ImageToImageFilter< InputImageType, OutputImageType> Superclass; typedef itk::SmartPointer<Self> Pointer; @@ -61,7 +70,7 @@ public: /** Methode pour la gestion "object factory". */ itkNewMacro(Self); - /** Run-time type information (and related methods). */ + /** Retourne le nom de la classe. */ itkTypeMacro(FrostImageFilter, ImageToImageFilter); /** Définition des images supportées. */ @@ -76,15 +85,6 @@ public: /** "typedef" définissant la taille d'une image. */ typedef typename InputImageType::SizeType SizeType; - /** ImageDimension constants */ - itkStaticConstMacro( InputImageDimension, - unsigned int, - TInputImage::ImageDimension); - itkStaticConstMacro( OutputImageDimension, - unsigned int, - TOutputImage::ImageDimension); - - /** Positionne le rayon définissant le voisinage utilisé pour le calcul du filtre. */ itkSetMacro(Radius, SizeType); diff --git a/Code/ChangeDetection/otbCorrelationChangeDetector.h b/Code/ChangeDetection/otbCorrelationChangeDetector.h index 772031a3d89be784bdb73cd3a07b2c9937a782ea..6effbe53743ad365e539a73b7370b22f0de86b00 100755 --- a/Code/ChangeDetection/otbCorrelationChangeDetector.h +++ b/Code/ChangeDetection/otbCorrelationChangeDetector.h @@ -79,8 +79,8 @@ public: for(unsigned long pos = 0; pos< itA.Size(); ++pos) { - varA += pow(static_cast<TOutput>(itA.GetPixel(pos))-meanA,2.0); - varB += pow(static_cast<TOutput>(itB.GetPixel(pos))-meanB,2.0); + varA += static_cast<TOutput>( pow( static_cast<float>(itA.GetPixel(pos))-static_cast<float>(meanA),static_cast<float>(2.0))); + varB += static_cast<TOutput>( pow( static_cast<float>(itB.GetPixel(pos))-static_cast<float>(meanB),static_cast<float>(2.0))); } diff --git a/Code/FeatureExtraction/otbPixelSuppressionByDirectionImageFilter.txx b/Code/FeatureExtraction/otbPixelSuppressionByDirectionImageFilter.txx index 0949495b05234d2c84a57463bec289c1cb4c0d70..1f6e90050b9189fba2112f2029033fa45bfb5ffc 100755 --- a/Code/FeatureExtraction/otbPixelSuppressionByDirectionImageFilter.txx +++ b/Code/FeatureExtraction/otbPixelSuppressionByDirectionImageFilter.txx @@ -250,10 +250,10 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade // No calculation on the central pixel - if (( x == 0 ) and ( y == 0 )) + if (( x == 0 ) && ( y == 0 )) continue; - Thetaxtyt = atan2(y,x); //result is [-PI,PI] + Thetaxtyt = atan2( static_cast<double>(y), static_cast<double>(x) ); //result is [-PI,PI] while(Thetaxtyt < 0) Thetaxtyt = M_PI + Thetaxtyt; // Theta is now [0,PI] as is // the result of detectors diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx index d956ddfaf73c1aed8c56b0bbb33db26b5c8833ac..be8f27c4052263a76e3b6af33bf8456de1eb0fb5 100755 --- a/Code/IO/otbGDALImageIO.cxx +++ b/Code/IO/otbGDALImageIO.cxx @@ -24,6 +24,7 @@ #include <gdal.h> #include <gdal_priv.h> +//#include <iostream.h> #include <string.h> #include <list> #include <vector> @@ -37,6 +38,16 @@ #include "itkMetaDataObject.h" +/*#include <sys/types.h> +#include <dirent.h> +*/ + +// ROMAIN : Modification for VC++ +/*#ifdef _MSC_VER +#define strcasecmp stricmp // _MICROSOFT_ VC++ +#endif +*/ + #include "otbSystem.h" namespace otb @@ -83,15 +94,20 @@ GDALImageIO::~GDALImageIO() bool GDALImageIO::GetGdalReadImageFileName( const char * filename, std::string & GdalFileName ) { +// DIR *ptr_repertoire; +// struct dirent *cr_readdir; +// std::string str_debut("DAT"); std::vector<std::string> listFileSearch; - std::vector<std::string> listFileFind; listFileSearch.push_back("DAT_01.001");// RADARSAT ou SAR_ERS2 listFileSearch.push_back("IMAGERY.TIF");//Pour format SPOT5TIF listFileSearch.push_back("IMAG_01.DAT");//Pour format SPOT4 std::string str_FileName; +// char str_comp[20]; bool fic_trouve(false); // Si c'est un répertoire, on regarde le contenu pour voir si c'est pas du RADARSAT, ERS + + std::vector<std::string> listFileFind; listFileFind = System::Readdir(std::string (filename)); if( listFileFind.empty() == false ) { @@ -109,6 +125,33 @@ bool GDALImageIO::GetGdalReadImageFileName( const char * filename, std::string & } cpt++; } + +/* ptr_repertoire = opendir(filename); + if (ptr_repertoire != NULL) + { + while ((cr_readdir=readdir(ptr_repertoire))!=NULL && (fic_trouve==false) ) + { + str_FileName = std::string(cr_readdir->d_name); + for(int i = 0 ; i < listFileSearch.size() ; i++) + { + if(str_FileName.compare(listFileSearch[i]) == 0) + { + GdalFileName = std::string(filename)+listFileSearch[i]; + fic_trouve=true; + } + } + + //strncpy(str_comp,cr_readdir->d_name,str_debut.size()); + //strncpy(str_comp,cr_readdir->d_name,str_debut.size()); + //otbMsgDebugMacro(<<"str_comp : "<<str_comp); + //str_comp[str_debut.size()]='\0'; + //if (strcasecmp(str_comp,str_debut.c_str())==0) + //{ + // GdalFileName = std::string(filename)+std::string(cr_readdir->d_name); + // fic_trouve=true; + //} + } +*/ } else { @@ -130,6 +173,7 @@ bool GDALImageIO::GetGdalReadImageFileName( const char * filename, std::string & } otbMsgDevMacro(<<"lFileNameGdal : "<<GdalFileName.c_str()); otbMsgDevMacro(<<"fic_trouve : "<<fic_trouve); +// closedir(ptr_repertoire); return( fic_trouve ); } @@ -148,6 +192,7 @@ bool GDALImageIO::CanReadFile(const char* file) //Traitement particulier sur certain format où l'on préfère utiliser // Format PNG -> lecture avec ITK (pas GDAL) +//THOMAS itk::PNGImageIO::Pointer lPNGImageIO = itk::PNGImageIO::New(); lCanRead = lPNGImageIO->CanReadFile(file); if ( lCanRead == true) @@ -175,7 +220,8 @@ bool GDALImageIO::CanReadFile(const char* file) // Init GDAL parameters GDALAllRegister(); - // Open file with GDAL + // Open file with GDAL + m_poDataset = (GDALDataset *)GDALOpen(lFileNameGdal.c_str(), GA_ReadOnly ); if(m_poDataset==NULL) {