diff --git a/Code/BasicFilters/otbLabelObjectOpeningMuParserFilter.txx b/Code/BasicFilters/otbLabelObjectOpeningMuParserFilter.txx index 17b300dd5875ab872e5b5474b910d6ef6499174f..bac20bbf72f1be8b6a23c803503e79bb5c450096 100644 --- a/Code/BasicFilters/otbLabelObjectOpeningMuParserFilter.txx +++ b/Code/BasicFilters/otbLabelObjectOpeningMuParserFilter.txx @@ -85,7 +85,6 @@ void LabelObjectOpeningMuParserFilter<TImage, TFunction>::DisplayVar() const { const std::map<std::string, double*>& variables = this->m_Functor.GetVar(); - std::cout<<"nb var "<<variables.size()<<std::endl; // Get the number of variables std::map<std::string, double*>::const_iterator item = variables.begin(); diff --git a/Code/BasicFilters/otbMaskMuParserFilter.txx b/Code/BasicFilters/otbMaskMuParserFilter.txx index d5d1976c4403ac01883089226501f5ddf077fc63..4cdb4a616ce8c0a379c744509345a969132395f3 100644 --- a/Code/BasicFilters/otbMaskMuParserFilter.txx +++ b/Code/BasicFilters/otbMaskMuParserFilter.txx @@ -103,17 +103,11 @@ bool MaskMuParserFilter<TInputImage, TOutputImage, TFunction>::CheckExpression() FunctorPointer checkFunctor = FunctorType::New(); checkFunctor->SetExpression(m_Expression); - //initialize - InputImageConstPointer inputPtr = this->GetInput(); - - itk::ImageConstIterator<TInputImage> inputIt(inputPtr, inputPtr->GetRequestedRegion()); - inputIt.GoToBegin(); - FunctorType& functor = *checkFunctor; try { - functor(inputIt.Get()); + functor(this->GetInput()->GetPixel(this->GetInput()->GetBufferedRegion().GetIndex())); } catch (itk::ExceptionObject& err) diff --git a/Code/Visualization/otbPixelDescriptionModel.h b/Code/Visualization/otbPixelDescriptionModel.h index eae9b1816a53becfb1baf743888e2a4474ce9444..02f855eb1452b4f36aefd5b7ea490c5a3c016fa7 100644 --- a/Code/Visualization/otbPixelDescriptionModel.h +++ b/Code/Visualization/otbPixelDescriptionModel.h @@ -68,6 +68,16 @@ public: /** Update the pixel description */ void UpdatePixelDescription(const IndexType& index); + /** add layer name in pixel information description**/ + void AddLayerNameToDisplay(const char *layerName); + + /** remove layer name in pixel information description return true if the layer name have been found + * false otherwise **/ + bool RemoveLayerNameToDisplay(const char *layerName); + + + + protected: /** Constructor */ PixelDescriptionModel(); @@ -80,6 +90,9 @@ protected: /** Notify a registered listener */ void NotifyListener(ListenerType * listener); + /** check if the layer pixel description has to be displayed **/ + bool HasToDisplayLayerPixeldescription(const char *layerName); + private: PixelDescriptionModel(const Self&); // purposely not implemented void operator =(const Self&); // purposely not implemented @@ -87,6 +100,9 @@ private: /** The pixel description */ std::string m_PixelDescription; + /** which layer to display **/ + std::vector<std::string> m_LayerNameToDisplay; + }; // end class } // end namespace otb diff --git a/Code/Visualization/otbPixelDescriptionModel.txx b/Code/Visualization/otbPixelDescriptionModel.txx index f666eed9a6e6d5e953d3653094cce0cb7eef53e4..7b4e35c1c5f253e420c5147f13383cc18aaa7e9f 100644 --- a/Code/Visualization/otbPixelDescriptionModel.txx +++ b/Code/Visualization/otbPixelDescriptionModel.txx @@ -44,6 +44,51 @@ PixelDescriptionModel<TOutputImage> m_PixelDescription = ""; } +template <class TOutputImage> +void PixelDescriptionModel<TOutputImage> +::AddLayerNameToDisplay(const char* layerName) + { + std::string stringName(layerName); + m_LayerNameToDisplay.push_back(stringName); + + } + + /** **/ +template <class TOutputImage> +bool PixelDescriptionModel<TOutputImage> +::RemoveLayerNameToDisplay(const char * layerName) +{ + + for (unsigned int i = 0; i < m_LayerNameToDisplay.size(); i++) + { + if (!(m_LayerNameToDisplay.at(i).compare(layerName))) + { + std::cout << "layer found remove " << m_LayerNameToDisplay.at(i) << std::endl; + m_LayerNameToDisplay.erase(m_LayerNameToDisplay.begin()+i); + return true; + } + + } + return false; + +} + +template <class TOutputImage> +bool PixelDescriptionModel<TOutputImage> +::HasToDisplayLayerPixeldescription(const char * layerName) + { + for (unsigned int i = 0; i < m_LayerNameToDisplay.size(); i++) + { + if (!(m_LayerNameToDisplay.at(i).compare(layerName))) + return true; + + } + return false; + + } + + + template <class TOutputImage> void PixelDescriptionModel<TOutputImage> @@ -57,7 +102,7 @@ PixelDescriptionModel<TOutputImage> it != this->GetLayers()->End(); ++it) { // If the layer is visible - if (it.Get()->GetVisible()) + if (it.Get()->GetVisible() || this->HasToDisplayLayerPixeldescription(it.Get()->GetName())) { // Get the pixel description oss << it.Get()->GetPixelDescription(index) << std::endl; diff --git a/Utilities/ITK/Code/Common/itkScalarToRGBPixelFunctor.txx b/Utilities/ITK/Code/Common/itkScalarToRGBPixelFunctor.txx index b15d1e46e09674e0dc3c3c5d5885a00073a3795e..52fc9444d102631ffa411da7b9481bbaac93de72 100644 --- a/Utilities/ITK/Code/Common/itkScalarToRGBPixelFunctor.txx +++ b/Utilities/ITK/Code/Common/itkScalarToRGBPixelFunctor.txx @@ -65,7 +65,6 @@ ScalarToRGBPixelFunctor<TScalar> ans[0] = static_cast<RGBComponentType>( bytes[m_Index[0]] * 3 ); ans[1] = static_cast<RGBComponentType>( (bytes[m_Index[0]] + bytes[m_Index[1]]) * 5 ); ans[2] = static_cast<RGBComponentType>( (bytes[m_Index[0]] + bytes[m_Index[2]]) ); - return ans; }