From 4418ffda4f80115907c4fc51d457e64a0a658bf9 Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Wed, 18 May 2011 16:06:23 +0200 Subject: [PATCH] ENH: remove std::cout --- Code/Common/otbVectorDataToGISTableFilter.txx | 2 +- Code/Common/otbVectorDataToLabelMapFilter.txx | 6 +-- .../otbNCCRegistrationFunction.txx | 4 +- .../otbParallelLinePathListFilter.txx | 43 ++++++++++--------- .../otbPostGISCreateTableTransactor.cxx | 2 +- .../otbPostGISFromStringTransactor.cxx | 4 +- Code/IO/otbGDALImageIO.cxx | 4 +- Code/IO/otbImageToOSMVectorDataGenerator.txx | 4 +- Code/IO/otbKMLVectorDataIO.txx | 10 ++--- Code/IO/otbMapFileProductWriter.txx | 2 +- Code/Learning/otbDecisionTree.txx | 2 +- .../otbSVMCrossValidationCostFunction.txx | 6 +-- Code/Learning/otbSVMMarginSampler.txx | 4 +- Code/Learning/otbSVMModel.txx | 4 +- ...ltiChannelsPolarimetricSynthesisFilter.txx | 28 ++++++------ 15 files changed, 61 insertions(+), 64 deletions(-) diff --git a/Code/Common/otbVectorDataToGISTableFilter.txx b/Code/Common/otbVectorDataToGISTableFilter.txx index 5772a580a7..f432debea2 100644 --- a/Code/Common/otbVectorDataToGISTableFilter.txx +++ b/Code/Common/otbVectorDataToGISTableFilter.txx @@ -160,7 +160,7 @@ VectorDataToGISTableFilter<TVectorData, TGISTable> gisWriter->Write(input, overOptions); output->SetTableName (inputRoot->Get()->GetNodeId()); - std::cout << "tablename " << output->GetTableName() << std::endl; + otbMsgDevMacro( "tablename " << output->GetTableName() ); } else { diff --git a/Code/Common/otbVectorDataToLabelMapFilter.txx b/Code/Common/otbVectorDataToLabelMapFilter.txx index 5bd8100694..e4d85af4fe 100644 --- a/Code/Common/otbVectorDataToLabelMapFilter.txx +++ b/Code/Common/otbVectorDataToLabelMapFilter.txx @@ -299,9 +299,9 @@ VectorDataToLabelMapFilter<TVectorData, TLabelMap> RegionType polygonExtRingBoundReg = correctPolygonExtRing->GetBoundingRegion(); VertexType vertex; - std::cout << "Polygon bounding region " << polygonExtRingBoundReg << std::endl; - std::cout << "output origin " << this->GetOutput()->GetOrigin() << std::endl; - std::cout << "spacing " << this->GetOutput()->GetSpacing() << std::endl; + otbMsgDevMacro( "Polygon bounding region " << polygonExtRingBoundReg); + otbMsgDevMacro( "output origin " << this->GetOutput()->GetOrigin()); + otbMsgDevMacro( "spacing " << this->GetOutput()->GetSpacing()); // For each position in the bounding region of the polygon for (double i = polygonExtRingBoundReg.GetOrigin(0); diff --git a/Code/DisparityMap/otbNCCRegistrationFunction.txx b/Code/DisparityMap/otbNCCRegistrationFunction.txx index 8f41312c12..738f7d4596 100644 --- a/Code/DisparityMap/otbNCCRegistrationFunction.txx +++ b/Code/DisparityMap/otbNCCRegistrationFunction.txx @@ -107,9 +107,9 @@ NCCRegistrationFunction<TFixedImage, TMovingImage, TDeformationField> // setup moving image interpolator m_MovingImageInterpolator->SetInputImage(this->m_MovingImage); - std::cout << " total metric " << m_MetricTotal << " field size " << + otbMsgDevMacro( " total metric " << m_MetricTotal << " field size " << this->GetDeformationField()->GetLargestPossibleRegion().GetSize() << " image size " << - this->m_FixedImage->GetLargestPossibleRegion().GetSize() << std::endl; + this->m_FixedImage->GetLargestPossibleRegion().GetSize() ); m_MetricTotal = 0.0; } diff --git a/Code/FeatureExtraction/otbParallelLinePathListFilter.txx b/Code/FeatureExtraction/otbParallelLinePathListFilter.txx index 9531db1d78..8cde93b4cd 100644 --- a/Code/FeatureExtraction/otbParallelLinePathListFilter.txx +++ b/Code/FeatureExtraction/otbParallelLinePathListFilter.txx @@ -133,9 +133,9 @@ ParallelLinePathListFilter<TPath> ++outputIt1; } // end of for loop - std::cout << "Number of line pairs that pass the angular condition: " << parallelLineCounter << std::endl; - std::cout << "Number of line pairs that pass the maximum distance condition: " << maxDistCounter << std::endl; - std::cout << "Number of line pairs that pass the common distance condition: " << commonDistCounter << std::endl; + otbMsgDevMacro( "Number of line pairs that pass the angular condition: " << parallelLineCounter ); + otbMsgDevMacro( "Number of line pairs that pass the maximum distance condition: " << maxDistCounter ); + otbMsgDevMacro( "Number of line pairs that pass the common distance condition: " << commonDistCounter ); // Write all parallel lines and set the non-erase flagg. typename std::vector<unsigned int>::iterator lineIt1 = parallelLineIndex.begin(); @@ -149,7 +149,7 @@ ParallelLinePathListFilter<TPath> // add a non-erase flag for the new path eraseFlagVector1.push_back(false); ++sortLineIndex; - std::cout << "Number of lines written in the path list: " << sortLineIndex << std::endl; + otbMsgDevMacro( "Number of lines written in the path list: " << sortLineIndex ); ++lineIt1; } @@ -338,14 +338,15 @@ ParallelLinePathListFilter<TPath> tempv4[0] = temptransv4[0] * cos(alpha1) + temptransv4[1] * sin(alpha1); tempv4[1] = temptransv4[1] * cos(alpha1) - temptransv4[0] * sin(alpha1); - std::cout << "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: "; - std::cout << tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] << std::endl; - std::cout << "Alpha: " << alpha1 << std::endl; - std::cout << "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: "; - std::cout << tempv3[0] << ", " << tempv3[1] << ", " << tempv4[0] << ", " << tempv4[1] << std::endl; - std::cout << "Calculated length of the second line: " << - sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) << std::endl; - std::cout << "Original length of line 1: " << length12 << std::endl; + otbMsgDevMacro( "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: " ); + otbMsgDevMacro( tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] ); + otbMsgDevMacro( "Alpha: " << alpha1 ); + otbMsgDevMacro( "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: " + << tempv3[0] << ", " << tempv3[1] << ", " + << tempv4[0] << ", " << tempv4[1] ); + otbMsgDevMacro( "Calculated length of the second line: " + << sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) ); + otbMsgDevMacro( "Original length of line 1: " << length12 ); } } @@ -391,14 +392,14 @@ ParallelLinePathListFilter<TPath> tempv4[0] = temptransv4[0] * cos(alpha1) + temptransv4[1] * sin(alpha1); tempv4[1] = temptransv4[1] * cos(alpha1) - temptransv4[0] * sin(alpha1); - std::cout << "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: "; - std::cout << tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] << std::endl; - std::cout << "Alpha: " << alpha1 << std::endl; - std::cout << "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: "; - std::cout << tempv3[0] << ", " << tempv3[1] << ", " << tempv4[0] << ", " << tempv4[1] << std::endl; - std::cout << "Calculated length of the second line: " << - sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) << std::endl; - std::cout << "Original length of line 1: " << length12 << std::endl; + otbMsgDevMacro( "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: " ); + otbMsgDevMacro( tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] ); + otbMsgDevMacro( "Alpha: " << alpha1 ); + otbMsgDevMacro( "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: " + << tempv3[0] << ", " << tempv3[1] << ", " << tempv4[0] << ", " << tempv4[1] ); + otbMsgDevMacro( "Calculated length of the second line: " + << sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) ); + otbMsgDevMacro( "Original length of line 1: " << length12 ); } } @@ -488,7 +489,7 @@ ParallelLinePathListFilter<TPath> } // The common parallel parts of the two lines have to be greater than // the provided threshold. - std::cout << "Calculated common distance of the parallel lines: " << commonDist << std::endl; + otbMsgDevMacro( "Calculated common distance of the parallel lines: " << commonDist ); bool common = (commonDist >= static_cast<double>(m_CommonDistanceThreshold)); return common; diff --git a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx b/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx index b8ffee670a..8e7bf78580 100644 --- a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx +++ b/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx @@ -93,7 +93,7 @@ void PostGISCreateTableTransactor::operator ()(pqxx::nontransaction& T) void PostGISCreateTableTransactor::on_commit() { - std::cout << "\t Table is created \t" << std::endl; + otbMsgDevMacro( "\t Table is created \t" ); //T.exec } diff --git a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx b/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx index ebcbebf2b0..107357da64 100644 --- a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx +++ b/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx @@ -56,9 +56,7 @@ void PostGISFromStringTransactor::operator ()(pqxx::nontransaction& T) void PostGISFromStringTransactor::on_commit() { - std::cout << "\t Transaction \t" << std::endl; - std::cout << "\t " << m_TransactionString << std::endl; - + otbMsgDevMacro( "\t Transaction \t\n\t" << m_TransactionString ); } std::string PostGISFromStringTransactor::GetTransactionString() const diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx index 9f37a215d4..57b3ffc3b6 100644 --- a/Code/IO/otbGDALImageIO.cxx +++ b/Code/IO/otbGDALImageIO.cxx @@ -39,6 +39,8 @@ namespace otb { + +/* template<class InputType> void printOutputData(InputType *pData, int nbBands, int nbPixelToRead) { @@ -87,7 +89,7 @@ void printDataBuffer(unsigned char *pData, GDALDataType pxlType, int nbBands, in std::cerr << "Pixel type unknown" << std::endl; } }; - +*/ // only two states : the Pointer is Null or GetDataSet() returns a valid dataset class GDALDatasetWrapper : public itk::LightObject diff --git a/Code/IO/otbImageToOSMVectorDataGenerator.txx b/Code/IO/otbImageToOSMVectorDataGenerator.txx index e39cfe3781..8a6c3c23ad 100644 --- a/Code/IO/otbImageToOSMVectorDataGenerator.txx +++ b/Code/IO/otbImageToOSMVectorDataGenerator.txx @@ -139,8 +139,8 @@ ImageToOSMVectorDataGenerator<TImage> { PointType physicalPoint; input->TransformIndexToPhysicalPoint(vindex[i], physicalPoint); - std::cout <<" physical point "<< physicalPoint << " --> Transform " - << transform->TransformPoint(physicalPoint) << std::endl; + otbMsgDevMacro( << " physical point "<< physicalPoint << " --> Transform " + << transform->TransformPoint(physicalPoint)); voutput.push_back(transform->TransformPoint(physicalPoint)); } diff --git a/Code/IO/otbKMLVectorDataIO.txx b/Code/IO/otbKMLVectorDataIO.txx index c439e774a3..83acbafcb3 100644 --- a/Code/IO/otbKMLVectorDataIO.txx +++ b/Code/IO/otbKMLVectorDataIO.txx @@ -461,10 +461,8 @@ KMLVectorDataIO<TData> itkExceptionMacro(<< "Failed to open KML data file " << this->m_FileName); } - std::cout << this->m_FileName << std::endl; - - otbMsgDebugMacro(<< "Driver to read: KML"); - otbMsgDebugMacro(<< "Reading file: " << this->m_FileName); + otbMsgDevMacro(<< "Driver to read: KML"); + otbMsgDevMacro(<< "Reading file: " << this->m_FileName); // Parse the file. std::string errors; @@ -578,9 +576,7 @@ void KMLVectorDataIO<TData>::Write(const VectorDataConstPointerType data, char * //std::cout << xml; chrono.Stop(); - std::cout << "KMLVectorDataIO: file saved in " << chrono.GetMeanTime() << " seconds. (" << m_Kept << " elements)" << - std::endl; - + otbMsgDevMacro(<< "KMLVectorDataIO: file saved in " << chrono.GetMeanTime() << " seconds. (" << m_Kept << " elements)" ); otbMsgDevMacro(<< " KMLVectorDataIO::Write() "); } diff --git a/Code/IO/otbMapFileProductWriter.txx b/Code/IO/otbMapFileProductWriter.txx index f270c54b75..8b7784729f 100644 --- a/Code/IO/otbMapFileProductWriter.txx +++ b/Code/IO/otbMapFileProductWriter.txx @@ -117,7 +117,7 @@ MapFileProductWriter<TInputImage> if(m_VectorImage->GetProjectionRef().empty() && m_VectorImage->GetImageKeywordlist().GetSize() > 0) { - std::cout << "Sensor Model detected : Reprojecting in the targer SRID"<< std::endl; + otbMsgDevMacro( "Sensor Model detected : Reprojecting in the targer SRID" ); m_GenericRSResampler->SetInput(this->GetInput()); m_GenericRSResampler->SetOutputParametersFromMap(otb::GeoInformationConversion::ToWKT(m_SRID)); m_VectorImage = m_GenericRSResampler->GetOutput(); diff --git a/Code/Learning/otbDecisionTree.txx b/Code/Learning/otbDecisionTree.txx index b4d74d9a91..43f8aa84d3 100644 --- a/Code/Learning/otbDecisionTree.txx +++ b/Code/Learning/otbDecisionTree.txx @@ -92,7 +92,7 @@ DecisionTree<AttributeValueType, LabelType> { AttributeValueType attrValue = example[m_Attribute]; - std::cout << "Trying to match attribute " << m_Attribute << " with value " << attrValue << std::endl; + otbMsgDevMacro( << "Trying to match attribute " << m_Attribute << " with value " << attrValue ); bool found = false; KeyType key; diff --git a/Code/Learning/otbSVMCrossValidationCostFunction.txx b/Code/Learning/otbSVMCrossValidationCostFunction.txx index 6b217c85c4..e09dd8248e 100644 --- a/Code/Learning/otbSVMCrossValidationCostFunction.txx +++ b/Code/Learning/otbSVMCrossValidationCostFunction.txx @@ -77,10 +77,10 @@ SVMCrossValidationCostFunction<TModel> y2 = this->GetValue(x2); derivative[i] = (y2 - y1) / (2 * m_DerivativeStep); - std::cout << "x1= " << x1 << " x2= " << x2 << ", y1= " << y1 << ", y2= " << y2 << std::endl; + otbMsgDevMacro( << "x1= " << x1 << " x2= " << x2 << ", y1= " << y1 << ", y2= " << y2 ); } - std::cout << "Position: " << parameters << ", Value: " << this->GetValue(parameters) << ", Derivatives: " << - derivative << std::endl; + otbMsgDevMacro( "Position: " << parameters << ", Value: " << this->GetValue(parameters) + << ", Derivatives: " << derivative ); } template<class TModel> diff --git a/Code/Learning/otbSVMMarginSampler.txx b/Code/Learning/otbSVMMarginSampler.txx index 167f561ab0..c63c69b522 100644 --- a/Code/Learning/otbSVMMarginSampler.txx +++ b/Code/Learning/otbSVMMarginSampler.txx @@ -144,14 +144,14 @@ SVMMarginSampler< TSample, TModel > sort(idDistVector.begin(), idDistVector.end(), &Compare); // Display the first 10 values - std::cout <<" Margin Sampling: "<<std::endl; + otbMsgDevMacro( <<" Margin Sampling: " ); // Clear previous margin samples m_MarginSamples.clear(); for(unsigned int i = 0; i<m_NumberOfCandidates && i<idDistVector.size(); ++i) { - std::cout<<"Sample "<<idDistVector[i].first<<" (distance= "<<idDistVector[i].second<<")"<<std::endl; + otbMsgDevMacro( "Sample "<<idDistVector[i].first<<" (distance= "<<idDistVector[i].second<<")" ) m_MarginSamples.push_back(idDistVector[i].first); } diff --git a/Code/Learning/otbSVMModel.txx b/Code/Learning/otbSVMModel.txx index dbdfe4cf3e..0a2bf4964d 100644 --- a/Code/Learning/otbSVMModel.txx +++ b/Code/Learning/otbSVMModel.txx @@ -588,9 +588,9 @@ SVMModel<TValue, TLabel>::SetSupportVectors(svm_node ** sv, int nbOfSupportVecto unsigned int elements = 0; for (int p = 0; p < nbOfSupportVector; ++p) { - std::cout << p << " "; + //std::cout << p << " "; const svm_node *tempNode = sv[p]; - std::cout << p << " "; + //std::cout << p << " "; while (tempNode->index != -1) { tempNode++; diff --git a/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.txx b/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.txx index c41965833f..d67d3f89b5 100644 --- a/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.txx +++ b/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.txx @@ -371,20 +371,20 @@ MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction> ::PrintSelf(std::ostream& os, itk::Indent indent) const { this->Superclass::PrintSelf(os, indent); - std::cout << "PsiI: " << m_PsiI << std::endl; - std::cout << "KhiI: " << m_KhiI << std::endl; - std::cout << "PsiR: " << m_PsiR << std::endl; - std::cout << "KhiR: " << m_KhiR << std::endl; - - std::cout << "Ei0 im: " << m_Ei[0].imag() << std::endl; - std::cout << "Ei0 re: " << m_Ei[0].real() << std::endl; - std::cout << "Ei1 im: " << m_Ei[1].imag() << std::endl; - std::cout << "Ei1 re: " << m_Ei[1].real() << std::endl; - - std::cout << "Er0 im: " << m_Er[0].imag() << std::endl; - std::cout << "Er0 re: " << m_Er[0].real() << std::endl; - std::cout << "Er1 im: " << m_Er[1].imag() << std::endl; - std::cout << "Er1 re: " << m_Er[1].real() << std::endl; + os << indent << "PsiI: " << m_PsiI << std::endl; + os << indent << "KhiI: " << m_KhiI << std::endl; + os << indent << "PsiR: " << m_PsiR << std::endl; + os << indent << "KhiR: " << m_KhiR << std::endl; + + os << indent << "Ei0 im: " << m_Ei[0].imag() << std::endl; + os << indent << "Ei0 re: " << m_Ei[0].real() << std::endl; + os << indent << "Ei1 im: " << m_Ei[1].imag() << std::endl; + os << indent << "Ei1 re: " << m_Ei[1].real() << std::endl; + + os << indent << "Er0 im: " << m_Er[0].imag() << std::endl; + os << indent << "Er0 re: " << m_Er[0].real() << std::endl; + os << indent << "Er1 im: " << m_Er[1].imag() << std::endl; + os << indent << "Er1 re: " << m_Er[1].real() << std::endl; } } // end namespace otb -- GitLab