diff --git a/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx b/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx index 75691fe081a8faafe0b2ce9d0d2f767068868d0e..2201cc6e2ac1c7ec3c876a32f0725d49bb4a9618 100644 --- a/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx +++ b/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx @@ -143,18 +143,18 @@ BinaryImageToDensityImageFilter<TInputImage, TOutputImage, TCountFunction> it.GoToBegin(); while(!itOut.IsAtEnd()) - { - index = it.GetIndex(); - - if(outputRegionForThread.IsInside(index)) - { - itOut.Set(m_CountFunction->EvaluateAtIndex(index)); - } - - ++itOut; - ++it; - progress.CompletedPixel(); // potential exception thrown here - } + { + index = it.GetIndex(); + + if(outputRegionForThread.IsInside(index)) + { + itOut.Set(m_CountFunction->EvaluateAtIndex(index)); + } + + ++itOut; + ++it; + progress.CompletedPixel(); // potential exception thrown here + } } } diff --git a/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx b/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx index 34616debcc55bcc6d87e3756e5266119b77363da..24ba094fe4c2d8450df6a88f8a4f135830151e0e 100755 --- a/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx +++ b/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx @@ -32,8 +32,8 @@ template< class TListSample, class THistogramMeasurement, class TFrequencyContainer> ListSampleToHistogramListGenerator< TListSample, - THistogramMeasurement, - TFrequencyContainer > + THistogramMeasurement, + TFrequencyContainer > ::ListSampleToHistogramListGenerator() : m_List(), m_Size(), m_MarginalScale(100), m_HistogramMin(), m_HistogramMax(), m_AutoMinMax(true), m_HistogramList() { m_HistogramList = HistogramListType::New() ; @@ -46,8 +46,8 @@ template< class TListSample, class TFrequencyContainer > void ListSampleToHistogramListGenerator< TListSample, - THistogramMeasurement, - TFrequencyContainer > + THistogramMeasurement, + TFrequencyContainer > ::GenerateData() { otbMsgDebugMacro(<<"ListSampleToHistogramListGenerator::GenerateData(): Entering"); @@ -85,9 +85,9 @@ ListSampleToHistogramListGenerator< TListSample, if ( !itk::NumericTraits< THistogramMeasurement >::is_integer ) { margin = - ( (THistogramMeasurement)(upper[i] - lower[i]) / - (THistogramMeasurement) m_Size[0] ) / - (THistogramMeasurement) m_MarginalScale ; + ( (THistogramMeasurement)(upper[i] - lower[i]) / + (THistogramMeasurement) m_Size[0] ) / + (THistogramMeasurement) m_MarginalScale ; h_upper[i] = (THistogramMeasurement) (upper[i] + margin) ; if(h_upper[i] <= upper[i]) { @@ -154,15 +154,15 @@ ListSampleToHistogramListGenerator< TListSample, m_HistogramList->Back()->GetIndex(hvector,index); if (!m_HistogramList->Back()->IsIndexOutOfBounds(index)) - { - // if the measurement vector is out of bound then - // the GetIndex method has returned an index set to the max size of - // the invalid dimension - even if the hvector is less than the minimum - // bin value. - // If the index isn't valid, we don't increase the frequency. - // See the comments in Histogram->GetIndex() for more info. - m_HistogramList->Back()->IncreaseFrequency(index, 1) ; - } + { + // if the measurement vector is out of bound then + // the GetIndex method has returned an index set to the max size of + // the invalid dimension - even if the hvector is less than the minimum + // bin value. + // If the index isn't valid, we don't increase the frequency. + // See the comments in Histogram->GetIndex() for more info. + m_HistogramList->Back()->IncreaseFrequency(index, 1) ; + } ++iter ; } } @@ -174,8 +174,8 @@ template< class TListSample, class TFrequencyContainer > void ListSampleToHistogramListGenerator< TListSample, - THistogramMeasurement, - TFrequencyContainer > + THistogramMeasurement, + TFrequencyContainer > ::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os,indent); diff --git a/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx b/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx index e0a17087f6f49592e5e1fdd9c3488c7af9875c02..cdae1971d72f09879af41f29859d88885338bdec 100755 --- a/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx +++ b/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx @@ -89,9 +89,9 @@ ListSampleToVariableDimensionHistogramGenerator< TListSample, if ( !itk::NumericTraits< THistogramMeasurement >::is_integer ) { margin = - ( (THistogramMeasurement)(upper[i] - lower[i]) / - (THistogramMeasurement) m_Sizes[i] ) / - (THistogramMeasurement) m_MarginalScale ; + ( (THistogramMeasurement)(upper[i] - lower[i]) / + (THistogramMeasurement) m_Sizes[i] ) / + (THistogramMeasurement) m_MarginalScale ; h_upper[i] = (THistogramMeasurement) (upper[i] + margin) ; if(h_upper[i] <= upper[i]) { diff --git a/Code/Common/otbCartographicRegion.h b/Code/Common/otbCartographicRegion.h index 2c5aff035b4f9043d662439515d7e148fc8ac176..47d9b10240f7398856f32f67a0433428546c1579 100644 --- a/Code/Common/otbCartographicRegion.h +++ b/Code/Common/otbCartographicRegion.h @@ -199,53 +199,53 @@ public: // Can we crop? for (unsigned int i = 0; i < IndexType::IndexDimension && cropPossible; i++) - { - // Is left edge of current region to the right of the right edge - // of the region to crop with? (if so, we cannot crop) - if (m_Index[i] >= region.GetOrigin()[i] - + static_cast<Type>(region.GetSize()[i])) - { - cropPossible = false; - } - // If right edge of the current region to the left of the left - // edge of the region to crop with? (if so, we cannot crop) - if (m_Index[i] + static_cast<Type>(m_Size[i]) <= region.GetOrigin()[i]) - { - cropPossible = false; - } - } + { + // Is left edge of current region to the right of the right edge + // of the region to crop with? (if so, we cannot crop) + if (m_Index[i] >= region.GetOrigin()[i] + + static_cast<Type>(region.GetSize()[i])) + { + cropPossible = false; + } + // If right edge of the current region to the left of the left + // edge of the region to crop with? (if so, we cannot crop) + if (m_Index[i] + static_cast<Type>(m_Size[i]) <= region.GetOrigin()[i]) + { + cropPossible = false; + } + } // if we cannot crop, return without changing anythin if (!cropPossible) - { - return cropPossible; - } + { + return cropPossible; + } // we can crop, so crop for (unsigned int i=0; i < IndexType::IndexDimension; i++) - { - // first check the start index - if (m_Index[i] < region.GetOrigin()[i]) - { - // how much do we need to adjust - crop = region.GetOrigin()[i] - m_Index[i]; - - // adjust the start index and the size of the current region - m_Index[i] += crop; - m_Size[i] -= static_cast<Type>(crop); - } - // now check the final size - if (m_Index[i] + static_cast<Type>(m_Size[i]) - > region.GetOrigin()[i] + static_cast<Type>(region.GetSize()[i])) - { - // how much do we need to adjust - crop = m_Index[i] + static_cast<Type>(m_Size[i]) - - region.GetOrigin()[i] - static_cast<Type>(region.GetSize()[i]); - - // adjust the size - m_Size[i] -= static_cast<Type>(crop); - } - } + { + // first check the start index + if (m_Index[i] < region.GetOrigin()[i]) + { + // how much do we need to adjust + crop = region.GetOrigin()[i] - m_Index[i]; + + // adjust the start index and the size of the current region + m_Index[i] += crop; + m_Size[i] -= static_cast<Type>(crop); + } + // now check the final size + if (m_Index[i] + static_cast<Type>(m_Size[i]) + > region.GetOrigin()[i] + static_cast<Type>(region.GetSize()[i])) + { + // how much do we need to adjust + crop = m_Index[i] + static_cast<Type>(m_Size[i]) + - region.GetOrigin()[i] - static_cast<Type>(region.GetSize()[i]); + + // adjust the size + m_Size[i] -= static_cast<Type>(crop); + } + } return cropPossible; } diff --git a/Code/Common/otbDrawLineSpatialObjectListFilter.txx b/Code/Common/otbDrawLineSpatialObjectListFilter.txx index f171477f71f7b932a360a5c3c474df1465694b36..e1d92730833c151eac7a71d8ff24ab4a5bfd6a63 100644 --- a/Code/Common/otbDrawLineSpatialObjectListFilter.txx +++ b/Code/Common/otbDrawLineSpatialObjectListFilter.txx @@ -114,43 +114,43 @@ DrawLineSpatialObjectListFilter<TInputImage, TOutputImage> /** Crop the segment if it is outside the region in the left*/ if( !(this->IsColumnOutsideOfTheRegion(&indexBeginLine,&indexEndLine,&outputRegionForThread) && this->IsColumnOutsideOfTheRegion(&indexEndLine,&indexBeginLine,&outputRegionForThread))) - { - if(indexEndLine[0] >=static_cast< int>(size[0])) - this->CropRightSegment(&indexEndLine,&indexBeginLine, &outputRegionForThread); - - if( indexBeginLine[0] >= static_cast< int>(size[0]) ) - this->CropRightSegment(&indexBeginLine,&indexEndLine, &outputRegionForThread); - } + { + if(indexEndLine[0] >=static_cast< int>(size[0])) + this->CropRightSegment(&indexEndLine,&indexBeginLine, &outputRegionForThread); + + if( indexBeginLine[0] >= static_cast< int>(size[0]) ) + this->CropRightSegment(&indexBeginLine,&indexEndLine, &outputRegionForThread); + } /** * If an extremity is under the region * Technically, the X component of the index is inside the image */ if(this->IsDownsideTheImage(&indexBeginLine) && input->GetLargestPossibleRegion().IsInside(indexEndLine)) - this->CropSegment(&indexBeginLine,&indexEndLine, &outputRegionForThread); + this->CropSegment(&indexBeginLine,&indexEndLine, &outputRegionForThread); if(this->IsDownsideTheImage(&indexEndLine) && input->GetLargestPossibleRegion().IsInside(indexBeginLine)) - this->CropSegment(&indexEndLine,&indexBeginLine, &outputRegionForThread); + this->CropSegment(&indexEndLine,&indexBeginLine, &outputRegionForThread); /** If the segments are not in the region (upside or downside the region)*/ if(!(this->IsUpsideTheRegion(&indexBeginLine,&outputRegionForThread) && this->IsUpsideTheRegion(&indexEndLine,&outputRegionForThread)) && - !(this->IsDownsideTheRegion(&indexBeginLine,&outputRegionForThread) && this->IsDownsideTheRegion(&indexEndLine,&outputRegionForThread)) && - !(this->IsColumnOutsideOfTheRegion(&indexBeginLine,&indexEndLine, &outputRegionForThread) && this->IsColumnOutsideOfTheRegion(&indexEndLine,&indexBeginLine,&outputRegionForThread)) - ) - { + !(this->IsDownsideTheRegion(&indexBeginLine,&outputRegionForThread) && this->IsDownsideTheRegion(&indexEndLine,&outputRegionForThread)) && + !(this->IsColumnOutsideOfTheRegion(&indexBeginLine,&indexEndLine, &outputRegionForThread) && this->IsColumnOutsideOfTheRegion(&indexEndLine,&indexBeginLine,&outputRegionForThread)) + ) + { - /** Instanciation of the line iterator with begin and ending index*/ - LineIteratorFilter itLine(output,indexBeginLine ,indexEndLine ); + /** Instanciation of the line iterator with begin and ending index*/ + LineIteratorFilter itLine(output,indexBeginLine ,indexEndLine ); - /** Iteration over the line and writing white lines */ - while(!itLine.IsAtEnd()) - { - if(outputRegionForThread.IsInside(itLine.GetIndex())) - itLine.Set(m_Value); - ++itLine; - } - } + /** Iteration over the line and writing white lines */ + while(!itLine.IsAtEnd()) + { + if(outputRegionForThread.IsInside(itLine.GetIndex())) + itLine.Set(m_Value); + ++itLine; + } + } ++itList; } diff --git a/Code/Common/otbRectangle.h b/Code/Common/otbRectangle.h index fa4a161b140d6da58222eb73335b92e83853a35c..1533422a15ad1511f1410696cb2be0af73b39eb2 100644 --- a/Code/Common/otbRectangle.h +++ b/Code/Common/otbRectangle.h @@ -96,7 +96,7 @@ namespace otb /** Constructor */ Rectangle() { - m_VertexList = VertexListType::New(); + m_VertexList = VertexListType::New(); }; /** Destructor */ diff --git a/Code/Common/otbRectangle.txx b/Code/Common/otbRectangle.txx index a938b1567008bc8c30e9e2693e5ca2914c53676c..9a40f7fca830a41588e32efe034890150ee92c02 100644 --- a/Code/Common/otbRectangle.txx +++ b/Code/Common/otbRectangle.txx @@ -149,41 +149,41 @@ Rectangle<TValue> if ( cornersVertex->Size()>0) { - x = static_cast<long int>(itCorners.Value()[0]); - y = static_cast<long int>(itCorners.Value()[1]); - index[0] = x; - index[1] = y; - - ++itCorners; - while (itCorners != cornersVertex->End()) - { - x = static_cast<long int>(itCorners.Value()[0]); - y = static_cast<long int>(itCorners.Value()[1]); - - // Index search - if ( x < index[0] ) - { - index[0] = x; - } - if ( y < index[1] ) - { - index[1] = y; - } - // Max Id search for size computation - if ( x > maxId[0] ) - { - maxId[0] = x; - } - if ( y > maxId[1] ) - { - maxId[1] = y; - } - - ++itCorners; + x = static_cast<long int>(itCorners.Value()[0]); + y = static_cast<long int>(itCorners.Value()[1]); + index[0] = x; + index[1] = y; + + ++itCorners; + while (itCorners != cornersVertex->End()) + { + x = static_cast<long int>(itCorners.Value()[0]); + y = static_cast<long int>(itCorners.Value()[1]); + + // Index search + if ( x < index[0] ) + { + index[0] = x; + } + if ( y < index[1] ) + { + index[1] = y; + } + // Max Id search for size computation + if ( x > maxId[0] ) + { + maxId[0] = x; + } + if ( y > maxId[1] ) + { + maxId[1] = y; + } + + ++itCorners; } - - size[0] = maxId[0] - index[0]; - size[1] = maxId[1] - index[1]; + + size[0] = maxId[0] - index[0]; + size[1] = maxId[1] - index[1]; } region.SetSize(size); region.SetIndex(index); diff --git a/Code/Common/otbVectorDataExtractROI.txx b/Code/Common/otbVectorDataExtractROI.txx index 33ab70b64830cd8b91b9a1ac90f1a0926c75671c..72e30ac6891a3217d35189fe37b67d43701b15cd 100644 --- a/Code/Common/otbVectorDataExtractROI.txx +++ b/Code/Common/otbVectorDataExtractROI.txx @@ -114,135 +114,135 @@ VectorDataExtractROI<TVectorData> switch (dataNode->GetNodeType()) - { - case ROOT: - { - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - tree->SetRoot(newDataNode); - currentContainer = newDataNode; - break; - } - case DOCUMENT: - { - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - tree->Add(newDataNode,currentContainer); - currentContainer = newDataNode; - break; - } - case FOLDER: - { - newDataNodeFolder->SetNodeType(dataNode->GetNodeType()); - newDataNodeFolder->SetNodeId(dataNode->GetNodeId()); - newFolder = true; - break; - } - case FEATURE_POINT: - { - if(m_GeoROI.IsInside(this->PointToContinuousIndex(dataNode->GetPoint()))) - { - if(newFolder) - { - tree->Add(newDataNodeFolder,currentContainer); - currentContainer = newDataNodeFolder; - newFolder = false; - } - if(newMultiFeature) - { - tree->Add(newDataNodeMultiFeature,currentContainer); - currentContainer = newDataNodeMultiFeature; - newMultiFeature = false; - } - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - newDataNode->SetPoint(dataNode->GetPoint()); - tree->Add(newDataNode,currentContainer); - } - - break; - } - case FEATURE_LINE: - { - if(this->IsLineIntersectionNotNull(dataNode->GetLine())) - { - if(newFolder) - { - tree->Add(newDataNodeFolder,currentContainer); - currentContainer = newDataNodeFolder; - newFolder = false; - } - if(newMultiFeature) - { - tree->Add(newDataNodeMultiFeature ,currentContainer); - currentContainer = newDataNodeMultiFeature ; - newMultiFeature = false; - } - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - newDataNode->SetLine(dataNode->GetLine()); - tree->Add(newDataNode,currentContainer); - } - break; - } - case FEATURE_POLYGON: - { - if(this->IsPolygonIntersectionNotNull(dataNode->GetPolygonExteriorRing())) - { - if(newFolder) - { - tree->Add(newDataNodeFolder,currentContainer); - currentContainer = newDataNodeFolder; - newFolder = false; - } - - if(newMultiFeature) - { - tree->Add(newDataNodeMultiFeature,currentContainer); - currentContainer = newDataNodeMultiFeature ; - newMultiFeature = false; - } - - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - newDataNode->SetPolygonExteriorRing(dataNode->GetPolygonExteriorRing()); - newDataNode->SetPolygonInteriorRings(dataNode->GetPolygonInteriorRings()); - tree->Add(newDataNode,currentContainer); - } - break; - } - case FEATURE_MULTIPOINT: - { - newDataNodeMultiFeature->SetNodeType(dataNode->GetNodeType()); - newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId()); - newMultiFeature = true; - - - break; - } - case FEATURE_MULTILINE: - { - newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType()); - newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId()); - newMultiFeature = true; - break; - } - case FEATURE_MULTIPOLYGON: - { - newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType()); - newDataNodeMultiFeature->SetNodeId(dataNode->GetNodeId()); - newMultiFeature = true; - break; - } - case FEATURE_COLLECTION: - { - newDataNode->SetNodeType(dataNode->GetNodeType()); - newDataNode->SetNodeId(dataNode->GetNodeId()); - tree->Add(newDataNode,currentContainer); - currentContainer = newDataNode; - break; - } - } + { + case ROOT: + { + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + tree->SetRoot(newDataNode); + currentContainer = newDataNode; + break; + } + case DOCUMENT: + { + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + tree->Add(newDataNode,currentContainer); + currentContainer = newDataNode; + break; + } + case FOLDER: + { + newDataNodeFolder->SetNodeType(dataNode->GetNodeType()); + newDataNodeFolder->SetNodeId(dataNode->GetNodeId()); + newFolder = true; + break; + } + case FEATURE_POINT: + { + if(m_GeoROI.IsInside(this->PointToContinuousIndex(dataNode->GetPoint()))) + { + if(newFolder) + { + tree->Add(newDataNodeFolder,currentContainer); + currentContainer = newDataNodeFolder; + newFolder = false; + } + if(newMultiFeature) + { + tree->Add(newDataNodeMultiFeature,currentContainer); + currentContainer = newDataNodeMultiFeature; + newMultiFeature = false; + } + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + newDataNode->SetPoint(dataNode->GetPoint()); + tree->Add(newDataNode,currentContainer); + } + + break; + } + case FEATURE_LINE: + { + if(this->IsLineIntersectionNotNull(dataNode->GetLine())) + { + if(newFolder) + { + tree->Add(newDataNodeFolder,currentContainer); + currentContainer = newDataNodeFolder; + newFolder = false; + } + if(newMultiFeature) + { + tree->Add(newDataNodeMultiFeature ,currentContainer); + currentContainer = newDataNodeMultiFeature ; + newMultiFeature = false; + } + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + newDataNode->SetLine(dataNode->GetLine()); + tree->Add(newDataNode,currentContainer); + } + break; + } + case FEATURE_POLYGON: + { + if(this->IsPolygonIntersectionNotNull(dataNode->GetPolygonExteriorRing())) + { + if(newFolder) + { + tree->Add(newDataNodeFolder,currentContainer); + currentContainer = newDataNodeFolder; + newFolder = false; + } + + if(newMultiFeature) + { + tree->Add(newDataNodeMultiFeature,currentContainer); + currentContainer = newDataNodeMultiFeature ; + newMultiFeature = false; + } + + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + newDataNode->SetPolygonExteriorRing(dataNode->GetPolygonExteriorRing()); + newDataNode->SetPolygonInteriorRings(dataNode->GetPolygonInteriorRings()); + tree->Add(newDataNode,currentContainer); + } + break; + } + case FEATURE_MULTIPOINT: + { + newDataNodeMultiFeature->SetNodeType(dataNode->GetNodeType()); + newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId()); + newMultiFeature = true; + + + break; + } + case FEATURE_MULTILINE: + { + newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType()); + newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId()); + newMultiFeature = true; + break; + } + case FEATURE_MULTIPOLYGON: + { + newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType()); + newDataNodeMultiFeature->SetNodeId(dataNode->GetNodeId()); + newMultiFeature = true; + break; + } + case FEATURE_COLLECTION: + { + newDataNode->SetNodeType(dataNode->GetNodeType()); + newDataNode->SetNodeId(dataNode->GetNodeId()); + tree->Add(newDataNode,currentContainer); + currentContainer = newDataNode; + break; + } + } ++it; } @@ -383,31 +383,31 @@ VectorDataExtractROI<TVectorData> ++it; while (it != vertexlist->End()) - { - x = static_cast<double>(it.Value()[0]); - y = static_cast<double>(it.Value()[1]); - - // Index search - if ( x < index[0] ) - { - index[0] = x; - } - if ( y < index[1] ) - { - index[1] = y; - } - // Max Id search for size computation - if ( x > maxId[0] ) - { - maxId[0] = x; - } - if ( y > maxId[1] ) - { - maxId[1] = y; - } - - ++it; - } + { + x = static_cast<double>(it.Value()[0]); + y = static_cast<double>(it.Value()[1]); + + // Index search + if ( x < index[0] ) + { + index[0] = x; + } + if ( y < index[1] ) + { + index[1] = y; + } + // Max Id search for size computation + if ( x > maxId[0] ) + { + maxId[0] = x; + } + if ( y > maxId[1] ) + { + maxId[1] = y; + } + + ++it; + } size[0] = maxId[0] - index[0]; size[1] = maxId[1] - index[1]; diff --git a/Code/FeatureExtraction/otbAngularSecondMomentumTextureFunctor.h b/Code/FeatureExtraction/otbAngularSecondMomentumTextureFunctor.h index 0abf087341b3581d3edcd46cad278922380dbfd3..96ca53706b4ae691930008ca35cc6dc2fb03eae0 100755 --- a/Code/FeatureExtraction/otbAngularSecondMomentumTextureFunctor.h +++ b/Code/FeatureExtraction/otbAngularSecondMomentumTextureFunctor.h @@ -57,13 +57,13 @@ public: double area = static_cast<double>(neigh.GetSize()[0]*neigh.GetSize()[1]); double areaInv = 1/area; for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; - out += vcl_pow( p, 2 ); - } - } + { + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; + out += vcl_pow( p, 2 ); + } + } return out; } diff --git a/Code/FeatureExtraction/otbClusterProminenceTextureFunctor.h b/Code/FeatureExtraction/otbClusterProminenceTextureFunctor.h index 7ab3e3ae04fc43739dd33a056f792ee9f71ebadf..f1cecf8881f1fec4357df1c06e9502f1eb9070e0 100755 --- a/Code/FeatureExtraction/otbClusterProminenceTextureFunctor.h +++ b/Code/FeatureExtraction/otbClusterProminenceTextureFunctor.h @@ -61,12 +61,12 @@ public: for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = this->GetHisto()[r][s]*areaInv; - double sumPixel = (static_cast<double>(s)+0.5)*this->GetNeighBinLength() + (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - out += vcl_pow( sumPixel - 2*mean, 4) * p; - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = this->GetHisto()[r][s]*areaInv; + double sumPixel = (static_cast<double>(s)+0.5)*this->GetNeighBinLength() + (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + out += vcl_pow( sumPixel - 2*mean, 4) * p; + } } return out; diff --git a/Code/FeatureExtraction/otbClusterShadeTextureFunctor.h b/Code/FeatureExtraction/otbClusterShadeTextureFunctor.h index a7150427f51bcf56541badca5c704259ccd6e922..4adfd82d403335c21ca51c326963d9c9d28f1d1c 100755 --- a/Code/FeatureExtraction/otbClusterShadeTextureFunctor.h +++ b/Code/FeatureExtraction/otbClusterShadeTextureFunctor.h @@ -61,12 +61,12 @@ public: for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = this->GetHisto()[r][s]*areaInv; - double sumPixel = (static_cast<double>(s)+0.5)*this->GetNeighBinLength() + (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - out += vcl_pow( sumPixel - 2*mean, 3) * p; - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = this->GetHisto()[r][s]*areaInv; + double sumPixel = (static_cast<double>(s)+0.5)*this->GetNeighBinLength() + (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + out += vcl_pow( sumPixel - 2*mean, 3) * p; + } } return out; diff --git a/Code/FeatureExtraction/otbContrastTextureFunctor.h b/Code/FeatureExtraction/otbContrastTextureFunctor.h index 95e191636065607137edace79732b0785273e237..22c7e5832315de7d62df3d38cf996cb95c87e34c 100755 --- a/Code/FeatureExtraction/otbContrastTextureFunctor.h +++ b/Code/FeatureExtraction/otbContrastTextureFunctor.h @@ -58,20 +58,20 @@ public: // loop over bin neighborhood values for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - double nCeilSquare = vcl_pow( nCeil, 2); - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - double p = static_cast<double>(this->GetHisto()[r][s])*areaInv; - out += nCeilSquare * p; - } - } - } + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + double nCeilSquare = vcl_pow( nCeil, 2); + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + double p = static_cast<double>(this->GetHisto()[r][s])*areaInv; + out += nCeilSquare * p; + } + } + } } return out; diff --git a/Code/FeatureExtraction/otbCorrelationTextureFunctor.h b/Code/FeatureExtraction/otbCorrelationTextureFunctor.h index 9e7c7e469fc2476886b2235d48f058104d555a4b..d8798dfce4955051b9fc69abc29ebbb761024ad3 100755 --- a/Code/FeatureExtraction/otbCorrelationTextureFunctor.h +++ b/Code/FeatureExtraction/otbCorrelationTextureFunctor.h @@ -61,13 +61,13 @@ public: double sumProb = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s])*areaInv; - sumProb += p; - double pixProd = ( (static_cast<double>(r)+0.5)*this->GetOffsetBinLength() ) * ( (static_cast<double>(s)+0.5)*this->GetNeighBinLength() ); - out += pixProd * p; - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s])*areaInv; + sumProb += p; + double pixProd = ( (static_cast<double>(r)+0.5)*this->GetOffsetBinLength() ) * ( (static_cast<double>(s)+0.5)*this->GetNeighBinLength() ); + out += pixProd * p; + } } double meanPOff = sumProb/static_cast<double>(this->GetHisto().size()); @@ -77,12 +77,12 @@ public: double stdPOff = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - sumTemp += this->GetHisto()[r][s]*areaInv; - } - stdPOff += vcl_pow( (meanPOff-sumTemp), 2); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + sumTemp += this->GetHisto()[r][s]*areaInv; + } + stdPOff += vcl_pow( (meanPOff-sumTemp), 2); } stdPOff /= this->GetHisto().size(); stdPOff = vcl_sqrt(stdPOff); @@ -91,19 +91,19 @@ public: double stdPNeigh = 0.; for (unsigned r = 0; r<this->GetHisto()[0].size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto().size(); s++) - { - sumTemp += this->GetHisto()[s][r]*areaInv; - } - stdPNeigh += vcl_pow( (meanPNeigh-sumTemp), 2); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto().size(); s++) + { + sumTemp += this->GetHisto()[s][r]*areaInv; + } + stdPNeigh += vcl_pow( (meanPNeigh-sumTemp), 2); } stdPNeigh /= this->GetHisto()[0].size(); stdPNeigh = vcl_sqrt(stdPNeigh); if(stdPOff*stdPNeigh != 0) - out = (out - meanPOff*meanPNeigh) / (stdPOff*stdPNeigh); + out = (out - meanPOff*meanPNeigh) / (stdPOff*stdPNeigh); return out; } diff --git a/Code/FeatureExtraction/otbDifferenceEntropyTextureFunctor.h b/Code/FeatureExtraction/otbDifferenceEntropyTextureFunctor.h index 712f9c80114f7fedefed4a6aafa81028d3d8aadc..c7261cb82731dfcc1c66d9ebe8c5c2ea98dad65b 100755 --- a/Code/FeatureExtraction/otbDifferenceEntropyTextureFunctor.h +++ b/Code/FeatureExtraction/otbDifferenceEntropyTextureFunctor.h @@ -59,21 +59,21 @@ public: // loop over bin neighborhood values for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double Px_y = 0.; - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } - if(Px_y != 0.) - out += Px_y * vcl_log(Px_y); + double Px_y = 0.; + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } + if(Px_y != 0.) + out += Px_y * vcl_log(Px_y); } if(out != 0) diff --git a/Code/FeatureExtraction/otbDifferenceVarianceTextureFunctor.h b/Code/FeatureExtraction/otbDifferenceVarianceTextureFunctor.h index e8aa1ae3485b364ec7c31e8b82cbc4bb27368a7e..5dce287d3caa58fb5253f8660614bee0ad487ca2 100755 --- a/Code/FeatureExtraction/otbDifferenceVarianceTextureFunctor.h +++ b/Code/FeatureExtraction/otbDifferenceVarianceTextureFunctor.h @@ -58,18 +58,18 @@ public: // Computes mean Px_y for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - MeanPx_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + MeanPx_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } } MeanPx_y /= static_cast<double>(this->GetHisto()[0].size()); @@ -77,20 +77,20 @@ public: double varPx_y = 0.; for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double Px_y = 0.; - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } - varPx_y += vcl_pow((Px_y - MeanPx_y), 2); + double Px_y = 0.; + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + if( vcl_abs((static_cast<double>(s)+0.5)*this->GetNeighBinLength() - rVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } + varPx_y += vcl_pow((Px_y - MeanPx_y), 2); } return varPx_y/this->GetHisto()[0].size(); diff --git a/Code/FeatureExtraction/otbEnergyTextureFunctor.h b/Code/FeatureExtraction/otbEnergyTextureFunctor.h index 31467044b469953152e018e16220865c3934cfd6..8857ca2ebcfdd82e38d6f7c01e722fb214c2a622 100755 --- a/Code/FeatureExtraction/otbEnergyTextureFunctor.h +++ b/Code/FeatureExtraction/otbEnergyTextureFunctor.h @@ -76,12 +76,12 @@ public: offsetOff[1] = offsetOffInit[1]; offset[0] = l; for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offsetOff[1]++; - offset[1] = k; - norm = vcl_pow(static_cast<double>( ( neigh[offset] - neighOff[neighOff.GetCenterNeighborhoodIndex()] ) ), 2); - temp += norm; - } + { + offsetOff[1]++; + offset[1] = k; + norm = vcl_pow(static_cast<double>( ( neigh[offset] - neighOff[neighOff.GetCenterNeighborhoodIndex()] ) ), 2); + temp += norm; + } } temp /= area; return vcl_pow(temp, 2); diff --git a/Code/FeatureExtraction/otbEntropyTextureFunctor.h b/Code/FeatureExtraction/otbEntropyTextureFunctor.h index b4163202025f2737194b29b7fc153e7badb910ba..728d0c341178babbd94fdf3ed0a89c3f9d143c48 100755 --- a/Code/FeatureExtraction/otbEntropyTextureFunctor.h +++ b/Code/FeatureExtraction/otbEntropyTextureFunctor.h @@ -66,16 +66,16 @@ public: double areaInv = 1/area; double out = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; - if (p != 0) - out += (p * vcl_log(p)); - } - } + { + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; + if (p != 0) + out += (p * vcl_log(p)); + } + } if (out != 0.) - out = -(out); + out = -(out); return out; } diff --git a/Code/FeatureExtraction/otbInformationMeasureOfCorrelation1TextureFunctor.h b/Code/FeatureExtraction/otbInformationMeasureOfCorrelation1TextureFunctor.h index 2c7a350a44db6a63c0259057f386776577d56e42..d3d815578aed81a122e8d9621224455fb616d388 100755 --- a/Code/FeatureExtraction/otbInformationMeasureOfCorrelation1TextureFunctor.h +++ b/Code/FeatureExtraction/otbInformationMeasureOfCorrelation1TextureFunctor.h @@ -66,14 +66,14 @@ public: double HX = 0.; for (unsigned r = 0; r<this->GetHisto()[0].size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto().size(); s++) - { - sumTemp += this->GetHisto()[s][r]*areaInv; - } - PxVector.push_back( sumTemp ); - if(sumTemp != 0. ) - HX += sumTemp * vcl_log( sumTemp ); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto().size(); s++) + { + sumTemp += this->GetHisto()[s][r]*areaInv; + } + PxVector.push_back( sumTemp ); + if(sumTemp != 0. ) + HX += sumTemp * vcl_log( sumTemp ); } if ( HX != 0. ) HX = -HX; @@ -83,14 +83,14 @@ public: double HY = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - sumTemp += this->GetHisto()[r][s]*areaInv; - } - PyVector.push_back( sumTemp ); - if(sumTemp != 0. ) - HY += sumTemp * vcl_log( sumTemp ); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + sumTemp += this->GetHisto()[r][s]*areaInv; + } + PyVector.push_back( sumTemp ); + if(sumTemp != 0. ) + HY += sumTemp * vcl_log( sumTemp ); } if ( HY != 0. ) HY = -HY; @@ -100,15 +100,15 @@ public: double HXY1 = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - if( PyVector[r]*PxVector[s] != 0. ) - { - double p = this->GetHisto()[r][s]*areaInv; - HXY1 += p * vcl_log( PyVector[r]*PxVector[s] ); - } - - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + if( PyVector[r]*PxVector[s] != 0. ) + { + double p = this->GetHisto()[r][s]*areaInv; + HXY1 += p * vcl_log( PyVector[r]*PxVector[s] ); + } + + } } if ( HXY1 != 0. ) HXY1 = -HXY1; diff --git a/Code/FeatureExtraction/otbInformationMeasureOfCorrelation2TextureFunctor.h b/Code/FeatureExtraction/otbInformationMeasureOfCorrelation2TextureFunctor.h index df64f8bedd4fc9ccbea5d5c26a0c47c7c1a59efa..118e95dcfd9406eee4bcc14162e826071b79ccf8 100755 --- a/Code/FeatureExtraction/otbInformationMeasureOfCorrelation2TextureFunctor.h +++ b/Code/FeatureExtraction/otbInformationMeasureOfCorrelation2TextureFunctor.h @@ -65,38 +65,38 @@ public: // Computes HX for (unsigned r = 0; r<this->GetHisto()[0].size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto().size(); s++) - { - sumTemp += this->GetHisto()[s][r]*areaInv; - } - PxVector.push_back( sumTemp ); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto().size(); s++) + { + sumTemp += this->GetHisto()[s][r]*areaInv; + } + PxVector.push_back( sumTemp ); } // Computes HY for (unsigned r = 0; r<this->GetHisto().size(); r++) { - double sumTemp = 0.; - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - sumTemp += this->GetHisto()[r][s]*areaInv; - } - PyVector.push_back( sumTemp ); + double sumTemp = 0.; + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + sumTemp += this->GetHisto()[r][s]*areaInv; + } + PyVector.push_back( sumTemp ); } // Computes HXY2 double HXY2 = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double PxPy = PyVector[r]*PxVector[s]; - if( PxPy != 0. ) - { - HXY2 += PxPy * vcl_log( PxPy ); - } - - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double PxPy = PyVector[r]*PxVector[s]; + if( PxPy != 0. ) + { + HXY2 += PxPy * vcl_log( PxPy ); + } + + } } if ( HXY2 != 0. ) HXY2 = -HXY2; diff --git a/Code/FeatureExtraction/otbInverseDifferenceMomentTextureFunctor.h b/Code/FeatureExtraction/otbInverseDifferenceMomentTextureFunctor.h index 910c52c72d2892d817da4543346fa3fdfdaffd66..f3adc86c4a1a33b09d8fa714ca2e2ad2ab590ac8 100755 --- a/Code/FeatureExtraction/otbInverseDifferenceMomentTextureFunctor.h +++ b/Code/FeatureExtraction/otbInverseDifferenceMomentTextureFunctor.h @@ -55,15 +55,15 @@ public: double areaInv = 1/area; double out = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; - double dist = vcl_pow( ( (static_cast<double>(r)+0.5)*this->GetOffsetBinLength())-((static_cast<double>(s)+0.5)*this->GetNeighBinLength()), 2); - - out += ((1/(1+dist)) * p); - } - } + { + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; + double dist = vcl_pow( ( (static_cast<double>(r)+0.5)*this->GetOffsetBinLength())-((static_cast<double>(s)+0.5)*this->GetNeighBinLength()), 2); + + out += ((1/(1+dist)) * p); + } + } return out; } diff --git a/Code/FeatureExtraction/otbLineSegmentDetector.h b/Code/FeatureExtraction/otbLineSegmentDetector.h index e17c88a72b9d6aed55c6f25e2ba1acc557cd5031..13626b23bc60cd4acb7442a36eb8bc77a0af058d 100644 --- a/Code/FeatureExtraction/otbLineSegmentDetector.h +++ b/Code/FeatureExtraction/otbLineSegmentDetector.h @@ -42,11 +42,11 @@ namespace Functor class MagnitudeFunctor { public: - - inline TOutputPixel operator()(const TInputPixel& input) - { - return static_cast<TOutputPixel>(2*vcl_sqrt(input[0]*input[0] + input[1]*input[1] )); - } + + inline TOutputPixel operator()(const TInputPixel& input) + { + return static_cast<TOutputPixel>(2*vcl_sqrt(input[0]*input[0] + input[1]*input[1] )); + } }; /** \class OrientationFunctor @@ -57,18 +57,18 @@ namespace Functor class OrientationFunctor { public: - - inline TOutputPixel operator()(const TInputPixel& input) - { - TOutputPixel resp = static_cast<TOutputPixel>(vcl_atan2(input[0],-input[1])); - - if (resp< itk::NumericTraits<TOutputPixel>::Zero) - { - resp = -resp; - } - - return resp; - } + + inline TOutputPixel operator()(const TInputPixel& input) + { + TOutputPixel resp = static_cast<TOutputPixel>(vcl_atan2(input[0],-input[1])); + + if (resp< itk::NumericTraits<TOutputPixel>::Zero) + { + resp = -resp; + } + + return resp; + } }; }// end namespace Functor diff --git a/Code/FeatureExtraction/otbLineSegmentDetector.txx b/Code/FeatureExtraction/otbLineSegmentDetector.txx index 960e024397786c7f1865250b05f154b92ae06e36..b99f5a5d74bf0f823bc944599d5e62e7cb89a1e4 100644 --- a/Code/FeatureExtraction/otbLineSegmentDetector.txx +++ b/Code/FeatureExtraction/otbLineSegmentDetector.txx @@ -162,19 +162,19 @@ LineSegmentDetector<TInputImage,TPrecision > itk::ImageRegionIterator<OutputImageType> it(modulusImage, - modulusImage->GetRequestedRegion()); + modulusImage->GetRequestedRegion()); it.GoToBegin(); while(!it.IsAtEnd()) { OutputIndexType index = it.GetIndex(); if(static_cast<int>(index[0]) > 0 && static_cast<int>(index[0]) < m_Width-1 - && static_cast<int>(index[1]) >0 && static_cast<int>(index[1]) < m_Length-1 ) - { - unsigned int bin = static_cast<unsigned int> (it.Value()/lengthBin); - if( it.Value()- m_Threshold >1e-10 ) - tempHisto[NbBin-bin-1].push_back(it.GetIndex()); - } + && static_cast<int>(index[1]) >0 && static_cast<int>(index[1]) < m_Length-1 ) + { + unsigned int bin = static_cast<unsigned int> (it.Value()/lengthBin); + if( it.Value()- m_Threshold >1e-10 ) + tempHisto[NbBin-bin-1].push_back(it.GetIndex()); + } ++it; } @@ -199,16 +199,16 @@ LineSegmentDetector<TInputImage, TPrecision> { typename IndexVectorType::iterator ItIndexVector = (*ItCoordinateList).begin(); while(ItIndexVector != (*ItCoordinateList).end()) - { - InputIndexType index = *ItIndexVector; - - /** If the point is not yet computed */ - if(!this->IsUsed(index)) - { - this->GrowRegion(index); - } - ++ItIndexVector; - } + { + InputIndexType index = *ItIndexVector; + + /** If the point is not yet computed */ + if(!this->IsUsed(index)) + { + this->GrowRegion(index); + } + ++ItIndexVector; + } ++ItCoordinateList; } @@ -251,23 +251,23 @@ LineSegmentDetector<TInputImage, TPrecision> * Here we start building the OUTPUT :a LineSpatialObjectList. */ if(NFA > 0./** eps */) - { - //std::cout << (*itRec)[0] << " " << (*itRec)[1] << " " << (*itRec)[2] << " " << (*itRec)[3]<<std::endl; - PointListType pointList; - PointType point; - - point.SetPosition(static_cast<TPrecision>((*itRec)[0]),static_cast<TPrecision>((*itRec)[1])); - pointList.push_back(point); - point.SetPosition(static_cast<TPrecision>((*itRec)[2]),static_cast<TPrecision>((*itRec)[3])); - pointList.push_back(point); - - typename LineSpatialObjectType::Pointer line = LineSpatialObjectType::New(); - line->SetId(0); - line->SetPoints( pointList ); - line->ComputeBoundingBox(); - m_LineList->push_back(line); - pointList.clear(); - } + { + //std::cout << (*itRec)[0] << " " << (*itRec)[1] << " " << (*itRec)[2] << " " << (*itRec)[3]<<std::endl; + PointListType pointList; + PointType point; + + point.SetPosition(static_cast<TPrecision>((*itRec)[0]),static_cast<TPrecision>((*itRec)[1])); + pointList.push_back(point); + point.SetPosition(static_cast<TPrecision>((*itRec)[2]),static_cast<TPrecision>((*itRec)[3])); + pointList.push_back(point); + + typename LineSpatialObjectType::Pointer line = LineSpatialObjectType::New(); + line->SetId(0); + line->SetPoints( pointList ); + line->ComputeBoundingBox(); + m_LineList->push_back(line); + pointList.clear(); + } ++itRec; } @@ -324,8 +324,8 @@ LineSegmentDetector<TInputImage, TPrecision> if( nfa_new > NFA ) { NFA = nfa_new; - CopyRectangle(rec ,&r ); - } + CopyRectangle(rec ,&r ); + } } if( NFA > 0. ) return NFA; @@ -338,8 +338,8 @@ LineSegmentDetector<TInputImage, TPrecision> if( nfa_new > NFA ) { NFA = nfa_new; - CopyRectangle(rec ,&r ); - } + CopyRectangle(rec ,&r ); + } } if( NFA > 0. ) return NFA; @@ -349,19 +349,19 @@ LineSegmentDetector<TInputImage, TPrecision> { if( (r[4] - delta) >= 0.5 ) { - r[0] += -vcl_sin(r[5]) * delta_2; - r[1] += vcl_cos(r[5])* delta_2; - r[2] += -vcl_sin(r[5])* delta_2; - r[3] += vcl_cos(r[5])* delta_2; - r[4] -= delta; - - nfa_new = this->ComputeRectNFA(r); - if( nfa_new > NFA ) - { - NFA = nfa_new; - CopyRectangle(rec ,&r ); - } - } + r[0] += -vcl_sin(r[5]) * delta_2; + r[1] += vcl_cos(r[5])* delta_2; + r[2] += -vcl_sin(r[5])* delta_2; + r[3] += vcl_cos(r[5])* delta_2; + r[4] -= delta; + + nfa_new = this->ComputeRectNFA(r); + if( nfa_new > NFA ) + { + NFA = nfa_new; + CopyRectangle(rec ,&r ); + } + } } if( NFA > 0. ) return NFA; @@ -370,19 +370,19 @@ LineSegmentDetector<TInputImage, TPrecision> { if( (r[4] - delta) >= 0.5 ) { - r[0] -= -vcl_sin(r[5]) * delta_2; - r[1] -= vcl_cos(r[5])* delta_2; - r[2] -= -vcl_sin(r[5])* delta_2; - r[3] -= vcl_cos(r[5])* delta_2; - r[4] -= delta; - - nfa_new = this->ComputeRectNFA(r); - if( nfa_new > NFA ) - { - NFA = nfa_new; - CopyRectangle(rec ,&r ); - } - } + r[0] -= -vcl_sin(r[5]) * delta_2; + r[1] -= vcl_cos(r[5])* delta_2; + r[2] -= -vcl_sin(r[5])* delta_2; + r[3] -= vcl_cos(r[5])* delta_2; + r[4] -= delta; + + nfa_new = this->ComputeRectNFA(r); + if( nfa_new > NFA ) + { + NFA = nfa_new; + CopyRectangle(rec ,&r ); + } + } } if( NFA > 0. ) return NFA; @@ -395,9 +395,9 @@ LineSegmentDetector<TInputImage, TPrecision> nfa_new = this->ComputeRectNFA(r); if( nfa_new > NFA ) { - NFA = nfa_new; - CopyRectangle(rec ,&r ); - } + NFA = nfa_new; + CopyRectangle(rec ,&r ); + } } if( NFA > 0. ) return NFA; @@ -420,7 +420,7 @@ LineSegmentDetector<TInputImage, TPrecision> typename NeighborhoodLabelIteratorType::SizeType radiusLabel; radiusLabel.Fill(0); NeighborhoodLabelIteratorType itLabel(radiusLabel,m_UsedPointImage, - m_UsedPointImage->GetRequestedRegion()); + m_UsedPointImage->GetRequestedRegion()); itLabel.SetLocation(index); if(*(itLabel.GetCenterValue()) == 1) @@ -443,7 +443,7 @@ LineSegmentDetector<TInputImage, TPrecision> typename NeighborhoodLabelIteratorType::SizeType radiusLabel; radiusLabel.Fill(0); NeighborhoodLabelIteratorType itLabel(radiusLabel,m_UsedPointImage, - m_UsedPointImage->GetRequestedRegion()); + m_UsedPointImage->GetRequestedRegion()); itLabel.SetLocation(index); itLabel.SetCenterPixel(1); // 1 : Set the point status to : Used Point } @@ -466,9 +466,9 @@ LineSegmentDetector<TInputImage, TPrecision> typename NeighborhoodIteratorType::SizeType radius; radius.Fill(1); NeighborhoodIteratorType itNeigh(radius,m_MagnitudeFilter->GetOutput(), - m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); + m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); NeighborhoodIteratorType itNeighDir(radius,m_OrientationFilter->GetOutput() , - m_OrientationFilter->GetOutput()->GetRequestedRegion()); + m_OrientationFilter->GetOutput()->GetRequestedRegion()); /** Vector where to store the point belonging to the current region*/ unsigned int neighSize = itNeigh.GetSize()[0]*itNeigh.GetSize()[1]; @@ -495,20 +495,20 @@ LineSegmentDetector<TInputImage, TPrecision> unsigned int s = 0; while(s < neighSize ) - { - InputIndexType NeighIndex = itNeigh.GetIndex(s); - double angleComp = itNeighDir.GetPixel(s); - - if( !this->IsUsed(NeighIndex) && this->IsAligned(angleComp, regionAngle, m_Prec) ) - { - if(this->GetInput()->GetRequestedRegion().IsInside(NeighIndex)) /** Check if the index is inside the image*/ - { - this->SetPixelToUsed(NeighIndex); - reg.push_back(NeighIndex); - } - } - s++; - } + { + InputIndexType NeighIndex = itNeigh.GetIndex(s); + double angleComp = itNeighDir.GetPixel(s); + + if( !this->IsUsed(NeighIndex) && this->IsAligned(angleComp, regionAngle, m_Prec) ) + { + if(this->GetInput()->GetRequestedRegion().IsInside(NeighIndex)) /** Check if the index is inside the image*/ + { + this->SetPixelToUsed(NeighIndex); + reg.push_back(NeighIndex); + } + } + s++; + } }/** End Searching loop*/ /** Store the region*/ @@ -559,7 +559,7 @@ LineSegmentDetector<TInputImage, TPrecision> typename NeighborhoodIteratorType::SizeType radius; radius.Fill(0); NeighborhoodIteratorType itNeigh(radius,m_MagnitudeFilter->GetOutput(), - m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); + m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); /** Computing the center of the rectangle*/ IndexVectorIteratorType it = region.begin(); @@ -686,7 +686,7 @@ LineSegmentDetector<TInputImage, TPrecision> typename NeighborhoodIteratorType::SizeType radius; radius.Fill(0); NeighborhoodIteratorType itNeigh(radius,m_MagnitudeFilter->GetOutput(), - m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); + m_MagnitudeFilter->GetOutput()->GetRequestedRegion()); /** Computing the center iof the rectangle*/ IndexVectorIteratorType it = region.begin(); @@ -813,12 +813,12 @@ LineSegmentDetector<TInputImage, TPrecision> while(!it.IsAtEnd()) { if( rectangle->IsInside( it.GetIndex()) && m_OrientationFilter->GetOutput()->GetRequestedRegion().IsInside( it.GetIndex()) ) - { - pts++; + { + pts++; - if(this->IsAligned(it.Get(), rec[5] /*theta*/ ,rec[6] /*Prec*/)) - NbAligned++; - } + if(this->IsAligned(it.Get(), rec[5] /*theta*/ ,rec[6] /*Prec*/)) + NbAligned++; + } ++it; } @@ -926,8 +926,8 @@ LineSegmentDetector<TInputImage, TPrecision> { double x,y,tmp,ser; static double cof[6]={76.18009172947146,-86.50532032941677, - 24.01409824083091,-1.231739572450155, - 0.1208650973866179e-2,-0.5395239384953e-5}; + 24.01409824083091,-1.231739572450155, + 0.1208650973866179e-2,-0.5395239384953e-5}; int j; y=x=xx; diff --git a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx index 79d3e3988b7cdaf04b0c06c416459311fde141d7..4f93f109f1272fd51f51424a69364a43fcddb210 100644 --- a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx +++ b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx @@ -98,39 +98,39 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet> InputLinesListTypeIterator itLinesListCurEnd = inputLinesList->end(); while(itLinesListCur != itLinesListCurEnd ) - { - /** Check If segments are already computed */ - if( segmentsUsedMatrix[counterTest][counterCur]== 0 && segmentsUsedMatrix[counterCur][counterTest] == 0 ) - { - /** Set the segments to USED (== 1)*/ - segmentsUsedMatrix[counterTest][counterCur] = 1; - segmentsUsedMatrix[counterCur][counterTest] = 1; - - /** Compute the distance from CurLine to DstLine*/ - float SegmentDist = this->ComputeDistanceBetweenSegments(*itLinesListTest , *itLinesListCur); - - /** Check if the distance separating the segments is under the threshold*/ - if(SegmentDist < m_ThresholdDistance /* Threshold : 5 Pixels*/) - { - /** Compute the angle formed by the two segments */ - float Angle = this->ComputeAngleFormedBySegments(*itLinesListTest, *itLinesListCur); - - /** Check if the angle is a right one */ - if(vcl_abs(Angle - M_PI/2.) <= m_ThresholdAngle ) - { - /** Right angle coordinate*/ - PointType RightAngleCoordinate; - RightAngleCoordinate = this->ComputeAngleRightCoordinate(*itLinesListTest, *itLinesListCur); - - /** If Right Angle: Add it to the pointSet*/ - this->AddRightAngleToPointSet(RightAngleCoordinate , *itLinesListTest , *itLinesListCur ); - - } - } - } - counterCur++; - ++itLinesListCur; - } + { + /** Check If segments are already computed */ + if( segmentsUsedMatrix[counterTest][counterCur]== 0 && segmentsUsedMatrix[counterCur][counterTest] == 0 ) + { + /** Set the segments to USED (== 1)*/ + segmentsUsedMatrix[counterTest][counterCur] = 1; + segmentsUsedMatrix[counterCur][counterTest] = 1; + + /** Compute the distance from CurLine to DstLine*/ + float SegmentDist = this->ComputeDistanceBetweenSegments(*itLinesListTest , *itLinesListCur); + + /** Check if the distance separating the segments is under the threshold*/ + if(SegmentDist < m_ThresholdDistance /* Threshold : 5 Pixels*/) + { + /** Compute the angle formed by the two segments */ + float Angle = this->ComputeAngleFormedBySegments(*itLinesListTest, *itLinesListCur); + + /** Check if the angle is a right one */ + if(vcl_abs(Angle - M_PI/2.) <= m_ThresholdAngle ) + { + /** Right angle coordinate*/ + PointType RightAngleCoordinate; + RightAngleCoordinate = this->ComputeAngleRightCoordinate(*itLinesListTest, *itLinesListCur); + + /** If Right Angle: Add it to the pointSet*/ + this->AddRightAngleToPointSet(RightAngleCoordinate , *itLinesListTest , *itLinesListCur ); + + } + } + } + counterCur++; + ++itLinesListCur; + } counterTest++; ++itLinesListTest; } @@ -203,20 +203,20 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet> InputIndexType IndexCur = itLine.GetIndex(); if(this->GetInputImage()->GetRequestedRegion().IsInside(IndexCur) ) - { - float xp = static_cast<float>(itLine.GetIndex()[0]); - float yp = static_cast<float>(itLine.GetIndex()[1]); - float Num = vcl_abs(xp*(Yq1-Yq2) + yp*(Xq2-Xq1) + CrossProduct); - - /** distance from Point P to Segment Q1Q2*/ - float CurDistance = Num/SegmentLength; - - if(CurDistance < MinDistance ) - MinDistance = CurDistance; - - if(MinDistance < 1e-50) //MinDistance supposed to be positive - return 0.; - } + { + float xp = static_cast<float>(itLine.GetIndex()[0]); + float yp = static_cast<float>(itLine.GetIndex()[1]); + float Num = vcl_abs(xp*(Yq1-Yq2) + yp*(Xq2-Xq1) + CrossProduct); + + /** distance from Point P to Segment Q1Q2*/ + float CurDistance = Num/SegmentLength; + + if(CurDistance < MinDistance ) + MinDistance = CurDistance; + + if(MinDistance < 1e-50) //MinDistance supposed to be positive + return 0.; + } ++itLine; } diff --git a/Code/FeatureExtraction/otbMeanTextureFunctor.h b/Code/FeatureExtraction/otbMeanTextureFunctor.h index bccc370fb128a44bd70834898969f3ba3c24a892..c6837e32a4351218a702ad97d2e56289acd8b658 100755 --- a/Code/FeatureExtraction/otbMeanTextureFunctor.h +++ b/Code/FeatureExtraction/otbMeanTextureFunctor.h @@ -55,13 +55,13 @@ public: double areaInv = 1/area; double out = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; - out += (static_cast<double>(s)+0.5)*this->GetNeighBinLength() * p; - } - } + { + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; + out += (static_cast<double>(s)+0.5)*this->GetNeighBinLength() * p; + } + } return out; } diff --git a/Code/FeatureExtraction/otbPanTexTextureFunctor.h b/Code/FeatureExtraction/otbPanTexTextureFunctor.h index 0a6e5469087088e8bb10a5b7ab07b40008ac16cd..93cd2fdd402aef53ae0a58348957bf715ddbaaae 100644 --- a/Code/FeatureExtraction/otbPanTexTextureFunctor.h +++ b/Code/FeatureExtraction/otbPanTexTextureFunctor.h @@ -93,12 +93,12 @@ public: double out = itk::NumericTraits<double>::max(); Superclass contrast; for(unsigned int k=0; k<m_OffsetList.size(); k++) - { - contrast.SetOffset( m_OffsetList[k] ); - double res = contrast.ComputeOverSingleChannel(neigh, neighOff); - if(res<out) - out=res; - } + { + contrast.SetOffset( m_OffsetList[k] ); + double res = contrast.ComputeOverSingleChannel(neigh, neighOff); + if(res<out) + out=res; + } return out; diff --git a/Code/FeatureExtraction/otbSFSTexturesFunctor.h b/Code/FeatureExtraction/otbSFSTexturesFunctor.h index 8e4365e92e95c92305ca4fc4306a566859fa7d95..dc8e042e6fb3d3cda1955dc00a3acd655515f50d 100644 --- a/Code/FeatureExtraction/otbSFSTexturesFunctor.h +++ b/Code/FeatureExtraction/otbSFSTexturesFunctor.h @@ -121,72 +121,72 @@ public: for( unsigned int d = 0; d<m_NumberOfDirections; d++ ) { - // Current angle direction - angle = m_Alpha*static_cast<double>(d); - - // last offset in the diraction respecting spatial threshold - off[0] = static_cast<int>(vcl_floor(SpatialThresholdDouble*vcl_cos( angle ) + 0.5)); - off[1] = static_cast<int>(vcl_floor(SpatialThresholdDouble*vcl_sin( angle ) + 0.5)); - // last indices in the diration respecting spectral threshold - OffsetType offEnd = this->FindLastOffset( it, off ); - // computes distance = dist between the 2 segment point. One of them is the center pixel -> (0,0) - dist = vcl_sqrt( vcl_pow(static_cast<double>(offEnd[0]), 2 ) + vcl_pow(static_cast<double>(offEnd[1]), 2 ) ); - - // for length computation - if( m_SelectedTextures[0] == true ) - if( dist>length ) - length = dist; - - // for width computation - if( m_SelectedTextures[1] == true ) - if( dist<width) - width = dist; - - // for PSI computation - if( m_SelectedTextures[2] == true || m_SelectedTextures[5] == true ) - sum += dist; - - // for w-mean computation - if( m_SelectedTextures[3] == true ) - sdiVal = this->ComputeSDi(it, offEnd); - - // for Ratio computation - if( m_SelectedTextures[4] == true ) - { - bool doo = false; - itVector = maxSorted.begin(); - while( itVector != maxSorted.end() && doo==false ) - { - if( dist>(*itVector) ) - { - maxSorted.insert(itVector, dist); - maxSorted.pop_back(); - doo=true; - } - ++itVector; - } - doo = false; - itVector = minSorted.begin(); - while( itVector != minSorted.end() && doo==false ) - { - if( dist<(*itVector) ) - { - minSorted.insert(itVector, dist); - minSorted.pop_back(); - doo=true; - } - ++itVector; - } - } - - di[d] = dist; - if( m_SelectedTextures[3] == true ) - { - lengthLine[d] = static_cast<unsigned int>(dist);//static_cast<unsigned int>( vcl_sqrt(vcl_pow(static_cast<double>(offEnd[0]), 2) + vcl_pow(static_cast<double>(offEnd[1]), 2)) ); - sti[d] = sdiVal; - if(sdiVal!=0.) - sumWMean += (m_Alpha*(dist-1)*dist/*lengthLine[n]*di[n]*/)/sdiVal; - } + // Current angle direction + angle = m_Alpha*static_cast<double>(d); + + // last offset in the diraction respecting spatial threshold + off[0] = static_cast<int>(vcl_floor(SpatialThresholdDouble*vcl_cos( angle ) + 0.5)); + off[1] = static_cast<int>(vcl_floor(SpatialThresholdDouble*vcl_sin( angle ) + 0.5)); + // last indices in the diration respecting spectral threshold + OffsetType offEnd = this->FindLastOffset( it, off ); + // computes distance = dist between the 2 segment point. One of them is the center pixel -> (0,0) + dist = vcl_sqrt( vcl_pow(static_cast<double>(offEnd[0]), 2 ) + vcl_pow(static_cast<double>(offEnd[1]), 2 ) ); + + // for length computation + if( m_SelectedTextures[0] == true ) + if( dist>length ) + length = dist; + + // for width computation + if( m_SelectedTextures[1] == true ) + if( dist<width) + width = dist; + + // for PSI computation + if( m_SelectedTextures[2] == true || m_SelectedTextures[5] == true ) + sum += dist; + + // for w-mean computation + if( m_SelectedTextures[3] == true ) + sdiVal = this->ComputeSDi(it, offEnd); + + // for Ratio computation + if( m_SelectedTextures[4] == true ) + { + bool doo = false; + itVector = maxSorted.begin(); + while( itVector != maxSorted.end() && doo==false ) + { + if( dist>(*itVector) ) + { + maxSorted.insert(itVector, dist); + maxSorted.pop_back(); + doo=true; + } + ++itVector; + } + doo = false; + itVector = minSorted.begin(); + while( itVector != minSorted.end() && doo==false ) + { + if( dist<(*itVector) ) + { + minSorted.insert(itVector, dist); + minSorted.pop_back(); + doo=true; + } + ++itVector; + } + } + + di[d] = dist; + if( m_SelectedTextures[3] == true ) + { + lengthLine[d] = static_cast<unsigned int>(dist);//static_cast<unsigned int>( vcl_sqrt(vcl_pow(static_cast<double>(offEnd[0]), 2) + vcl_pow(static_cast<double>(offEnd[1]), 2)) ); + sti[d] = sdiVal; + if(sdiVal!=0.) + sumWMean += (m_Alpha*(dist-1)*dist/*lengthLine[n]*di[n]*/)/sdiVal; + } } /////// FILL OUTPUT @@ -205,25 +205,25 @@ public: // ratio if( m_SelectedTextures[4] == true ) { - double sumMin = 0; - double sumMax = 0; - for(unsigned int t=0; t<m_RatioMaxConsiderationNumber ; t++) - { - sumMin += minSorted[t]; - sumMax += maxSorted[t]; - } - if (sumMax != 0.) - out[4] = static_cast<OutputValueType>(vcl_atan(sumMin/sumMax)); - else if (sumMax == 0. && sumMin == 0.) - out[4] = static_cast<OutputValueType>(1.); + double sumMin = 0; + double sumMax = 0; + for(unsigned int t=0; t<m_RatioMaxConsiderationNumber ; t++) + { + sumMin += minSorted[t]; + sumMax += maxSorted[t]; + } + if (sumMax != 0.) + out[4] = static_cast<OutputValueType>(vcl_atan(sumMin/sumMax)); + else if (sumMax == 0. && sumMin == 0.) + out[4] = static_cast<OutputValueType>(1.); } // SD if( m_SelectedTextures[5] == true ) { - double sumPSI = 0; - for(unsigned int n=0; n<di.size(); n++) - sumPSI += vcl_pow(di[n] - sumWMean/NumberOfDirectionsDouble , 2); - out[5] = static_cast<OutputValueType>(vcl_sqrt(sumPSI)/(NumberOfDirectionsDouble-1.)); + double sumPSI = 0; + for(unsigned int n=0; n<di.size(); n++) + sumPSI += vcl_pow(di[n] - sumWMean/NumberOfDirectionsDouble , 2); + out[5] = static_cast<OutputValueType>(vcl_sqrt(sumPSI)/(NumberOfDirectionsDouble-1.)); } return out; @@ -236,7 +236,7 @@ public: * respect the spectral condition. */ OffsetType FindLastOffset( const TIter & it, const OffsetType & stopOffset ) - { + { bool res = true; int signX = this->ComputeStep( stopOffset[0] ); int signY = this->ComputeStep( stopOffset[1] ); @@ -247,22 +247,22 @@ public: double slop = 0.; if(stopOffset[0]!=0) - slop = static_cast<double>(stopOffset[1] / static_cast<double>(stopOffset[0]) ); + slop = static_cast<double>(stopOffset[1] / static_cast<double>(stopOffset[0]) ); bool isInside = true; - while( isInside == true && res == true) - { - this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); - - if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) > m_SpectralThreshold ) - { - res = false; - } - else - currentOff[0]+=signX; + while( isInside == true && res == true) + { + this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); + + if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) > m_SpectralThreshold ) + { + res = false; + } + else + currentOff[0]+=signX; - isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); - } + isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); + } return currentOff; } @@ -277,7 +277,7 @@ public: double mean = 0.; double slop = 0.; if(stopOffset[0] != 0) - slop = static_cast<double>(stopOffset[1] / static_cast<double>(stopOffset[0]) ); + slop = static_cast<double>(stopOffset[1] / static_cast<double>(stopOffset[0]) ); int signX = this->ComputeStep( stopOffset[0] ); int signY = this->ComputeStep( stopOffset[1] ); @@ -289,19 +289,19 @@ public: bool isInside = true; // First compute mean while( isInside == true && canGo == true ) - { - this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); - - mean += static_cast<double>(it.GetPixel(currentOff)); - nbElt++; - - if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) >= m_SpectralThreshold ) - canGo = false; - else - currentOff[0]+=signX; - - isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); - } + { + this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); + + mean += static_cast<double>(it.GetPixel(currentOff)); + nbElt++; + + if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) >= m_SpectralThreshold ) + canGo = false; + else + currentOff[0]+=signX; + + isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); + } mean /= static_cast<double>(nbElt); currentOff[0] = signX; @@ -309,18 +309,18 @@ public: isInside = true; while( isInside == true && canGo == true ) - { - this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); + { + this->ComputePointLine( currentOff, slop, signY, stopOffset[0] ); - SDi += vcl_pow((static_cast<double>(it.GetPixel(currentOff)) - mean), 2); - if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) >= m_SpectralThreshold ) - canGo = false; - else - currentOff[0]+=signX; + SDi += vcl_pow((static_cast<double>(it.GetPixel(currentOff)) - mean), 2); + if( vcl_abs(it.GetPixel(currentOff)-it.GetCenterPixel()) >= m_SpectralThreshold ) + canGo = false; + else + currentOff[0]+=signX; - isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); + isInside = this->CheckIsInside(signX, signY, currentOff, stopOffset); - } + } return vcl_sqrt(SDi); } @@ -330,9 +330,9 @@ public: { bool isInside = true; if( signX*currentOff[0]>=signX*stopOffset[0] && stopOffset[0]!=0) - isInside = false; + isInside = false; else if( signY*currentOff[1]>=signY*stopOffset[1] && stopOffset[1] != 0 ) - isInside = false; + isInside = false; return isInside; } @@ -344,9 +344,9 @@ public: void ComputePointLine( OffsetType & currentOff, const double & slop, const int & signY, const int & stopOffsetX ) { if(stopOffsetX!=0) - currentOff[1] = static_cast<int>( vcl_floor( slop*static_cast<double>(currentOff[0]) + 0.5 )); + currentOff[1] = static_cast<int>( vcl_floor( slop*static_cast<double>(currentOff[0]) + 0.5 )); else - currentOff[1]+=signY; + currentOff[1]+=signY; } @@ -357,7 +357,7 @@ public: { int sign = 1; if(stopOffset<0) - sign = -1; + sign = -1; return sign; } diff --git a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h index faa9f3e7c6c0bc2fafeff19a24f9dbe021d1af3d..06dbc033ba941c156be5cf0dff7b2623c061bc7f 100644 --- a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h +++ b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h @@ -167,12 +167,12 @@ public: void SetFeatureStatus(FeatureType id, bool isSelected ) { if ( static_cast<unsigned int>(id) > this->GetTexturesStatus().size() || id == 0 ) - { - itkExceptionMacro(<<"Invalid texture index "<<id<<", must be in [1;"<<this->GetTexturesStatus().size()<<"]"); - } + { + itkExceptionMacro(<<"Invalid texture index "<<id<<", must be in [1;"<<this->GetTexturesStatus().size()<<"]"); + } else - { - this->GetFunctor().SetTextureStatus( id-1, isSelected ); + { + this->GetFunctor().SetTextureStatus( id-1, isSelected ); } } diff --git a/Code/FeatureExtraction/otbSFSTexturesImageFilter.txx b/Code/FeatureExtraction/otbSFSTexturesImageFilter.txx index 91993097e72e835ae1c5fd3b81dc63bbb2d735c0..f96cac93ee819f9e109f57c6bb36d8181e3bd8d4 100644 --- a/Code/FeatureExtraction/otbSFSTexturesImageFilter.txx +++ b/Code/FeatureExtraction/otbSFSTexturesImageFilter.txx @@ -258,8 +258,8 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> if(this->GetSpatialThreshold() < this->GetRatioMaxConsiderationNumber()) { itkExceptionMacro(<<"Spatial Threshold ("<<this->GetSpatialThreshold() - <<") is lower than Ration Max Consideration Number (" - <<this->GetRatioMaxConsiderationNumber()<<") what is not allowed."); + <<") is lower than Ration Max Consideration Number (" + <<this->GetRatioMaxConsiderationNumber()<<") what is not allowed."); } for (int i =0; i<this->GetNumberOfThreads(); i++) { @@ -402,7 +402,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> for(unsigned int i = 0; i<outItList.size(); i++) { - (*outItList[i]).GoToBegin(); + (*outItList[i]).GoToBegin(); } while ( !outputIt1.IsAtEnd() ) @@ -410,16 +410,16 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> outputFunctor = m_FunctorList[threadId]( neighInputIt); for(unsigned int i = 0; i<outItList.size(); i++) - { - if( textStatus[i]==true ) - (*outItList[i]).Set( outputFunctor[i] ); - } + { + if( textStatus[i]==true ) + (*outItList[i]).Set( outputFunctor[i] ); + } ++neighInputIt; for(unsigned int i = 0; i<outItList.size(); i++) - { - ++(*outItList[i]); - } + { + ++(*outItList[i]); + } progress.CompletedPixel(); } @@ -432,7 +432,7 @@ SFSTexturesImageFilter<TInputImage, TOutputImage> ::InitFeatureStatus(bool status) { for (FeatureType id=LENGTH;id<=SD; - id=static_cast<FeatureType>(id+1)) + id=static_cast<FeatureType>(id+1)) { this->SetFeatureStatus(static_cast<FeatureType>(id),status); } diff --git a/Code/FeatureExtraction/otbSumAverageTextureFunctor.h b/Code/FeatureExtraction/otbSumAverageTextureFunctor.h index ae80a6421183f4c31a11df3f29c7129b1fe1987a..6e43498783fcfa5adc0c9df8f6b3316fd1785f3b 100755 --- a/Code/FeatureExtraction/otbSumAverageTextureFunctor.h +++ b/Code/FeatureExtraction/otbSumAverageTextureFunctor.h @@ -55,29 +55,29 @@ public: double out = 0.; // loop over bin neighborhood values for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) - { - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); - double Px_y = 0.; - double Px_y2 = 0.; - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); - if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } - out += nCeil * Px_y + nCeil2 * Px_y2; - } + { + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); + double Px_y = 0.; + double Px_y2 = 0.; + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); + if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } + out += nCeil * Px_y + nCeil2 * Px_y2; + } return out; } diff --git a/Code/FeatureExtraction/otbSumEntropyTextureFunctor.h b/Code/FeatureExtraction/otbSumEntropyTextureFunctor.h index 92e835f13b1543deb7ad974e84b064a70f6a226b..869e8bd8350f44902690d2ff00c5832e91a780a5 100755 --- a/Code/FeatureExtraction/otbSumEntropyTextureFunctor.h +++ b/Code/FeatureExtraction/otbSumEntropyTextureFunctor.h @@ -56,30 +56,30 @@ public: // loop over bin neighborhood values for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); - double Px_y = 0.; - double Px_y2 = 0.; - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); - if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } - if(Px_y != 0.) - out += Px_y * vcl_log(Px_y); - if(Px_y2 != 0.) - out += Px_y2 * vcl_log(Px_y2); + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); + double Px_y = 0.; + double Px_y2 = 0.; + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); + if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } + if(Px_y != 0.) + out += Px_y * vcl_log(Px_y); + if(Px_y2 != 0.) + out += Px_y2 * vcl_log(Px_y2); } diff --git a/Code/FeatureExtraction/otbSumVarianceTextureFunctor.h b/Code/FeatureExtraction/otbSumVarianceTextureFunctor.h index be391e6dc8fabc7aba8c91398fdad7180b939b27..126a50f2234295f1d94253b60255ba459ad7c3e7 100755 --- a/Code/FeatureExtraction/otbSumVarianceTextureFunctor.h +++ b/Code/FeatureExtraction/otbSumVarianceTextureFunctor.h @@ -58,27 +58,27 @@ public: double out = 0.; for (unsigned sB = 0; sB<this->GetHisto()[0].size(); sB++) { - double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); - double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); - double Px_y = 0.; - double Px_y2 = 0.; - for (unsigned r = 0; r<this->GetHisto().size(); r++) - { - double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); - if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) - { - Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; - } - } - } - out += vcl_pow((nCeil-f6), 2)*Px_y + vcl_pow((nCeil2-f6), 2)*Px_y2; + double nCeil = (static_cast<double>(sB)+0.5)*this->GetNeighBinLength(); + double nCeil2 = (static_cast<double>(sB)+this->GetHisto()[0].size()+0.5)*this->GetNeighBinLength(); + double Px_y = 0.; + double Px_y2 = 0.; + for (unsigned r = 0; r<this->GetHisto().size(); r++) + { + double rVal = (static_cast<double>(r)+0.5)*this->GetOffsetBinLength(); + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double sVal = (static_cast<double>(s)+0.5)*this->GetNeighBinLength(); + if( vcl_abs(rVal + sVal - nCeil) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + if( vcl_abs(rVal + sVal - nCeil2) < vcl_abs(this->GetNeighBinLength()) ) + { + Px_y2 += static_cast<double>(this->GetHisto()[r][s])*areaInv; + } + } + } + out += vcl_pow((nCeil-f6), 2)*Px_y + vcl_pow((nCeil2-f6), 2)*Px_y2; } return out; diff --git a/Code/FeatureExtraction/otbTextureFunctorBase.h b/Code/FeatureExtraction/otbTextureFunctorBase.h index 50152c7ecba4367b6c80481bf417c291724e15d9..bf29de9e6af9da1927e18572309d9823e8cc7783 100755 --- a/Code/FeatureExtraction/otbTextureFunctorBase.h +++ b/Code/FeatureExtraction/otbTextureFunctorBase.h @@ -120,41 +120,41 @@ public: offsetOff = offsetOffInit; for ( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) - { - offsetOff[0]++; - offsetOff[1] = offsetOffInit[1]; - offset[0] = l; - for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offsetOff[1]++; - offset[1] = k; - m_Mean += static_cast<double>(neigh[offset]); - m_MeanOff += static_cast<double>(neighOff[offsetOff]); - - m_Mini = std::min(static_cast<double>(neigh[offset]), m_Mini); - m_Maxi = std::max(static_cast<double>(neigh[offset]), m_Maxi); - m_MiniOff = std::min(static_cast<double>(neighOff[offsetOff]),m_MiniOff); - m_MaxiOff = std::max(static_cast<double>(neighOff[offsetOff]),m_MaxiOff); - } - } + { + offsetOff[0]++; + offsetOff[1] = offsetOffInit[1]; + offset[0] = l; + for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) + { + offsetOff[1]++; + offset[1] = k; + m_Mean += static_cast<double>(neigh[offset]); + m_MeanOff += static_cast<double>(neighOff[offsetOff]); + + m_Mini = std::min(static_cast<double>(neigh[offset]), m_Mini); + m_Maxi = std::max(static_cast<double>(neigh[offset]), m_Maxi); + m_MiniOff = std::min(static_cast<double>(neighOff[offsetOff]),m_MiniOff); + m_MaxiOff = std::max(static_cast<double>(neighOff[offsetOff]),m_MaxiOff); + } + } m_Mean *= areaInv; m_MeanOff *= areaInv; offsetOff = offsetOffInit; for( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) - { - offsetOff[0]++; - offsetOff[1] = offsetOffInit[1]; - offset[0] = l; - for( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offsetOff[1]++; - offset[1] = k; - binLength += vcl_pow( (m_Mean-static_cast<double>(neigh[offset])), 2); - binLengthOff += vcl_pow( (m_MeanOff-static_cast<double>(neighOff[offsetOff])), 2); - } - } + { + offsetOff[0]++; + offsetOff[1] = offsetOffInit[1]; + offset[0] = l; + for( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) + { + offsetOff[1]++; + offset[1] = k; + binLength += vcl_pow( (m_Mean-static_cast<double>(neigh[offset])), 2); + binLengthOff += vcl_pow( (m_MeanOff-static_cast<double>(neighOff[offsetOff])), 2); + } + } binLength *= areaInv; binLength = vcl_sqrt( binLength ); @@ -187,23 +187,23 @@ inline OutputScalarType operator()(const NeighborhoodType &neigh) // Extract the neighborhood area for ( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) { - offset[0] = l; - for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offset[1] = k; - inNeigh[offset] = neigh[offset];//neigh.GetPixel(offset); - } + offset[0] = l; + for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) + { + offset[1] = k; + inNeigh[offset] = neigh[offset];//neigh.GetPixel(offset); + } } // Extract the offset area offset.Fill(0); for ( int l = -static_cast<int>(radiusOff[0]); l <= static_cast<int>(radiusOff[0]); l++ ) { - offset[0] = l; - for ( int k = -static_cast<int>(radiusOff[1]); k <= static_cast<int>(radiusOff[1]); k++) - { - offset[1] = k; - offNeigh[offset] = neigh[offset];//neigh.GetPixel(offset); - } + offset[0] = l; + for ( int k = -static_cast<int>(radiusOff[1]); k <= static_cast<int>(radiusOff[1]); k++) + { + offset[1] = k; + offNeigh[offset] = neigh[offset];//neigh.GetPixel(offset); + } } OutputScalarType outPix = static_cast<OutputScalarType>( this->ComputeOverSingleChannel(inNeigh, offNeigh) ); @@ -225,34 +225,34 @@ inline OutputScalarType operator()(const NeighborhoodType &neigh) // For each channel for ( unsigned int i=0; i<neigh.GetCenterValue/*Pixel*/().GetSize(); i++ ) - { - NeighborhoodType inNeigh; - inNeigh.SetRadius(radius); - NeighborhoodType offNeigh; - offNeigh.SetRadius(radiusOff); - // Extract the neighborhood area - for ( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) - { - offset[0] = l; - for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offset[1] = k; - inNeigh[offset] = neigh[offset][i];//neigh.GetPixel(offset)[i]; - } - } - // Extract the offset area - offset.Fill(0); - for ( int l = -static_cast<int>(radiusOff[0]); l <= static_cast<int>(radiusOff[0]); l++ ) - { - offset[0] = l; - for ( int k = -static_cast<int>(radiusOff[1]); k <= static_cast<int>(radiusOff[1]); k++) - { - offset[1] = k; - offNeigh[offset] = neigh[offset][i]; - } - } - outPix[i] = static_cast<OutputScalarType>( this->ComputeOverSingleChannel(inNeigh, offNeigh) ); - } + { + NeighborhoodType inNeigh; + inNeigh.SetRadius(radius); + NeighborhoodType offNeigh; + offNeigh.SetRadius(radiusOff); + // Extract the neighborhood area + for ( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) + { + offset[0] = l; + for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) + { + offset[1] = k; + inNeigh[offset] = neigh[offset][i];//neigh.GetPixel(offset)[i]; + } + } + // Extract the offset area + offset.Fill(0); + for ( int l = -static_cast<int>(radiusOff[0]); l <= static_cast<int>(radiusOff[0]); l++ ) + { + offset[0] = l; + for ( int k = -static_cast<int>(radiusOff[1]); k <= static_cast<int>(radiusOff[1]); k++) + { + offset[1] = k; + offNeigh[offset] = neigh[offset][i]; + } + } + outPix[i] = static_cast<OutputScalarType>( this->ComputeOverSingleChannel(inNeigh, offNeigh) ); + } return outPix; } @@ -274,36 +274,36 @@ inline OutputScalarType operator()(const NeighborhoodType &neigh) IntVectorType histoTemp; if (m_NeighBinLength != 0) - histoTemp = IntVectorType( static_cast<unsigned int>(vcl_floor( static_cast<double>(this->GetMaxi()-this->GetMini())/m_NeighBinLength)+1.), 0); + histoTemp = IntVectorType( static_cast<unsigned int>(vcl_floor( static_cast<double>(this->GetMaxi()-this->GetMini())/m_NeighBinLength)+1.), 0); else - histoTemp = IntVectorType( 1, 0 ); + histoTemp = IntVectorType( 1, 0 ); if (m_OffsetBinLength != 0) m_Histo = IntVectorVectorType( static_cast<unsigned int>(vcl_floor(static_cast<double>(this->GetMaxiOff()-this->GetMiniOff())/m_OffsetBinLength)+1.), histoTemp ); else - m_Histo = IntVectorVectorType( 1, histoTemp ); + m_Histo = IntVectorVectorType( 1, histoTemp ); offsetOff = offsetOffInit; for ( int l = -static_cast<int>(radius[0]); l <= static_cast<int>(radius[0]); l++ ) - { - offsetOff[0]++; - offsetOff[1] = offsetOffInit[1]; - offset[0] = l; - for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) - { - offsetOff[1]++; - offset[1] = k; - histoIdX = 0; - histoIdY = 0; - if ( m_OffsetBinLength != 0) - histoIdX = static_cast<int>(vcl_floor( (static_cast<double>(neighOff[offsetOff])-this->GetMiniOff()) / static_cast<double>(m_OffsetBinLength) )); - if ( m_NeighBinLength !=0 ) - histoIdY = static_cast<int>(vcl_floor( (static_cast<double>(neigh[offset])-this->GetMini()) /static_cast<double>( m_NeighBinLength) )); - - m_Histo[histoIdX][histoIdY]++; - - } - } + { + offsetOff[0]++; + offsetOff[1] = offsetOffInit[1]; + offset[0] = l; + for ( int k = -static_cast<int>(radius[1]); k <= static_cast<int>(radius[1]); k++) + { + offsetOff[1]++; + offset[1] = k; + histoIdX = 0; + histoIdY = 0; + if ( m_OffsetBinLength != 0) + histoIdX = static_cast<int>(vcl_floor( (static_cast<double>(neighOff[offsetOff])-this->GetMiniOff()) / static_cast<double>(m_OffsetBinLength) )); + if ( m_NeighBinLength !=0 ) + histoIdY = static_cast<int>(vcl_floor( (static_cast<double>(neigh[offset])-this->GetMini()) /static_cast<double>( m_NeighBinLength) )); + + m_Histo[histoIdX][histoIdY]++; + + } + } } virtual double ComputeOverSingleChannel(const NeighborhoodType &neigh, const NeighborhoodType &neighOff) = 0; diff --git a/Code/FeatureExtraction/otbVarianceTextureFunctor.h b/Code/FeatureExtraction/otbVarianceTextureFunctor.h index 55f0d3016c7ef74ab81834838b75fb1e4eb53883..490e64904d8dd326ad931d91e9a1f1c34920fa9e 100755 --- a/Code/FeatureExtraction/otbVarianceTextureFunctor.h +++ b/Code/FeatureExtraction/otbVarianceTextureFunctor.h @@ -60,12 +60,12 @@ public: double out = 0.; for (unsigned r = 0; r<this->GetHisto().size(); r++) { - for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) - { - double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; - double square = vcl_pow( ( ( (static_cast<double>(s)+0.5)*this->GetNeighBinLength() ) - mean), 2); - out += square*p; - } + for (unsigned s = 0; s<this->GetHisto()[r].size(); s++) + { + double p = static_cast<double>(this->GetHisto()[r][s]) * areaInv; + double square = vcl_pow( ( ( (static_cast<double>(s)+0.5)*this->GetNeighBinLength() ) - mean), 2); + out += square*p; + } } return out; diff --git a/Code/IO/otbImageSeriesFileReader.h b/Code/IO/otbImageSeriesFileReader.h index de1b084f9f1f4c37e59643b4bc73d2f76de1e4af..f61d227887f3c9de2a12df3bba2a13076d85cfd7 100644 --- a/Code/IO/otbImageSeriesFileReader.h +++ b/Code/IO/otbImageSeriesFileReader.h @@ -2,7 +2,7 @@ Program: ORFEO Toolbox Language: C++ - Date: $Date$ + Date: $Date$ Version: $Revision$ @@ -12,9 +12,9 @@ Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved. See ITCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -42,7 +42,7 @@ namespace otb { */ template < class TImage, class TInternalImage = TImage > class ITK_EXPORT ImageSeriesFileReader - : public ImageSeriesFileReaderBase< TImage, TInternalImage > + : public ImageSeriesFileReaderBase< TImage, TInternalImage > { public: /** Standart typedefs */ @@ -58,36 +58,36 @@ class ITK_EXPORT ImageSeriesFileReader typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImagePointerType OutputImagePointerType; - typedef typename Superclass::PixelType PixelType; - typedef typename Superclass::ValueType ValueType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::RegionType RegionType; - - typedef typename Superclass::OutputImageListType OutputImageListType; - typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; + typedef typename Superclass::PixelType PixelType; + typedef typename Superclass::ValueType ValueType; + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::RegionType RegionType; + + typedef typename Superclass::OutputImageListType OutputImageListType; + typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; typedef typename Superclass::OutputImageListConstPointerType OutputImageListConstPointerType; - typedef typename Superclass::InternalImageType InternalImageType; + typedef typename Superclass::InternalImageType InternalImageType; typedef typename Superclass::InternalImagePointerType InternalImagePointerType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::InternalValueType InternalValueType; - typedef typename Superclass::InternalIndexType InternalIndexType; - typedef typename Superclass::InternalSizeType InternalSizeType; - typedef typename Superclass::InternalRegionType InternalRegionType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::InternalValueType InternalValueType; + typedef typename Superclass::InternalIndexType InternalIndexType; + typedef typename Superclass::InternalSizeType InternalSizeType; + typedef typename Superclass::InternalRegionType InternalRegionType; typedef typename Superclass::ReaderType ReaderType; typedef typename Superclass::ReaderType ReaderPointerType; - typedef typename Superclass::ReaderListType ReaderListType; + typedef typename Superclass::ReaderListType ReaderListType; typedef typename Superclass::ReaderListPointerType ReaderListPointerType; /** This is a generic template definition of the ROI extraction procedure. - * In fact, it will be specialised with: - * - MultiChannelExtractROI if TImage is a VectorImage - * - MultiToMonoChannelExtractROI if TImage is an Image and TInteranalImage is a VectorImage - * - ExtractROI if TImage and TInternalImage are of Image type. - */ + * In fact, it will be specialised with: + * - MultiChannelExtractROI if TImage is a VectorImage + * - MultiToMonoChannelExtractROI if TImage is an Image and TInteranalImage is a VectorImage + * - ExtractROI if TImage and TInternalImage are of Image type. + */ // typedef MultiChannelExtractROI< InternalPixelType, PixelType > ExtractSelectionType; // typedef MultiToMonoChannelExtractROI< InternalPixelType, PixelType > ExtractSelectionType; // typedef ExtractROI< InternalPixelType, PixelType > ExtractSelectionType; @@ -97,21 +97,21 @@ class ITK_EXPORT ImageSeriesFileReader typedef ObjectList< ExtractSelectionType > ExtractSelectionListType; typedef typename ExtractSelectionListType::Pointer ExtractSelectionListPointerType; - protected: + protected: ImageSeriesFileReader(); virtual ~ImageSeriesFileReader () { } - /** - * Tests the coherency of the Meta File (especifically band selection) with the image types - */ - virtual void TestBandSelection( std::vector<unsigned int> & bands ) { } - - /** GenerateData - * This method will be specialised if template definitions follow: - * - TImage is a VectorImage - * - TImage is an Image and TInteranalImage is a VectorImage - * - TImage and TInternalImage are of Image type. - */ + /** + * Tests the coherency of the Meta File (especifically band selection) with the image types + */ + virtual void TestBandSelection( std::vector<unsigned int> & bands ) { } + + /** GenerateData + * This method will be specialised if template definitions follow: + * - TImage is a VectorImage + * - TImage is an Image and TInteranalImage is a VectorImage + * - TImage and TInternalImage are of Image type. + */ virtual void GenerateData ( unsigned int idx ); /** @@ -123,13 +123,13 @@ class ITK_EXPORT ImageSeriesFileReader /** PrintSelf method */ void PrintSelf ( std::ostream& os, itk::Indent indent ) const - { - return Superclass::PrintSelf( os, indent ); - } + { + return Superclass::PrintSelf( os, indent ); + } - /** - * Type of extractor to use - */ + /** + * Type of extractor to use + */ ExtractSelectionListPointerType m_ExtractorList; private: @@ -150,9 +150,9 @@ class ITK_EXPORT ImageSeriesFileReader */ template < class TPixel, class TInternalPixel > class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, Image< TInternalPixel, 2 > > - : public ImageSeriesFileReaderBase< Image< TPixel, 2 >, Image< TInternalPixel, 2 > > + : public ImageSeriesFileReaderBase< Image< TPixel, 2 >, Image< TInternalPixel, 2 > > { - public: + public: /** Standart typedefs */ typedef ImageSeriesFileReader Self; typedef ImageSeriesFileReaderBase< Image< TPixel, 2 >, Image< TInternalPixel, 2 > > Superclass; @@ -166,54 +166,54 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, Image< TInternalPixe typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImagePointerType OutputImagePointerType; - typedef typename Superclass::PixelType PixelType; - typedef typename Superclass::ValueType ValueType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::RegionType RegionType; - - typedef typename Superclass::OutputImageListType OutputImageListType; - typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; + typedef typename Superclass::PixelType PixelType; + typedef typename Superclass::ValueType ValueType; + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::RegionType RegionType; + + typedef typename Superclass::OutputImageListType OutputImageListType; + typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; typedef typename Superclass::OutputImageListConstPointerType OutputImageListConstPointerType; - typedef typename Superclass::InternalImageType InternalImageType; + typedef typename Superclass::InternalImageType InternalImageType; typedef typename Superclass::InternalImagePointerType InternalImagePointerType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::InternalValueType InternalValueType; - typedef typename Superclass::InternalIndexType InternalIndexType; - typedef typename Superclass::InternalSizeType InternalSizeType; - typedef typename Superclass::InternalRegionType InternalRegionType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::InternalValueType InternalValueType; + typedef typename Superclass::InternalIndexType InternalIndexType; + typedef typename Superclass::InternalSizeType InternalSizeType; + typedef typename Superclass::InternalRegionType InternalRegionType; typedef typename Superclass::ReaderType ReaderType; typedef typename Superclass::ReaderType ReaderPointerType; - typedef typename Superclass::ReaderListType ReaderListType; + typedef typename Superclass::ReaderListType ReaderListType; typedef typename Superclass::ReaderListPointerType ReaderListPointerType; /** This is a specialised template definition of the ROI extraction procedure. - * Here TExtractSelection is a ExtractROI class since TImage and TInternalImage are of Image type. - */ + * Here TExtractSelection is a ExtractROI class since TImage and TInternalImage are of Image type. + */ typedef ExtractROI< InternalPixelType, PixelType > ExtractSelectionType; typedef typename ExtractSelectionType::Pointer ExtractSelectionPointerType; typedef ObjectList< ExtractSelectionType > ExtractSelectionListType; typedef typename ExtractSelectionListType::Pointer ExtractSelectionListPointerType; - protected: + protected: ImageSeriesFileReader(); virtual ~ImageSeriesFileReader () { } - /** - * Tests the coherency of the Meta File (especifically band selection) with the image types - */ - virtual void TestBandSelection( std::vector<unsigned int> & bands ) ; - - /** GenerateData - * This method will be specialised if template definitions follow: - * - TImage is a VectorImage - * - TImage is an Image and TInteranalImage is a VectorImage - * - TImage and TInternalImage are of Image type. - */ + /** + * Tests the coherency of the Meta File (especifically band selection) with the image types + */ + virtual void TestBandSelection( std::vector<unsigned int> & bands ) ; + + /** GenerateData + * This method will be specialised if template definitions follow: + * - TImage is a VectorImage + * - TImage is an Image and TInteranalImage is a VectorImage + * - TImage and TInternalImage are of Image type. + */ virtual void GenerateData ( unsigned int idx ); /** @@ -225,13 +225,13 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, Image< TInternalPixe /** PrintSelf method */ void PrintSelf ( std::ostream& os, itk::Indent indent ) const - { - return Superclass::PrintSelf( os, indent ); - } + { + return Superclass::PrintSelf( os, indent ); + } - /** - * Type of extractor to use - */ + /** + * Type of extractor to use + */ ExtractSelectionListPointerType m_ExtractorList; private: @@ -252,9 +252,9 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, Image< TInternalPixe */ template < class TPixel, class TInternalPixel > class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > - : public ImageSeriesFileReaderBase< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > + : public ImageSeriesFileReaderBase< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > { - public: + public: /** Standart typedefs */ typedef ImageSeriesFileReader Self; typedef ImageSeriesFileReaderBase< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > Superclass; @@ -268,54 +268,54 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TIntern typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImagePointerType OutputImagePointerType; - typedef typename Superclass::PixelType PixelType; - typedef typename Superclass::ValueType ValueType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::RegionType RegionType; - - typedef typename Superclass::OutputImageListType OutputImageListType; - typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; + typedef typename Superclass::PixelType PixelType; + typedef typename Superclass::ValueType ValueType; + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::RegionType RegionType; + + typedef typename Superclass::OutputImageListType OutputImageListType; + typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; typedef typename Superclass::OutputImageListConstPointerType OutputImageListConstPointerType; - typedef typename Superclass::InternalImageType InternalImageType; + typedef typename Superclass::InternalImageType InternalImageType; typedef typename Superclass::InternalImagePointerType InternalImagePointerType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::InternalValueType InternalValueType; - typedef typename Superclass::InternalIndexType InternalIndexType; - typedef typename Superclass::InternalSizeType InternalSizeType; - typedef typename Superclass::InternalRegionType InternalRegionType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::InternalValueType InternalValueType; + typedef typename Superclass::InternalIndexType InternalIndexType; + typedef typename Superclass::InternalSizeType InternalSizeType; + typedef typename Superclass::InternalRegionType InternalRegionType; typedef typename Superclass::ReaderType ReaderType; typedef typename Superclass::ReaderType ReaderPointerType; - typedef typename Superclass::ReaderListType ReaderListType; + typedef typename Superclass::ReaderListType ReaderListType; typedef typename Superclass::ReaderListPointerType ReaderListPointerType; /** This is a specific template definition of the ROI extraction procedure. - * MultiToMonoChannelExtractROI since TImage is an Image and TInteranalImage is a VectorImage - */ + * MultiToMonoChannelExtractROI since TImage is an Image and TInteranalImage is a VectorImage + */ typedef MultiToMonoChannelExtractROI< InternalPixelType, PixelType > ExtractSelectionType; typedef typename ExtractSelectionType::Pointer ExtractSelectionPointerType; typedef ObjectList< ExtractSelectionType > ExtractSelectionListType; typedef typename ExtractSelectionListType::Pointer ExtractSelectionListPointerType; - protected: + protected: ImageSeriesFileReader(); virtual ~ImageSeriesFileReader () { } - /** - * Tests the coherency of the Meta File (especifically band selection) with the image types - */ - virtual void TestBandSelection( std::vector<unsigned int> & bands ) ; - - /** GenerateData - * This method will be specialised if template definitions follow: - * - TImage is a VectorImage - * - TImage is an Image and TInteranalImage is a VectorImage - * - TImage and TInternalImage are of Image type. - */ + /** + * Tests the coherency of the Meta File (especifically band selection) with the image types + */ + virtual void TestBandSelection( std::vector<unsigned int> & bands ) ; + + /** GenerateData + * This method will be specialised if template definitions follow: + * - TImage is a VectorImage + * - TImage is an Image and TInteranalImage is a VectorImage + * - TImage and TInternalImage are of Image type. + */ virtual void GenerateData ( unsigned int idx ); /** @@ -327,13 +327,13 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TIntern /** PrintSelf method */ void PrintSelf ( std::ostream& os, itk::Indent indent ) const - { - return Superclass::PrintSelf( os, indent ); - } + { + return Superclass::PrintSelf( os, indent ); + } - /** - * Type of extractor to use - */ + /** + * Type of extractor to use + */ ExtractSelectionListPointerType m_ExtractorList; private: @@ -355,9 +355,9 @@ class ITK_EXPORT ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TIntern */ template < class TPixel, class TInternalPixel > class ITK_EXPORT ImageSeriesFileReader< VectorImage< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > - : public ImageSeriesFileReaderBase< VectorImage< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > + : public ImageSeriesFileReaderBase< VectorImage< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > { - public: + public: /** Standart typedefs */ typedef ImageSeriesFileReader Self; typedef ImageSeriesFileReaderBase< VectorImage< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > Superclass; @@ -371,55 +371,55 @@ class ITK_EXPORT ImageSeriesFileReader< VectorImage< TPixel, 2 >, VectorImage< T typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImagePointerType OutputImagePointerType; - typedef typename Superclass::PixelType PixelType; - typedef typename Superclass::ValueType ValueType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::RegionType RegionType; - - typedef typename Superclass::OutputImageListType OutputImageListType; - typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; + typedef typename Superclass::PixelType PixelType; + typedef typename Superclass::ValueType ValueType; + typedef typename Superclass::IndexType IndexType; + typedef typename Superclass::SizeType SizeType; + typedef typename Superclass::RegionType RegionType; + + typedef typename Superclass::OutputImageListType OutputImageListType; + typedef typename Superclass::OutputImageListPointerType OutputImageListPointerType; typedef typename Superclass::OutputImageListConstPointerType OutputImageListConstPointerType; - typedef typename Superclass::InternalImageType InternalImageType; + typedef typename Superclass::InternalImageType InternalImageType; typedef typename Superclass::InternalImagePointerType InternalImagePointerType; - typedef typename Superclass::InternalPixelType InternalPixelType; - typedef typename Superclass::InternalValueType InternalValueType; - typedef typename Superclass::InternalIndexType InternalIndexType; - typedef typename Superclass::InternalSizeType InternalSizeType; - typedef typename Superclass::InternalRegionType InternalRegionType; + typedef typename Superclass::InternalPixelType InternalPixelType; + typedef typename Superclass::InternalValueType InternalValueType; + typedef typename Superclass::InternalIndexType InternalIndexType; + typedef typename Superclass::InternalSizeType InternalSizeType; + typedef typename Superclass::InternalRegionType InternalRegionType; typedef typename Superclass::ReaderType ReaderType; typedef typename Superclass::ReaderType ReaderPointerType; - typedef typename Superclass::ReaderListType ReaderListType; + typedef typename Superclass::ReaderListType ReaderListType; typedef typename Superclass::ReaderListPointerType ReaderListPointerType; /** This is a specific template definition of the ROI extraction procedure. - * Here, it will be specialised with: - * MultiChannelExtractROI if TImage is a VectorImage - */ + * Here, it will be specialised with: + * MultiChannelExtractROI if TImage is a VectorImage + */ typedef MultiChannelExtractROI< InternalPixelType, PixelType > ExtractSelectionType; typedef typename ExtractSelectionType::Pointer ExtractSelectionPointerType; typedef ObjectList< ExtractSelectionType > ExtractSelectionListType; typedef typename ExtractSelectionListType::Pointer ExtractSelectionListPointerType; - protected: + protected: ImageSeriesFileReader(); virtual ~ImageSeriesFileReader () { } - /** - * Tests the coherency of the Meta File (especifically band selection) with the image types - */ - virtual void TestBandSelection( std::vector<unsigned int> & bands ){ } - - /** GenerateData - * This method will be specialised if template definitions follow: - * - TImage is a VectorImage - * - TImage is an Image and TInteranalImage is a VectorImage - * - TImage and TInternalImage are of Image type. - */ + /** + * Tests the coherency of the Meta File (especifically band selection) with the image types + */ + virtual void TestBandSelection( std::vector<unsigned int> & bands ){ } + + /** GenerateData + * This method will be specialised if template definitions follow: + * - TImage is a VectorImage + * - TImage is an Image and TInteranalImage is a VectorImage + * - TImage and TInternalImage are of Image type. + */ virtual void GenerateData ( unsigned int idx ); /** @@ -431,13 +431,13 @@ class ITK_EXPORT ImageSeriesFileReader< VectorImage< TPixel, 2 >, VectorImage< T /** PrintSelf method */ void PrintSelf ( std::ostream& os, itk::Indent indent ) const - { - return Superclass::PrintSelf( os, indent ); - } + { + return Superclass::PrintSelf( os, indent ); + } - /** - * Type of extractor to use - */ + /** + * Type of extractor to use + */ ExtractSelectionListPointerType m_ExtractorList; private: diff --git a/Code/IO/otbImageSeriesFileReader.txx b/Code/IO/otbImageSeriesFileReader.txx index 0d49de28e0240714aaa004f5e26c530233c5a7dd..d8c5966d8a67fc48a62d4f133d297a760a46db9d 100644 --- a/Code/IO/otbImageSeriesFileReader.txx +++ b/Code/IO/otbImageSeriesFileReader.txx @@ -2,7 +2,7 @@ Program: ORFEO Toolbox Language: C++ - Date: $Date$ + Date: $Date$ Version: $Revision$ @@ -12,9 +12,9 @@ Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved. See ITCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -52,11 +52,11 @@ void ImageSeriesFileReader< TImage, TInternalImage > ::GenerateData( unsigned int idx ) { - itk::OStringStream msg; - msg << "Something wrong... Check the template definition of this class in the program...\n"; - msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; - ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); - throw e; + itk::OStringStream msg; + msg << "Something wrong... Check the template definition of this class in the program...\n"; + msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; + ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); + throw e; } /* ********************************************************** @@ -98,24 +98,24 @@ void ImageSeriesFileReader< Image< TPixel, 2 >, Image< TInternalPixel, 2 > > ::TestBandSelection ( std::vector<unsigned int> & bands ) { - if ( bands.size() != 1 ) - { - itk::OStringStream msg; - msg << "Unable to handle multicomponent file from Image<> class\n"; - msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; - ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); - throw e; - } - - if ( bands[0] != 1 ) - { - itk::OStringStream msg; - msg << "Unable to handle given band reading from multicomponent file with Image<> class\n"; - msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; - ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); - throw e; - } - return; + if ( bands.size() != 1 ) + { + itk::OStringStream msg; + msg << "Unable to handle multicomponent file from Image<> class\n"; + msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; + ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); + throw e; + } + + if ( bands[0] != 1 ) + { + itk::OStringStream msg; + msg << "Unable to handle given band reading from multicomponent file with Image<> class\n"; + msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; + ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); + throw e; + } + return; } /** @@ -186,15 +186,15 @@ void ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > ::TestBandSelection ( std::vector<unsigned int> & bands ) { - if ( bands.size() != 1 ) - { - itk::OStringStream msg; - msg << "Unable to handle multicomponent file from Image<> class as output\n"; - msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; - ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); - throw e; - } - return; + if ( bands.size() != 1 ) + { + itk::OStringStream msg; + msg << "Unable to handle multicomponent file from Image<> class as output\n"; + msg << "\"ENVI META FILE\" FileName: " << this->m_FileName << "\n"; + ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); + throw e; + } + return; } /** @@ -214,7 +214,7 @@ ImageSeriesFileReader< Image< TPixel, 2 >, VectorImage< TInternalPixel, 2 > > = static_cast<ExtractSelectionType*>( this->m_ExtractorList->GetNthElement( idx ) ); selection->SetExtractionRegion( this->m_ListOfRegionSelection[ idx ] ); - selection->SetChannel( this->m_ListOfBandSelection[ idx ][0] ); + selection->SetChannel( this->m_ListOfBandSelection[ idx ][0] ); selection->SetInput( reader->GetOutput() ); selection->GraftOutput( this->m_OutputList->GetNthElement( idx ) ); @@ -274,12 +274,12 @@ ImageSeriesFileReader< VectorImage< TPixel, 2 >, VectorImage< TInternalPixel, 2 selection->SetExtractionRegion( this->m_ListOfRegionSelection[ idx ] ); - for ( std::vector<unsigned int>::iterator band = this->m_ListOfBandSelection[ idx ].begin(); - band != this->m_ListOfBandSelection[ idx ].end(); - ++band ) - { - selection->SetChannel( *band ); - } + for ( std::vector<unsigned int>::iterator band = this->m_ListOfBandSelection[ idx ].begin(); + band != this->m_ListOfBandSelection[ idx ].end(); + ++band ) + { + selection->SetChannel( *band ); + } selection->SetInput( reader->GetOutput() ); selection->GraftOutput( this->m_OutputList->GetNthElement( idx ) ); diff --git a/Code/IO/otbImageSeriesFileReaderBase.h b/Code/IO/otbImageSeriesFileReaderBase.h index cd06103cf4219553a9f0608f24f34b089488cbee..1ca97dd7acc54673576c708212fcab5d285cb5f3 100644 --- a/Code/IO/otbImageSeriesFileReaderBase.h +++ b/Code/IO/otbImageSeriesFileReaderBase.h @@ -2,7 +2,7 @@ Program: ORFEO Toolbox Language: C++ - Date: $Date$ + Date: $Date$ Version: $Revision$ @@ -12,9 +12,9 @@ Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved. See ITCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -121,7 +121,7 @@ class ITK_EXPORT ImageSeriesFileReaderBase : public ImageListSource< TImage > virtual OutputImageListType * GenerateOutput (void); virtual OutputImageType * GenerateOutput ( unsigned int idx ); - protected: + protected: ImageSeriesFileReaderBase(); virtual ~ImageSeriesFileReaderBase () { } @@ -132,16 +132,16 @@ class ITK_EXPORT ImageSeriesFileReaderBase : public ImageListSource< TImage > * order to add the appropriated path */ virtual void TestFileExistanceAndReadability( std::string & file, FileType fileType ); - virtual void TestBandSelection( std::vector<unsigned int> & bands ) { } + virtual void TestBandSelection( std::vector<unsigned int> & bands ) { } virtual void GenerateData ( void ); - /** GenerateData - * This method will be specialised if template definitions follow: - * - TImage is a VectorImage - * - TImage is an Image and TInteranalImage is a VectorImage - * - TImage and TInternalImage are of Image type. - */ + /** GenerateData + * This method will be specialised if template definitions follow: + * - TImage is a VectorImage + * - TImage is an Image and TInteranalImage is a VectorImage + * - TImage and TInternalImage are of Image type. + */ virtual void GenerateData ( unsigned int idx ); /** @@ -167,7 +167,7 @@ class ITK_EXPORT ImageSeriesFileReaderBase : public ImageListSource< TImage > ReaderListPointerType m_ImageFileReaderList; - private: + private: ImageSeriesFileReaderBase ( const Self & ); void operator= ( const Self & ); }; // end of class diff --git a/Code/IO/otbImageSeriesFileReaderBase.txx b/Code/IO/otbImageSeriesFileReaderBase.txx index 231975464824257181a0a16870c85cedce0e044c..151673c1e06dbab9112b5b7c6162751d98c84be0 100644 --- a/Code/IO/otbImageSeriesFileReaderBase.txx +++ b/Code/IO/otbImageSeriesFileReaderBase.txx @@ -2,7 +2,7 @@ Program: ORFEO Toolbox Language: C++ - Date: $Date$ + Date: $Date$ Version: $Revision$ @@ -12,9 +12,9 @@ Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved. See ITCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -100,9 +100,9 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > std::string aLine; std::ifstream inputFile ( m_FileName.c_str(), std::ios_base::in ); - inputFile >> aLine; - if ( aLine != "ENVI" ) - { + inputFile >> aLine; + if ( aLine != "ENVI" ) + { inputFile.close(); itk::OStringStream msg; msg << "The file " << m_FileName << " is not a \"ENVI META FILE\" format\n"; @@ -112,8 +112,8 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > } inputFile >> aLine; - if ( aLine != "META" ) - { + if ( aLine != "META" ) + { inputFile.close(); itk::OStringStream msg; msg << "The file " << m_FileName << " is not a \"ENVI META FILE\" format\n"; @@ -123,8 +123,8 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > } inputFile >> aLine; - if ( aLine != "FILE" ) - { + if ( aLine != "FILE" ) + { inputFile.close(); itk::OStringStream msg; msg << "The file " << m_FileName << " is not a \"ENVI META FILE\" format\n"; @@ -134,16 +134,16 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > } while ( 1 ) - { + { /* * Reading the filenames */ do { - inputFile >> aLine; - //std::cerr << "-> '" << aLine << "'\n"; - } while ( aLine != "File" && inputFile.good() ); + inputFile >> aLine; + //std::cerr << "-> '" << aLine << "'\n"; + } while ( aLine != "File" && inputFile.good() ); - if ( inputFile.good() ) + if ( inputFile.good() ) { do { inputFile >> aLine; @@ -173,15 +173,15 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > // Or throw an exception when not found nor readable TestFileExistanceAndReadability( aLine, kImageFileName ); m_ListOfFileNames.push_back( aLine ); - std::string imageFileName = aLine; + std::string imageFileName = aLine; /* * Reading the Band number */ do { - inputFile >> aLine; - //std::cerr << "-> '" << aLine << "'\n"; - } while ( aLine != "Bands:" && inputFile.good() ); + inputFile >> aLine; + //std::cerr << "-> '" << aLine << "'\n"; + } while ( aLine != "Bands:" && inputFile.good() ); if ( !inputFile.good() ) { @@ -223,28 +223,28 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > } // Storing band selection - try { - TestBandSelection( bands ); - } - catch ( ImageSeriesFileReaderException & e ) - { - itk::OStringStream msg; - msg << e.GetDescription(); - msg << "Image FileName : " << imageFileName << "\n"; - e.SetDescription( msg.str().c_str() ); - throw e; - } - m_ListOfBandSelection.push_back( bands ); + try { + TestBandSelection( bands ); + } + catch ( ImageSeriesFileReaderException & e ) + { + itk::OStringStream msg; + msg << e.GetDescription(); + msg << "Image FileName : " << imageFileName << "\n"; + e.SetDescription( msg.str().c_str() ); + throw e; + } + m_ListOfBandSelection.push_back( bands ); /* * Reading the Region selection */ do { - inputFile >> aLine; - //std::cerr << "-> '" << aLine << "'\n"; - } while ( aLine != "Dims" && inputFile.good() ); + inputFile >> aLine; + //std::cerr << "-> '" << aLine << "'\n"; + } while ( aLine != "Dims" && inputFile.good() ); - if ( inputFile.good() ) + if ( inputFile.good() ) { do { inputFile >> aLine; @@ -316,11 +316,11 @@ void ImageSeriesFileReaderBase< TImage, TInternalImage > ::GenerateData( unsigned int idx ) { - itk::OStringStream msg; - msg << "Something wrong... Check the template definition of this class in the program...\n"; - msg << "\"ENVI META FILE\" FileName: " << m_FileName << "\n"; - ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); - throw e; + itk::OStringStream msg; + msg << "Something wrong... Check the template definition of this class in the program...\n"; + msg << "\"ENVI META FILE\" FileName: " << m_FileName << "\n"; + ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION); + throw e; } template < class TImage, class TInternalImage > @@ -340,8 +340,8 @@ typename ImageSeriesFileReaderBase< TImage, TInternalImage >::OutputImageListTyp ImageSeriesFileReaderBase< TImage, TInternalImage > ::GenerateOutput() { - this->Update(); - return this->GetOutput(); + this->Update(); + return this->GetOutput(); } template < class TImage, class TInternalImage > @@ -349,8 +349,8 @@ typename ImageSeriesFileReaderBase< TImage, TInternalImage >::OutputImageType * ImageSeriesFileReaderBase< TImage, TInternalImage > ::GenerateOutput( unsigned int idx ) { - this->GenerateData( idx ); - return this->GetOutput( idx ); + this->GenerateData( idx ); + return this->GetOutput( idx ); } @@ -364,7 +364,7 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > if ( m_ListOfFileNames.size() > 0 ) { - std::vector< std::vector< unsigned int > >::const_iterator bandSelection = m_ListOfBandSelection.begin(); + std::vector< std::vector< unsigned int > >::const_iterator bandSelection = m_ListOfBandSelection.begin(); os << indent << "Image File(s) to be read\n"; for ( unsigned int i = 0; i < GetNumberOfOutputs(); ++i ) { @@ -384,7 +384,7 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > } os << "\n"; - ++bandSelection; + ++bandSelection; } } } @@ -417,7 +417,7 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > fullPath.push_back( "/" ); fullPath.push_back( file ); - std::string fullFileName = itksys::SystemTools::JoinPath( fullPath ); + std::string fullFileName = itksys::SystemTools::JoinPath( fullPath ); if ( !itksys::SystemTools::FileExists( fullFileName.c_str() ) ) { @@ -426,7 +426,7 @@ ImageSeriesFileReaderBase< TImage, TInternalImage > msg << "The image file doesn't exist. \n"; msg << "ImageFileName = " << file << "\n"; msg << "tested path = " << itksys::SystemTools::GetFilenamePath( m_FileName ) << "\n"; - msg << "Other Tested File = " << fullFileName << "\n"; + msg << "Other Tested File = " << fullFileName << "\n"; e.SetDescription( msg.str().c_str() ); throw e; return; diff --git a/Code/MultiScale/otbHaarOperator.h b/Code/MultiScale/otbHaarOperator.h index 2de277e984a7c6b8dc8872c40ae9cf3468d01577..cd96cf0c4e3f5af03b1b3d52c3b6c44946b7f302 100644 --- a/Code/MultiScale/otbHaarOperator.h +++ b/Code/MultiScale/otbHaarOperator.h @@ -56,9 +56,9 @@ public: itkTypeMacro(LowPassHaarOperator, WaveletOperator); LowPassHaarOperator() - { + { this->SetRadius(1); - this->CreateToRadius(1); + this->CreateToRadius(1); } LowPassHaarOperator(const Self& other) @@ -147,9 +147,9 @@ public: itkTypeMacro(HighPassHaarOperator, WaveletOperator); HighPassHaarOperator() - { + { this->SetRadius(1); - this->CreateToRadius(1); + this->CreateToRadius(1); } HighPassHaarOperator(const Self& other) diff --git a/Code/MultiScale/otbStationaryFilterBank.h b/Code/MultiScale/otbStationaryFilterBank.h index 128daf0aa38a1f7d3c79fd309a4f526d87a8ae49..a45ed5b9b775d4ee4e0c31abfcc5c2e7b560f1bd 100644 --- a/Code/MultiScale/otbStationaryFilterBank.h +++ b/Code/MultiScale/otbStationaryFilterBank.h @@ -81,28 +81,28 @@ public: typedef StationaryFilterBank Self; typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass; typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef itk::SmartPointer<const Self> ConstPointer; - /** Type macro */ - itkNewMacro(Self); + /** Type macro */ + itkNewMacro(Self); - /** Creation through object factory macro */ - itkTypeMacro(StationaryFilterBank,ImageToImageFilter); + /** Creation through object factory macro */ + itkTypeMacro(StationaryFilterBank,ImageToImageFilter); /** Template parameters typedefs */ typedef TInputImage InputImageType; - typedef typename InputImageType::Pointer InputImagePointerType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename InputImageType::SizeType InputSizeType; - typedef typename InputImageType::IndexType InputIndexType; - typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::Pointer InputImagePointerType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::SizeType InputSizeType; + typedef typename InputImageType::IndexType InputIndexType; + typedef typename InputImageType::PixelType InputPixelType; typedef TOutputImage OutputImageType; - typedef typename OutputImageType::Pointer OutputImagePointerType; + typedef typename OutputImageType::Pointer OutputImagePointerType; typedef typename OutputImageType::RegionType OutputImageRegionType; typedef typename OutputImageType::SizeType OutputSizeType; typedef typename OutputImageType::IndexType OutputIndexType; - typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::PixelType OutputPixelType; typedef TLowPassOperator LowPassOperatorType; typedef THighPassOperator HighPassOperatorType; @@ -117,8 +117,8 @@ public: typedef typename FaceListType::iterator FaceListIterator; /** Dimension */ - itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); /** * Set/Get the level of up sampling of the filter used in the A-trou algorithm diff --git a/Code/MultiScale/otbStationaryFilterBank.txx b/Code/MultiScale/otbStationaryFilterBank.txx index e5b4a74d045eac3b50ddbf44fb4a345cc7644eac..86d68862a766d6108aa072e9eaecc4ad98dacdbc 100644 --- a/Code/MultiScale/otbStationaryFilterBank.txx +++ b/Code/MultiScale/otbStationaryFilterBank.txx @@ -37,7 +37,7 @@ StationaryFilterBank< TInputImage, TOutputImage, TLowPassOperator, THighPassOper unsigned int numOfOutput = 1<<InputImageType::ImageDimension; - this->SetNumberOfOutputs( numOfOutput ); + this->SetNumberOfOutputs( numOfOutput ); for ( unsigned i = 1; i < numOfOutput; i++ ) { this->SetNthOutput(i,OutputImageType::New()); @@ -79,7 +79,7 @@ StationaryFilterBank< TInputImage, TOutputImage, TLowPassOperator, THighPassOper if ( outputHighPass == 0 ) { itk::OStringStream msg; - msg << "Sortie 1<<" << idx << " = " << (1<<idx) << " nulle\n"; + msg << "Sortie 1<<" << idx << " = " << (1<<idx) << " nulle\n"; msg << "Nombre de sortie attendue " << this->GetNumberOfOutputs() << "\n"; throw itk::ExceptionObject( __FILE__, __LINE__, msg.str().c_str(), ITK_LOCATION ); } diff --git a/Code/MultiScale/otbWPCost.h b/Code/MultiScale/otbWPCost.h index 80cf6662d4989581cb9893cbd1c24edee29f379f..95d8dcf189941c779ffdf01a069d10f7d69ee1ca 100644 --- a/Code/MultiScale/otbWPCost.h +++ b/Code/MultiScale/otbWPCost.h @@ -43,13 +43,13 @@ public: typedef FullyDecomposedWaveletPacketCost Self; typedef itk::Object Superclass; typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef itk::SmartPointer<const Self> ConstPointer; - /** Type macro */ - itkNewMacro(Self); + /** Type macro */ + itkNewMacro(Self); - /** Creation through object factory macro */ - itkTypeMacro(FullyDecomposedWaveletPacketCost,Object); + /** Creation through object factory macro */ + itkTypeMacro(FullyDecomposedWaveletPacketCost,Object); typedef TImage ImageType; diff --git a/Code/MultiScale/otbWaveletForwardTransform.h b/Code/MultiScale/otbWaveletForwardTransform.h index b701ea2edff91abe25a6386ca33ea391fb4c9cf0..6430c9f1eed2d24ddcd6fa210b90275e4f173d4e 100644 --- a/Code/MultiScale/otbWaveletForwardTransform.h +++ b/Code/MultiScale/otbWaveletForwardTransform.h @@ -54,13 +54,13 @@ public: typedef WaveletForwardTransform Self; typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass; typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef itk::SmartPointer<const Self> ConstPointer; - /** Type macro */ - itkNewMacro(Self); + /** Type macro */ + itkNewMacro(Self); - /** Creation through object factory macro */ - itkTypeMacro(WaveletForwardTransform,ImageToImageFilter); + /** Creation through object factory macro */ + itkTypeMacro(WaveletForwardTransform,ImageToImageFilter); typedef TInputImage InputImageType; typedef typename InputImageType::Pointer InputImagePointer; diff --git a/Code/MultiScale/otbWaveletOperator.h b/Code/MultiScale/otbWaveletOperator.h index c3a94855e9342e31389ae379c09a47c8459b51e0..b5263022cb0a19463627421c73e90a0f7648e317 100644 --- a/Code/MultiScale/otbWaveletOperator.h +++ b/Code/MultiScale/otbWaveletOperator.h @@ -55,7 +55,7 @@ namespace otb { template<class TPixel, unsigned int VDimension, class TAllocator = itk::NeighborhoodAllocator< TPixel > > class ITK_EXPORT WaveletOperator - : public itk::NeighborhoodOperator<TPixel, VDimension, TAllocator> + : public itk::NeighborhoodOperator<TPixel, VDimension, TAllocator> { public: /** Standard typedefs */ diff --git a/Code/MultiScale/otbWaveletPacketForwardTransform.h b/Code/MultiScale/otbWaveletPacketForwardTransform.h index c219b14a7370e2b8ce2e312c032e1dbb69d29eef..75f11968d4a6cdd8ee97f5cab1319eeffa85509b 100644 --- a/Code/MultiScale/otbWaveletPacketForwardTransform.h +++ b/Code/MultiScale/otbWaveletPacketForwardTransform.h @@ -56,13 +56,13 @@ public: typedef WaveletPacketForwardTransform Self; typedef ImageToImageListFilter< TInputImage, TOutputImage > Superclass; typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef itk::SmartPointer<const Self> ConstPointer; - /** Type macro */ - itkNewMacro(Self); + /** Type macro */ + itkNewMacro(Self); - /** Creation through object factory macro */ - itkTypeMacro(WaveletPacketForwardTransform,ImageToImageListFilter); + /** Creation through object factory macro */ + itkTypeMacro(WaveletPacketForwardTransform,ImageToImageListFilter); typedef TInputImage InputImageType; typedef typename InputImageType::Pointer InputImagePointerType; diff --git a/Code/MultiScale/otb_9_7_Operator.h b/Code/MultiScale/otb_9_7_Operator.h index f3c350652e36e55594f83fbf2d1c20d5e1bcded2..6d93a31bc240d9dc04ab7f92119598118fad45a3 100644 --- a/Code/MultiScale/otb_9_7_Operator.h +++ b/Code/MultiScale/otb_9_7_Operator.h @@ -60,9 +60,9 @@ public: itkTypeMacro(LowPass_9_7_Operator, WaveletOperator); LowPass_9_7_Operator() - { + { this->SetRadius(4); - this->CreateToRadius(4); + this->CreateToRadius(4); } LowPass_9_7_Operator(const Self& other) @@ -157,9 +157,9 @@ public: itkTypeMacro(HighPass_9_7_Operator, WaveletOperator); HighPass_9_7_Operator() - { + { this->SetRadius(3); - this->CreateToRadius(3); + this->CreateToRadius(3); } HighPass_9_7_Operator(const Self& other) diff --git a/Code/Projections/otbGenericRSTransform.h b/Code/Projections/otbGenericRSTransform.h index 9ec7907bbc7affa5b2ced60c3dbc74a7ac6a0469..12dfacd2cfdccfe319c0c065d95196e4fe60a6e3 100644 --- a/Code/Projections/otbGenericRSTransform.h +++ b/Code/Projections/otbGenericRSTransform.h @@ -198,8 +198,8 @@ namespace otb virtual void Modified() { - this->Superclass::Modified(); - m_TransformUpToDate = false; + this->Superclass::Modified(); + m_TransformUpToDate = false; } private : diff --git a/Code/Radiometry/otbMultiChannelRAndBAndNIRIndexImageFilter.h b/Code/Radiometry/otbMultiChannelRAndBAndNIRIndexImageFilter.h index 800809ebe4178e5e359c2e3f7c909ecfeea4e059..8cb9dae7c14bc4ec7e5b2a0c8addedb57b719672 100644 --- a/Code/Radiometry/otbMultiChannelRAndBAndNIRIndexImageFilter.h +++ b/Code/Radiometry/otbMultiChannelRAndBAndNIRIndexImageFilter.h @@ -36,10 +36,10 @@ namespace otb * \ingroup Radiometry */ template <class TInputImage, class TOutputImage, - class TFunction = Functor::ARVI< typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TOutputImage::PixelType> > + class TFunction = Functor::ARVI< typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TOutputImage::PixelType> > class ITK_EXPORT MultiChannelRAndBAndNIRIndexImageFilter : public itk::UnaryFunctorImageFilter<TInputImage,TOutputImage,TFunction> { diff --git a/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.h b/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.h index 63e9659a921e0d13feaa14a847ae3dbb742df3fa..c948d0a6b017d3e16af544bd8bf72786077a2e5a 100644 --- a/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.h +++ b/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.h @@ -36,10 +36,10 @@ namespace otb * \ingroup Radiometry */ template <class TInputImage, class TOutputImage, - class TFunction = Functor::ARVI< typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TOutputImage::PixelType> > + class TFunction = Functor::ARVI< typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TOutputImage::PixelType> > class ITK_EXPORT MultiChannelRAndBAndNIRVegetationIndexImageFilter : public itk::UnaryFunctorImageFilter<TInputImage,TOutputImage,TFunction> { diff --git a/Code/Radiometry/otbMultiChannelRAndNIRIndexImageFilter.h b/Code/Radiometry/otbMultiChannelRAndNIRIndexImageFilter.h index e681331466c077bdcd22aa30cd76018203f8bbb4..b7eb8d85e97c76a2ff1cc1eca3793072e3b619e1 100644 --- a/Code/Radiometry/otbMultiChannelRAndNIRIndexImageFilter.h +++ b/Code/Radiometry/otbMultiChannelRAndNIRIndexImageFilter.h @@ -36,9 +36,9 @@ namespace otb * \ingroup Radiometry */ template <class TInputImage, class TOutputImage, - class TFunction = Functor::NDVI< typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TOutputImage::PixelType> > + class TFunction = Functor::NDVI< typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TOutputImage::PixelType> > class ITK_EXPORT MultiChannelRAndNIRIndexImageFilter : public itk::UnaryFunctorImageFilter<TInputImage,TOutputImage, TFunction> { diff --git a/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.h b/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.h index 07c7a76dd98e99430c53ed2044487e3dbed6f808..85f38b9511e8e03bf1fb77e87fab885a54893996 100644 --- a/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.h +++ b/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.h @@ -37,9 +37,9 @@ namespace otb * \ingroup Radiometry */ template <class TInputImage, class TOutputImage, - class TFunction = Functor::NDVI< typename TInputImage::InternalPixelType, - typename TInputImage::InternalPixelType, - typename TOutputImage::PixelType> > + class TFunction = Functor::NDVI< typename TInputImage::InternalPixelType, + typename TInputImage::InternalPixelType, + typename TOutputImage::PixelType> > class ITK_EXPORT MultiChannelRAndNIRVegetationIndexImageFilter : public itk::UnaryFunctorImageFilter<TInputImage,TOutputImage, TFunction> { diff --git a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx index 45d96e97bef2f9596ef24d34e6f97a72b3224002..edd7a2c6ca24fb95b99dcdaeccc33f7485f5f2d2 100644 --- a/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx +++ b/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.txx @@ -341,18 +341,18 @@ PolygonListToRCC8GraphFilter<TPolygonList, TOutputGraph> { // Add the edge to the graph. otbMsgDevMacro(<<"Adding edge: "<<vIt1.GetIndex()<<" -> "<<vIt2.GetIndex()<<": "<<value); - if(value==OTB_RCC8_NTPPI) - { - m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=OTB_RCC8_NTPP; - } - else if(value == OTB_RCC8_TPPI) - { - m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=OTB_RCC8_TPP; - } - else - { - m_EdgesPerThread[threadId][EdgePairType(vIt1.GetIndex(),vIt2.GetIndex())]=value; - } + if(value==OTB_RCC8_NTPPI) + { + m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=OTB_RCC8_NTPP; + } + else if(value == OTB_RCC8_TPPI) + { + m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=OTB_RCC8_TPP; + } + else + { + m_EdgesPerThread[threadId][EdgePairType(vIt1.GetIndex(),vIt2.GetIndex())]=value; + } if (m_UseInverted) { m_EdgesPerThread[threadId][EdgePairType(vIt2.GetIndex(),vIt1.GetIndex())]=invert[value]; diff --git a/Code/VisuRefac/otbBlendingImageFilter.h b/Code/VisuRefac/otbBlendingImageFilter.h index 65cf309ec3d714f400db9e0c563b169df74817c4..488440ce3ac0bcdfc779766d8bd60d0585f9a4a6 100644 --- a/Code/VisuRefac/otbBlendingImageFilter.h +++ b/Code/VisuRefac/otbBlendingImageFilter.h @@ -40,12 +40,12 @@ class BlendingFunctor public: /** Blending function typedef */ typedef otb::Function::BlendingFunction<TInputPixel1, - TInputPixel2,TOutputPixel> BlendingFunctionType; + TInputPixel2,TOutputPixel> BlendingFunctionType; /** Blending function pointer typedef */ typedef typename BlendingFunctionType::Pointer BlendingFunctionPointerType; /** Default rendering function typedef */ typedef otb::Function::UniformAlphaBlendingFunction<TInputPixel1, - TInputPixel2,TOutputPixel> DefaultBlendingFunctionType; + TInputPixel2,TOutputPixel> DefaultBlendingFunctionType; /** Scalar pixel operator */ inline TOutputPixel operator()(const TInputPixel1 & input1, const TInputPixel2 & input2) @@ -97,10 +97,10 @@ private: template <class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1> class BlendingImageFilter : public itk::BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, - Functor::BlendingFunctor - < typename TInputImage1::PixelType, - typename TInputImage2::PixelType, - typename TOutputImage::PixelType > > + Functor::BlendingFunctor + < typename TInputImage1::PixelType, + typename TInputImage2::PixelType, + typename TOutputImage::PixelType > > { public: /** Standard typedefs */ diff --git a/Code/VisuRefac/otbChangeExtractRegionActionHandler.h b/Code/VisuRefac/otbChangeExtractRegionActionHandler.h index 6e094ead80b7e5683d2fd11cc9dbd2b3a3654506..531d675a86f1aa125e840aca6edce36aca298291 100644 --- a/Code/VisuRefac/otbChangeExtractRegionActionHandler.h +++ b/Code/VisuRefac/otbChangeExtractRegionActionHandler.h @@ -66,28 +66,28 @@ public: if( m_View.IsNotNull() && m_Model.IsNotNull() ) { if(widgetId == m_View->GetScrollWidget()->GetIdentifier() - && event == FL_PUSH) - { - otbMsgDevMacro(<<"ChangeExtractRegionActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); - - // Get the clicked index - typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; - screenPoint = m_View->GetScrollWidget()->GetMousePosition(); - - // Transform to image point - imagePoint = m_View->GetScrollWidget()->GetScreenToImageTransform()->TransformPoint(screenPoint); - - // Transform to index - typename ViewType::IndexType index; - index[0]=static_cast<int>(imagePoint[0]); - index[1]=static_cast<int>(imagePoint[1]); - - // Change scaled extract region center - m_Model->SetExtractRegionCenter(index); - // Update model - m_Model->Update(); - return true; - } + && event == FL_PUSH) + { + otbMsgDevMacro(<<"ChangeExtractRegionActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); + + // Get the clicked index + typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; + screenPoint = m_View->GetScrollWidget()->GetMousePosition(); + + // Transform to image point + imagePoint = m_View->GetScrollWidget()->GetScreenToImageTransform()->TransformPoint(screenPoint); + + // Transform to index + typename ViewType::IndexType index; + index[0]=static_cast<int>(imagePoint[0]); + index[1]=static_cast<int>(imagePoint[1]); + + // Change scaled extract region center + m_Model->SetExtractRegionCenter(index); + // Update model + m_Model->Update(); + return true; + } } return false; } diff --git a/Code/VisuRefac/otbChangeScaleActionHandler.h b/Code/VisuRefac/otbChangeScaleActionHandler.h index b3ca6e607027ae5aaf5cf94164a57567ad23ffe5..42b28655c9284c4ba7e4ba325dbd98cf9a277947 100644 --- a/Code/VisuRefac/otbChangeScaleActionHandler.h +++ b/Code/VisuRefac/otbChangeScaleActionHandler.h @@ -66,33 +66,33 @@ public: if( m_View.IsNotNull() && m_Model.IsNotNull() ) { if(widgetId == m_View->GetZoomWidget()->GetIdentifier() - && event == FL_MOUSEWHEEL) - { - otbMsgDevMacro(<<"ChangeScaleActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); + && event == FL_MOUSEWHEEL) + { + otbMsgDevMacro(<<"ChangeScaleActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); // Get the mousewhell offset - int dy = Fl::event_dy(); - - // Compute new scale - double newScale = m_View->GetZoomWidget()->GetIsotropicZoom() * vcl_pow(m_ScaleRatio,-dy); - if(newScale>=1.0) - { - m_View->GetZoomWidget()->SetIsotropicZoom(newScale); - RegionType region = m_Model->GetScaledExtractRegion(); - - typename RegionType::IndexType index = region.GetIndex(); - typename RegionType::SizeType size = region.GetSize(); - index[0]+=size[0]/2; - index[1]+=size[1]/2; - size[0] = static_cast<unsigned int>(m_View->GetZoomWidget()->w()/m_View->GetZoomWidget()->GetIsotropicZoom()); - size[1] = static_cast<unsigned int>(m_View->GetZoomWidget()->h()/m_View->GetZoomWidget()->GetIsotropicZoom()); - region.SetSize(size); - m_Model->SetScaledExtractRegion(region); - m_Model->SetScaledExtractRegionCenter(index); - // Update the model - m_Model->Update(); - } - return true; - } + int dy = Fl::event_dy(); + + // Compute new scale + double newScale = m_View->GetZoomWidget()->GetIsotropicZoom() * vcl_pow(m_ScaleRatio,-dy); + if(newScale>=1.0) + { + m_View->GetZoomWidget()->SetIsotropicZoom(newScale); + RegionType region = m_Model->GetScaledExtractRegion(); + + typename RegionType::IndexType index = region.GetIndex(); + typename RegionType::SizeType size = region.GetSize(); + index[0]+=size[0]/2; + index[1]+=size[1]/2; + size[0] = static_cast<unsigned int>(m_View->GetZoomWidget()->w()/m_View->GetZoomWidget()->GetIsotropicZoom()); + size[1] = static_cast<unsigned int>(m_View->GetZoomWidget()->h()/m_View->GetZoomWidget()->GetIsotropicZoom()); + region.SetSize(size); + m_Model->SetScaledExtractRegion(region); + m_Model->SetScaledExtractRegionCenter(index); + // Update the model + m_Model->Update(); + } + return true; + } } return false; } diff --git a/Code/VisuRefac/otbChangeScaledExtractRegionActionHandler.h b/Code/VisuRefac/otbChangeScaledExtractRegionActionHandler.h index 09876ffce58b49ebb56d785a8b20106159a20ac5..e81b4ca888f9a24698860e4a36a7bf22ae30ddaf 100644 --- a/Code/VisuRefac/otbChangeScaledExtractRegionActionHandler.h +++ b/Code/VisuRefac/otbChangeScaledExtractRegionActionHandler.h @@ -66,27 +66,27 @@ public: if( m_View.IsNotNull() && m_Model.IsNotNull() ) { if(widgetId == m_View->GetFullWidget()->GetIdentifier() - && event == FL_PUSH) - { - otbMsgDevMacro(<<"ChangeScaledExtractRegionActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); - // Get the clicked index - typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; - screenPoint = m_View->GetFullWidget()->GetMousePosition(); - - // Transform to image point - imagePoint = m_View->GetFullWidget()->GetScreenToImageTransform()->TransformPoint(screenPoint); - - // Transform to index - typename ViewType::IndexType index; - index[0]=static_cast<int>(imagePoint[0]); - index[1]=static_cast<int>(imagePoint[1]); - - // Change scaled extract region center - m_Model->SetScaledExtractRegionCenter(index); - // Update model - m_Model->Update(); - return true; - } + && event == FL_PUSH) + { + otbMsgDevMacro(<<"ChangeScaledExtractRegionActionHandler::HandleWidgetEvent(): handling ("<<widgetId<<", "<<event<<")"); + // Get the clicked index + typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; + screenPoint = m_View->GetFullWidget()->GetMousePosition(); + + // Transform to image point + imagePoint = m_View->GetFullWidget()->GetScreenToImageTransform()->TransformPoint(screenPoint); + + // Transform to index + typename ViewType::IndexType index; + index[0]=static_cast<int>(imagePoint[0]); + index[1]=static_cast<int>(imagePoint[1]); + + // Change scaled extract region center + m_Model->SetScaledExtractRegionCenter(index); + // Update model + m_Model->Update(); + return true; + } } return false; } diff --git a/Code/VisuRefac/otbCurves2DWidget.cxx b/Code/VisuRefac/otbCurves2DWidget.cxx index 7fd9754287d25ec300db0679efc01fa42d91d8e3..2b3c74ad80567fdcd97f074b9da1ac8a2da3d6b7 100644 --- a/Code/VisuRefac/otbCurves2DWidget.cxx +++ b/Code/VisuRefac/otbCurves2DWidget.cxx @@ -23,9 +23,9 @@ namespace otb { Curves2DWidget::Curves2DWidget() : m_Curves(), m_XAxisLabel("X axis"), m_YAxisLabel("Y axis"), m_Margins(), - m_Extent(), m_AxisOrigin(), m_AxisLength(), - m_GridOrigin(), m_GridSpacing(), m_ZeroCrossingAxis(true), - m_AutoScale(true),m_AxisColor(), m_GridColor(), m_SpaceToScreenTransform() + m_Extent(), m_AxisOrigin(), m_AxisLength(), + m_GridOrigin(), m_GridSpacing(), m_ZeroCrossingAxis(true), + m_AutoScale(true),m_AxisColor(), m_GridColor(), m_SpaceToScreenTransform() { // Build the curves list m_Curves = CurveListType::New(); diff --git a/Code/VisuRefac/otbGlWidget.cxx b/Code/VisuRefac/otbGlWidget.cxx index 62a50dbc56fafd6331449939759bf7a908b7451f..b0253fdd50ad0134205fcb60bd8179f734f9e10e 100644 --- a/Code/VisuRefac/otbGlWidget.cxx +++ b/Code/VisuRefac/otbGlWidget.cxx @@ -25,7 +25,7 @@ namespace otb GlWidget ::GlWidget() : Fl_Gl_Window(0,0,0,0), m_Identifier("Default"), m_UseGlAcceleration(false), - m_BackgroundColor() + m_BackgroundColor() { #ifdef OTB_GL_USE_ACCEL m_UseGlAcceleration = true; diff --git a/Code/VisuRefac/otbImageLayer.h b/Code/VisuRefac/otbImageLayer.h index 445b7a22b3e494444dbf2d006e50701ebdaa1085..8298c6382e3373d4dc3bd72965351373a37684e1 100644 --- a/Code/VisuRefac/otbImageLayer.h +++ b/Code/VisuRefac/otbImageLayer.h @@ -84,7 +84,7 @@ public: typedef typename RenderingFilterType::RenderingFunctionType RenderingFunctionType; typedef typename RenderingFunctionType::Pointer RenderingFunctionPointerType; typedef Function::StandardRenderingFunction<InternalPixelType, - typename TOutputImage::PixelType> DefaultRenderingFunctionType; + typename TOutputImage::PixelType> DefaultRenderingFunctionType; typedef itk::ExtractImageFilter<ImageType,ImageType> ExtractFilterType; typedef typename ExtractFilterType::Pointer ExtractFilterPointerType; @@ -158,9 +158,9 @@ public: Superclass::SetExtractRegion(region); // SetExtractionRegion throws an exception in case of empty region if(region.GetNumberOfPixels() > 0) - { - m_ExtractFilter->SetExtractionRegion(region); - } + { + m_ExtractFilter->SetExtractionRegion(region); + } } } @@ -173,9 +173,9 @@ public: Superclass::SetScaledExtractRegion(region); // SetExtractionRegion throws an exception in case of empty region if(region.GetNumberOfPixels() > 0) - { - m_ScaledExtractFilter->SetExtractionRegion(region); - } + { + m_ScaledExtractFilter->SetExtractionRegion(region); + } } } diff --git a/Code/VisuRefac/otbImageLayer.txx b/Code/VisuRefac/otbImageLayer.txx index b158a45ea8c4b3d9d7bd77ed1281618b2f1c461d..f30c14843ced891af92cd46d9f88a41b1b172186 100644 --- a/Code/VisuRefac/otbImageLayer.txx +++ b/Code/VisuRefac/otbImageLayer.txx @@ -28,9 +28,9 @@ namespace otb template <class TImage, class TOutputImage> ImageLayer<TImage,TOutputImage> ::ImageLayer() : m_Quicklook(), m_Image(), m_HistogramList(), m_RenderingFunction(), - m_NumberOfHistogramBins(255), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02), - m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(), - m_ExtractFilter(), m_ScaledExtractFilter() + m_NumberOfHistogramBins(255), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02), + m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(), + m_ExtractFilter(), m_ScaledExtractFilter() { // Rendering filters m_QuicklookRenderingFilter = RenderingFilterType::New(); diff --git a/Code/VisuRefac/otbImageLayerBase.h b/Code/VisuRefac/otbImageLayerBase.h index c7a77699d3cb80c94270bae19973dc357dbdd940..2032223df2376cb8bb44adbdc71166e24ba71370 100644 --- a/Code/VisuRefac/otbImageLayerBase.h +++ b/Code/VisuRefac/otbImageLayerBase.h @@ -119,10 +119,10 @@ public: protected: /** Constructor */ ImageLayerBase() : m_Name("Default"), m_Visible(false), m_Extent(), - m_RenderedQuicklook(), m_HasQuicklook(false), m_QuicklookSize(), m_QuicklookSubsamplingRate(1), - m_RenderedExtract(), m_HasExtract(false), m_ExtractRegion(), - m_RenderedScaledExtract(), m_HasScaledExtract(false), m_ScaledExtractRegion(), - m_BlendingFunction() + m_RenderedQuicklook(), m_HasQuicklook(false), m_QuicklookSize(), m_QuicklookSubsamplingRate(1), + m_RenderedExtract(), m_HasExtract(false), m_ExtractRegion(), + m_RenderedScaledExtract(), m_HasScaledExtract(false), m_ScaledExtractRegion(), + m_BlendingFunction() { // Default blending function m_BlendingFunction = Function::UniformAlphaBlendingFunction<PixelType>::New(); diff --git a/Code/VisuRefac/otbImageLayerGenerator.txx b/Code/VisuRefac/otbImageLayerGenerator.txx index ef126935e8ea360ee457a8331b43b456aef04384..1a710d0816b6cf91a2cbe521a6bb82097778af0e 100644 --- a/Code/VisuRefac/otbImageLayerGenerator.txx +++ b/Code/VisuRefac/otbImageLayerGenerator.txx @@ -28,8 +28,8 @@ namespace otb template < class TImageLayer > ImageLayerGenerator<TImageLayer> ::ImageLayerGenerator() : m_Layer(), m_Image(), m_Quicklook(), - m_SubsamplingRate(1), m_GenerateQuicklook(true), - m_Resampler(), m_ScreenRatio(0.25) + m_SubsamplingRate(1), m_GenerateQuicklook(true), + m_Resampler(), m_ScreenRatio(0.25) { // Intialize output layer m_Layer = ImageLayerType::New(); diff --git a/Code/VisuRefac/otbImageLayerRenderingModel.txx b/Code/VisuRefac/otbImageLayerRenderingModel.txx index 5088326d545c2c26ec7a62427eeeea51f082564b..ffb2fbb2669dfa857891ff5f28e447c77500de9b 100644 --- a/Code/VisuRefac/otbImageLayerRenderingModel.txx +++ b/Code/VisuRefac/otbImageLayerRenderingModel.txx @@ -28,10 +28,10 @@ namespace otb template <class TOutputImage> ImageLayerRenderingModel<TOutputImage> ::ImageLayerRenderingModel() : m_Name("Default"), m_RasterizedQuicklook(), - m_HasQuicklook(false),m_RasterizedExtract(),m_HasExtract(false), - m_ExtractRegion(), m_RasterizedScaledExtract(), m_HasScaledExtract(false), - m_ScaledExtractRegion(), m_QuicklookBlendingFilterList(), m_ExtractBlendingFilterList(), - m_ScaledExtractBlendingFilterList() + m_HasQuicklook(false),m_RasterizedExtract(),m_HasExtract(false), + m_ExtractRegion(), m_RasterizedScaledExtract(), m_HasScaledExtract(false), + m_ScaledExtractRegion(), m_QuicklookBlendingFilterList(), m_ExtractBlendingFilterList(), + m_ScaledExtractBlendingFilterList() { // Initalize the blending filter list @@ -175,47 +175,47 @@ ImageLayerRenderingModel<TOutputImage> probe.Start(); // If quicklook is activated and available for this layer if(m_HasQuicklook && it.Get()->GetHasQuicklook()) - { + { // Blend it with the current rasterized quicklook - typename BlendingFilterType::Pointer blender = m_QuicklookBlendingFilterList->GetNthElement(count); - // Using the blending function of the layer - blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); - blender->SetInput1(m_RasterizedQuicklook); - blender->SetInput2(it.Get()->GetRenderedQuicklook()); - blender->Update(); - // Store the result as being the current rasterized quicklook - m_RasterizedQuicklook = blender->GetOutput(); - } + typename BlendingFilterType::Pointer blender = m_QuicklookBlendingFilterList->GetNthElement(count); + // Using the blending function of the layer + blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); + blender->SetInput1(m_RasterizedQuicklook); + blender->SetInput2(it.Get()->GetRenderedQuicklook()); + blender->Update(); + // Store the result as being the current rasterized quicklook + m_RasterizedQuicklook = blender->GetOutput(); + } // If extract is activated and available for this layer if(m_HasExtract && it.Get()->GetHasExtract()) - { + { // Blend it with the current rasterized extract - typename BlendingFilterType::Pointer blender = m_ExtractBlendingFilterList->GetNthElement(count); - // Using the blending function of the layer - blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); - blender->SetInput1(m_RasterizedExtract); - blender->SetInput2(it.Get()->GetRenderedExtract()); - blender->GetOutput()->SetRequestedRegion(m_ExtractRegion); - blender->Update(); - // Store the result as being the current rasterized extract - m_RasterizedExtract = blender->GetOutput(); - } + typename BlendingFilterType::Pointer blender = m_ExtractBlendingFilterList->GetNthElement(count); + // Using the blending function of the layer + blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); + blender->SetInput1(m_RasterizedExtract); + blender->SetInput2(it.Get()->GetRenderedExtract()); + blender->GetOutput()->SetRequestedRegion(m_ExtractRegion); + blender->Update(); + // Store the result as being the current rasterized extract + m_RasterizedExtract = blender->GetOutput(); + } // If scaledExtract is activated and available for this layer if(m_HasScaledExtract && it.Get()->GetHasScaledExtract()) - { - // Blend it with the current rasterized scaledExtract - typename BlendingFilterType::Pointer blender = m_ScaledExtractBlendingFilterList->GetNthElement(count); - // Using the blending function of the layer - blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); - blender->SetInput1(m_RasterizedScaledExtract); - blender->SetInput2(it.Get()->GetRenderedScaledExtract()); - blender->GetOutput()->SetRequestedRegion(m_ScaledExtractRegion); - blender->Update(); - // Store the result as being the current rasterized scaledExtract - m_RasterizedScaledExtract = blender->GetOutput(); - } + { + // Blend it with the current rasterized scaledExtract + typename BlendingFilterType::Pointer blender = m_ScaledExtractBlendingFilterList->GetNthElement(count); + // Using the blending function of the layer + blender->SetBlendingFunction(it.Get()->GetBlendingFunction()); + blender->SetInput1(m_RasterizedScaledExtract); + blender->SetInput2(it.Get()->GetRenderedScaledExtract()); + blender->GetOutput()->SetRequestedRegion(m_ScaledExtractRegion); + blender->Update(); + // Store the result as being the current rasterized scaledExtract + m_RasterizedScaledExtract = blender->GetOutput(); + } probe.Stop(); otbMsgDevMacro("ImageLayerRenderingModel::RasterizeVisibleLayers(): Previous layer rasterized with layer "<<it.Get()->GetName()<<" ( "<<probe.GetMeanTime()<<" s.)"); @@ -305,14 +305,14 @@ ImageLayerRenderingModel<TOutputImage> { // push left if necessary if (small.GetIndex()[dim]<big.GetIndex()[dim]) - { - index[dim]=big.GetIndex()[dim]; - } + { + index[dim]=big.GetIndex()[dim]; + } // push right if necessary if (index[dim]+size[dim]>=big.GetIndex()[dim]+big.GetSize()[dim]) - { - index[dim]=big.GetIndex()[dim]+big.GetSize()[dim]-size[dim]; - } + { + index[dim]=big.GetIndex()[dim]+big.GetSize()[dim]-size[dim]; + } } resp.SetSize(size); resp.SetIndex(index); diff --git a/Code/VisuRefac/otbImageView.txx b/Code/VisuRefac/otbImageView.txx index a58d589ef3344ce1391cdb645b2f950ad3c781c8..20dd2badc15bc503748710ea76a4052b2f408e33 100644 --- a/Code/VisuRefac/otbImageView.txx +++ b/Code/VisuRefac/otbImageView.txx @@ -25,7 +25,7 @@ namespace otb template < class TInputImage > ImageView<TInputImage> ::ImageView() : m_ScrollWidget(), m_FullWidget(), m_ZoomWidget(), - m_Model(), m_Controller(), m_ExtractRegionGlComponent(), m_ScaledExtractRegionGlComponent() + m_Model(), m_Controller(), m_ExtractRegionGlComponent(), m_ScaledExtractRegionGlComponent() { // Initializing the widgets m_ScrollWidget = ImageWidgetType::New(); @@ -162,7 +162,7 @@ ImageView<TInputImage> { otbMsgDevMacro(<<"ImageView::UpdateFullWidget(): redrawing full widget"); m_FullWidget->ReadBuffer(m_Model->GetRasterizedExtract(),m_Model->GetRasterizedExtract() - ->GetLargestPossibleRegion()); + ->GetLargestPossibleRegion()); // Setting widget label std::string label = m_FullWidget->GetIdentifier(); @@ -194,7 +194,7 @@ ImageView<TInputImage> { otbMsgDevMacro(<<"ImageView::UpdateZoomWidget(): redrawing zoom widget"); m_ZoomWidget->ReadBuffer(m_Model->GetRasterizedScaledExtract(),m_Model->GetRasterizedScaledExtract() - ->GetLargestPossibleRegion()); + ->GetLargestPossibleRegion()); // Setting widget label std::string label = m_ZoomWidget->GetIdentifier(); diff --git a/Code/VisuRefac/otbImageWidget.txx b/Code/VisuRefac/otbImageWidget.txx index 52d8619a42da9a1384f7d6c8f4edc529bccde21d..86337e5d0786ad7fd0b5c111e8f6797244f37e8f 100644 --- a/Code/VisuRefac/otbImageWidget.txx +++ b/Code/VisuRefac/otbImageWidget.txx @@ -26,8 +26,8 @@ namespace otb template <class TInputImage> ImageWidget<TInputImage> ::ImageWidget() : m_IsotropicZoom(1.0), m_OpenGlBuffer(NULL), m_OpenGlBufferedRegion(), - m_Extent(), m_SubsamplingRate(1), m_ImageToScreenTransform(), - m_ScreenToImageTransform(), m_GlComponents() + m_Extent(), m_SubsamplingRate(1), m_ImageToScreenTransform(), + m_ScreenToImageTransform(), m_GlComponents() { // Initialize space to screen transform and inverse m_ImageToScreenTransform = AffineTransformType::New(); @@ -184,10 +184,10 @@ ImageWidget<TInputImage> // display the image glDrawPixels(m_OpenGlBufferedRegion.GetSize()[0], - m_OpenGlBufferedRegion.GetSize()[1], - GL_RGB, - GL_UNSIGNED_BYTE, - m_OpenGlBuffer); + m_OpenGlBufferedRegion.GetSize()[1], + GL_RGB, + GL_UNSIGNED_BYTE, + m_OpenGlBuffer); } else { diff --git a/Code/VisuRefac/otbPixelDescriptionActionHandler.h b/Code/VisuRefac/otbPixelDescriptionActionHandler.h index 2be82680761e6927bed3e70fa452806194d93487..d2b727677f3d533caeb7fcf963f0dcf9b986c909 100644 --- a/Code/VisuRefac/otbPixelDescriptionActionHandler.h +++ b/Code/VisuRefac/otbPixelDescriptionActionHandler.h @@ -66,60 +66,60 @@ public: WidgetPointerType sourceWidget; bool handle = false; if(widgetId == m_View->GetScrollWidget()->GetIdentifier() ) - { - sourceWidget = m_View->GetScrollWidget(); - handle = true; - } + { + sourceWidget = m_View->GetScrollWidget(); + handle = true; + } else if(widgetId == m_View->GetFullWidget()->GetIdentifier() ) - { - sourceWidget = m_View->GetFullWidget(); - handle = true; - } + { + sourceWidget = m_View->GetFullWidget(); + handle = true; + } else if(widgetId == m_View->GetZoomWidget()->GetIdentifier() ) - { - sourceWidget = m_View->GetZoomWidget(); - handle = true; - } + { + sourceWidget = m_View->GetZoomWidget(); + handle = true; + } if(handle) - { - switch(event) - { - case FL_ENTER: - { - return true; - break; - } - case FL_LEAVE: - { - return true; - break; - } - case FL_MOVE: - { - // Get the clicked index - typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; - screenPoint = sourceWidget->GetMousePosition(); - - // Transform to image point - imagePoint = sourceWidget->GetScreenToImageTransform()->TransformPoint(screenPoint); - - // Transform to index - typename ViewType::IndexType index; - index[0]=static_cast<int>(imagePoint[0]); - index[1]=static_cast<int>(imagePoint[1]); - - // Communicate new index to model - m_Model->UpdatePixelDescription(index); - - return true; - break; - } - default: - { - break; - } - } - } + { + switch(event) + { + case FL_ENTER: + { + return true; + break; + } + case FL_LEAVE: + { + return true; + break; + } + case FL_MOVE: + { + // Get the clicked index + typename ViewType::ImageWidgetType::PointType screenPoint, imagePoint; + screenPoint = sourceWidget->GetMousePosition(); + + // Transform to image point + imagePoint = sourceWidget->GetScreenToImageTransform()->TransformPoint(screenPoint); + + // Transform to index + typename ViewType::IndexType index; + index[0]=static_cast<int>(imagePoint[0]); + index[1]=static_cast<int>(imagePoint[1]); + + // Communicate new index to model + m_Model->UpdatePixelDescription(index); + + return true; + break; + } + default: + { + break; + } + } + } } return false; } diff --git a/Code/VisuRefac/otbRenderingImageFilter.h b/Code/VisuRefac/otbRenderingImageFilter.h index baf45ab8b812b32b36f42bf86f10407ba0da9a15..552b53a9f64a97a90a660332b34a3c60d28a5cea 100644 --- a/Code/VisuRefac/otbRenderingImageFilter.h +++ b/Code/VisuRefac/otbRenderingImageFilter.h @@ -121,17 +121,17 @@ private: template <class TInputImage,class TOutputImage = Image<itk::RGBPixel<unsigned char>, 2 > > class RenderingImageFilter : public itk::UnaryFunctorImageFilter<TInputImage,TOutputImage, - Functor::RenderingFunctor - < typename TInputImage ::InternalPixelType, - typename TOutputImage::PixelType > > + Functor::RenderingFunctor + < typename TInputImage ::InternalPixelType, + typename TOutputImage::PixelType > > { public: /** Standard typedefs */ typedef RenderingImageFilter Self; typedef itk::UnaryFunctorImageFilter <TInputImage,TOutputImage, Functor::RenderingFunctor - < typename TInputImage ::InternalPixelType, - typename TOutputImage::PixelType > > Superclass; + < typename TInputImage ::InternalPixelType, + typename TOutputImage::PixelType > > Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; diff --git a/Code/VisuRefac/otbStandardRenderingFunction.h b/Code/VisuRefac/otbStandardRenderingFunction.h index 8ab02b3c6469ac78e8da9970dee672c42a30844f..df3a35288a970f5b1db3255ab22df6aa280be980 100644 --- a/Code/VisuRefac/otbStandardRenderingFunction.h +++ b/Code/VisuRefac/otbStandardRenderingFunction.h @@ -228,21 +228,21 @@ public: m_TransferedMaximum.clear(); while(minIt != this->m_Minimum.end() && maxIt != this->m_Maximum.end()) - { - const double v1 = m_TransferFunction(*minIt); - const double v2 = m_TransferFunction(*maxIt); - m_TransferedMinimum.push_back(std::min(v1,v2)); - m_TransferedMaximum.push_back(std::max(v1,v2)); - ++minIt; - ++maxIt; - } + { + const double v1 = m_TransferFunction(*minIt); + const double v2 = m_TransferFunction(*maxIt); + m_TransferedMinimum.push_back(std::min(v1,v2)); + m_TransferedMaximum.push_back(std::max(v1,v2)); + ++minIt; + ++maxIt; + } } } protected: /** Constructor */ StandardRenderingFunction() : m_RedChannelIndex(0), m_GreenChannelIndex(1), m_BlueChannelIndex(2), m_TransferFunction(), - m_UserDefinedTransferedMinMax(false), m_TransferedMinimum(), m_TransferedMaximum() + m_UserDefinedTransferedMinMax(false), m_TransferedMinimum(), m_TransferedMaximum() {} /** Destructor */ ~StandardRenderingFunction() {} @@ -262,7 +262,7 @@ protected: else { return static_cast<OutputValueType>(vcl_floor(255.*(static_cast<double>(input)-static_cast<double>(min)) - /(static_cast<double>(max)-static_cast<double>(min))+0.5)); + /(static_cast<double>(max)-static_cast<double>(min))+0.5)); } } diff --git a/Code/VisuRefac/otbUniformAlphaBlendingFunction.h b/Code/VisuRefac/otbUniformAlphaBlendingFunction.h index f8ee787de03c02c4ac6e33120500c7b3f5ce6261..f140d2bb9b153386bb67afd079059f9c9b6cc5cf 100644 --- a/Code/VisuRefac/otbUniformAlphaBlendingFunction.h +++ b/Code/VisuRefac/otbUniformAlphaBlendingFunction.h @@ -39,8 +39,8 @@ public: /** Standard class typedefs */ typedef UniformAlphaBlendingFunction Self; typedef BlendingFunction<TInputRGBPixel1, - TInputRGBPixel2, - TOutputRGBPixel> Superclass; + TInputRGBPixel2, + TOutputRGBPixel> Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; diff --git a/Code/VisuRefac/otbVectorDataGlComponent.txx b/Code/VisuRefac/otbVectorDataGlComponent.txx index f3ef91fadae9b41d1b0010a96a46a3b63ce0296a..5a3db0926c465f9564b0b52921473f80f7a0335a 100644 --- a/Code/VisuRefac/otbVectorDataGlComponent.txx +++ b/Code/VisuRefac/otbVectorDataGlComponent.txx @@ -55,7 +55,7 @@ VectorDataGlComponent<TVectorData> case FEATURE_POINT: { this->RenderPoint(node->GetPoint(),extent,space2ScreenTransform); - break; + break; } case FEATURE_LINE: @@ -66,7 +66,7 @@ VectorDataGlComponent<TVectorData> case FEATURE_POLYGON: { this->RenderPolygon(node->GetPolygonExteriorRing(),node->GetPolygonInteriorRings(), - extent,space2ScreenTransform); + extent,space2ScreenTransform); break; } default: diff --git a/Code/VisuRefac/otbWidgetResizingActionHandler.h b/Code/VisuRefac/otbWidgetResizingActionHandler.h index 7c713328bc325a2684d6d195911aa0615a5da6ea..f5d7bf13ba9f5642bb99b18a202cea8ce3f4bd11 100644 --- a/Code/VisuRefac/otbWidgetResizingActionHandler.h +++ b/Code/VisuRefac/otbWidgetResizingActionHandler.h @@ -68,40 +68,40 @@ public: { // If resizing the scroll widget, nothing has to be done. if(widgetId == m_View->GetScrollWidget()->GetIdentifier() ) - { - otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<") "); - // Nothing has to be acted to the model, juste update the view - m_View->Update(); - return true; - } + { + otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<") "); + // Nothing has to be acted to the model, juste update the view + m_View->Update(); + return true; + } else if(widgetId == m_View->GetFullWidget()->GetIdentifier() ) - { - otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<")"); - // Enlarge the model extract region - RegionType region = m_Model->GetExtractRegion(); - typename RegionType::SizeType size = region.GetSize(); - size[0] = static_cast<unsigned int>(w); - size[1] = static_cast<unsigned int>(h); - region.SetSize(size); - m_Model->SetExtractRegion(region); - // Update the model - m_Model->Update(); - return true; - } + { + otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<")"); + // Enlarge the model extract region + RegionType region = m_Model->GetExtractRegion(); + typename RegionType::SizeType size = region.GetSize(); + size[0] = static_cast<unsigned int>(w); + size[1] = static_cast<unsigned int>(h); + region.SetSize(size); + m_Model->SetExtractRegion(region); + // Update the model + m_Model->Update(); + return true; + } else if(widgetId ==m_View->GetZoomWidget()->GetIdentifier() ) - { - otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<")"); - // Enlarge the model scaled extract region - RegionType region = m_Model->GetScaledExtractRegion(); - typename RegionType::SizeType size = region.GetSize(); - size[0] = static_cast<unsigned int>(static_cast<double>(w)/m_View->GetZoomWidget()->GetIsotropicZoom()); - size[1] = static_cast<unsigned int>(static_cast<double>(h)/m_View->GetZoomWidget()->GetIsotropicZoom()); - region.SetSize(size); - m_Model->SetScaledExtractRegion(region); - // Update the model - m_Model->Update(); - return true; - } + { + otbMsgDevMacro(<<"WidgetResizingActionHandler::HandleWidgetResize(): handling ("<<widgetId<<", "<<w<<", "<<h<<")"); + // Enlarge the model scaled extract region + RegionType region = m_Model->GetScaledExtractRegion(); + typename RegionType::SizeType size = region.GetSize(); + size[0] = static_cast<unsigned int>(static_cast<double>(w)/m_View->GetZoomWidget()->GetIsotropicZoom()); + size[1] = static_cast<unsigned int>(static_cast<double>(h)/m_View->GetZoomWidget()->GetIsotropicZoom()); + region.SetSize(size); + m_Model->SetScaledExtractRegion(region); + // Update the model + m_Model->Update(); + return true; + } } return false; }