diff --git a/Code/BasicFilters/otbImageToPointSetFilter.h b/Code/BasicFilters/otbImageToPointSetFilter.h index 0111187660fb2ac104f2207efdb4cf8835fb19bf..c6289e5e0b65721119564990c670bda81fea4208 100644 --- a/Code/BasicFilters/otbImageToPointSetFilter.h +++ b/Code/BasicFilters/otbImageToPointSetFilter.h @@ -60,9 +60,11 @@ public: /** Set the input image of this process object. */ void SetInput(unsigned int idx, const InputImageType *input); + void SetInput( const InputImageType *input); /** Get the input image of this process object. */ const InputImageType * GetInput(unsigned int idx); + const InputImageType * GetInput(); /** Prepare the output */ void GenerateOutputInformation(void); diff --git a/Code/BasicFilters/otbImageToPointSetFilter.txx b/Code/BasicFilters/otbImageToPointSetFilter.txx index 44ede289b02caca1de0b178d6ffe5b9fe0062e25..ab22fa25c7006ba0dd960e4b783e430e5899414a 100644 --- a/Code/BasicFilters/otbImageToPointSetFilter.txx +++ b/Code/BasicFilters/otbImageToPointSetFilter.txx @@ -63,6 +63,20 @@ ImageToPointSetFilter<TInputImage,TOutputPointSet> this->ProcessObjectType::SetNthInput(idx, const_cast< InputImageType * >(input) ); } +/** + * + */ +template <class TInputImage, class TOutputPointSet> +void +ImageToPointSetFilter<TInputImage,TOutputPointSet> +::SetInput(const InputImageType *input) +{ + // process object is not const-correct, the const_cast + // is required here. + this->ProcessObjectType::SetNthInput(0, + const_cast< InputImageType * >(input) ); +} + /** @@ -73,10 +87,26 @@ const typename ImageToPointSetFilter<TInputImage,TOutputPointSet>::InputImageTyp ImageToPointSetFilter<TInputImage,TOutputPointSet> ::GetInput(unsigned int idx) { + return dynamic_cast<const InputImageType*> (this->ProcessObjectType::GetInput(idx)); } +/** + * + */ +template <class TInputImage, class TOutputPointSet> +const typename ImageToPointSetFilter<TInputImage,TOutputPointSet>::InputImageType * +ImageToPointSetFilter<TInputImage,TOutputPointSet> +::GetInput(void) +{ + if(this->GetNumberOfInputs() < 1) + return 0; + + return dynamic_cast<const InputImageType*> + (this->ProcessObjectType::GetInput(0)); +} + /** * */ diff --git a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx index f0c41fca8e2f9f8ee48e1644f96c9a24ef4207d7..f46813ccbca72a337430e7ecbe22b98312c5e039 100644 --- a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx +++ b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx @@ -159,11 +159,11 @@ namespace otb ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet> ::InitializeInputImage() { - m_ExpandFilter->SetInput( this->GetInput(0)); + m_ExpandFilter->SetInput( this->GetInput()); m_ExpandFilter->SetExpandFactors(m_ExpandFactors); m_ExpandFilter->Update(); - typename InputImageType::PointType origin0 = this->GetInput(0)->GetOrigin(); + typename InputImageType::PointType origin0 = this->GetInput()->GetOrigin(); typename InputImageType::PointType origin1; typename InputImageType::SpacingType spacing = m_ExpandFilter->GetOutput()->GetSpacing(); diff --git a/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilter.txx b/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilter.txx index 9d78deccedfa4792dfafb1dd00c542dcd6595ff8..5611de93e575ffc7dfb82cc9aab36c3a016c7c94 100644 --- a/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilter.txx +++ b/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilter.txx @@ -84,14 +84,14 @@ namespace otb if(i>0) { m_ResampleFilter = ResampleFilterType::New(); - m_ResampleFilter ->SetInput(this->GetInput(0)); + m_ResampleFilter ->SetInput(this->GetInput()); - SizeType size = this->GetInput(0)->GetLargestPossibleRegion().GetSize(); + SizeType size = this->GetInput()->GetLargestPossibleRegion().GetSize(); for (int k = 0; k < 2; ++k) size[k] = (unsigned int) floor(size[k]/std::pow(2.0,i) ); m_ResampleFilter->SetSize( size ); - SpacingType spacing = this->GetInput(0)->GetSpacing(); + SpacingType spacing = this->GetInput()->GetSpacing(); for (int k = 0; k < 2; ++k) spacing[k] = (spacing[k] * std::pow(2.0,i)); m_ResampleFilter->SetOutputSpacing( spacing ); @@ -123,7 +123,7 @@ namespace otb /** Hessian Determinant Image */ m_DetHessianFilter = ImageToDetHessianImageType::New(); - if ( i == 0 )m_DetHessianFilter->SetInput(this->GetInput(0)); + if ( i == 0 )m_DetHessianFilter->SetInput(this->GetInput()); else m_DetHessianFilter->SetInput(m_determinantImage ); m_DetHessianFilter->SetSigma(sigma_in); @@ -182,8 +182,8 @@ namespace otb //keyPoint[2] = sigma_in/pow(k,(double)jj)*pow(2.,(double)i); double sigmaDetected = sigma_in/pow(k,(double)jj)*pow(2.,(double)i); - radius.Fill(GetMin((int)(this->GetInput(0)->GetLargestPossibleRegion().GetSize()[0] - keyPoint[0]), - (int)(this->GetInput(0)->GetLargestPossibleRegion().GetSize()[1] - keyPoint[1]), + radius.Fill(GetMin((int)(this->GetInput()->GetLargestPossibleRegion().GetSize()[0] - keyPoint[0]), + (int)(this->GetInput()->GetLargestPossibleRegion().GetSize()[1] - keyPoint[1]), (int)(6*sigmaDetected) ) ) ; // changer le sigma detected par keypoint[2] @@ -191,8 +191,8 @@ namespace otb /* Computing the orientation of the key point detected */ - NeighborhoodIteratorType itNeighOrientation(radius,this->GetInput(0) , - this->GetInput(0)->GetLargestPossibleRegion()); + NeighborhoodIteratorType itNeighOrientation(radius,this->GetInput() , + this->GetInput()->GetLargestPossibleRegion()); itNeighOrientation.SetLocation(it.GetIndex()); @@ -208,12 +208,12 @@ namespace otb /* Descriptor Computation */ /*----------------------------------------*/ - radius.Fill(GetMin((int)(this->GetInput(0)->GetLargestPossibleRegion().GetSize()[0] - keyPoint[0]), - (int)(this->GetInput(0)->GetLargestPossibleRegion().GetSize()[1] - keyPoint[1]), + radius.Fill(GetMin((int)(this->GetInput()->GetLargestPossibleRegion().GetSize()[0] - keyPoint[0]), + (int)(this->GetInput()->GetLargestPossibleRegion().GetSize()[1] - keyPoint[1]), (int)(10*sigmaDetected))); // TODO a changer sigmaDetected par Keypoint[2] - NeighborhoodIteratorType itNeighDescriptor(radius,this->GetInput(0), - this->GetInput(0)->GetLargestPossibleRegion()); + NeighborhoodIteratorType itNeighDescriptor(radius,this->GetInput(), + this->GetInput()->GetLargestPossibleRegion()); itNeighDescriptor.SetLocation(it.GetIndex()); VectorType descriptor; descriptor.resize(64); diff --git a/Code/FeatureExtraction/otbSiftFastImageFilter.h b/Code/FeatureExtraction/otbSiftFastImageFilter.h index 80b52cd35986494455b126d281d951e14ed1ece6..0c3a88b0af884003268e1444d057bf6ca9992c21 100755 --- a/Code/FeatureExtraction/otbSiftFastImageFilter.h +++ b/Code/FeatureExtraction/otbSiftFastImageFilter.h @@ -26,9 +26,13 @@ namespace otb { - /** \class SiftFastImageFilter - * \brief Generate the SIFT points of interest from an image + /** \class SiftFastImageFilter + * \brief This class extracts key points from an input image through a pyramidal decomposition + * + * This class implements the SIFT key point detector proposed by David G. Lowe in proceedings of International + * Conference on Computer Vision, Corfu, september 1999. * + * \example FeatureExtraction/SIFTFastExample.cxx */ template <class TInputImage, class TOutputPointSet> class ITK_EXPORT SiftFastImageFilter @@ -48,8 +52,9 @@ namespace otb itkTypeMacro(SiftFastImageFilter,ImageToPointSetFilter); /** Template parameters typedefs */ - typedef TInputImage InputImageType; - typedef typename TInputImage::Pointer InputImagePointerType; + + typedef TInputImage InputImageType; + typedef typename TInputImage::Pointer InputImagePointerType; typedef typename TInputImage::PixelType PixelType; typedef TOutputPointSet OutputPointSetType; @@ -65,7 +70,7 @@ namespace otb itkSetMacro(NumberOfScales,unsigned int); itkGetMacro(NumberOfScales,unsigned int); - + protected: /** Actually process the input */ virtual void GenerateData(); diff --git a/Code/FeatureExtraction/otbSiftFastImageFilter.txx b/Code/FeatureExtraction/otbSiftFastImageFilter.txx index cae7383def45243009bedc71b75cbfca299f1d33..8a83a7ba9216c44717e66c3a5a87b1d219d6e327 100755 --- a/Code/FeatureExtraction/otbSiftFastImageFilter.txx +++ b/Code/FeatureExtraction/otbSiftFastImageFilter.txx @@ -37,15 +37,19 @@ namespace otb ::SiftFastImageFilter() { } + template <class TInputImage, class TOutputPointSet> void SiftFastImageFilter<TInputImage,TOutputPointSet> ::GenerateData() { // Get the input image pointer - const InputImageType * inputPtr = this->GetInput(0); + const InputImageType * inputPtr = this->GetInput(); OutputPointSetPointerType outputPointSet = this->GetOutput(); + + + typename InputImageType::SizeType size = inputPtr->GetLargestPossibleRegion().GetSize(); // Rescale data in the [0,1] range diff --git a/Examples/DisparityMap/SIFTDisparityMapEstimation.cxx b/Examples/DisparityMap/SIFTDisparityMapEstimation.cxx index 5bef3a014f2a3e687aa0cd0e21791660df48dffa..cee915001dc25336caa53371ddde7e2dde23f026 100644 --- a/Examples/DisparityMap/SIFTDisparityMapEstimation.cxx +++ b/Examples/DisparityMap/SIFTDisparityMapEstimation.cxx @@ -35,13 +35,14 @@ // estimation. The idea here is to match SIFTs extracted from both the // fixed and the moving images. The use of SIFTs is demonstrated in // section \ref{sec:SIFTDetector}. The -// \doxygen{otb}{NearestPointDeformationFieldGenerator} will be used -// to generate a deformation field by using nearest neighbor +// \doxygen{itk}{DeformationFieldSource} will be used +// to generate a deformation field by using // interpolation on the deformation values from the point set. More // advanced methods for deformation field interpolation are also // available. // -// The first step toward the use of these filters is to include the proper header files. +// The first step toward the use of these filters is to include the +// appropriate header files. // // Software Guide : EndLatex @@ -77,7 +78,7 @@ int main (int argc, char* argv[]) // Software Guide : BeginLatex // // Then we must decide what pixel type to use for the image. We choose to do - // all the computation in floating point precision and rescale the results + // all the computations in floating point precision and rescale the results // between 0 and 255 in order to export PNG images. // // Software Guide : EndLatex @@ -141,7 +142,8 @@ int main (int argc, char* argv[]) typedef PointSetType::PointType PointType; typedef std::pair<PointType,PointType> MatchType; typedef std::vector<MatchType> MatchVectorType; - typedef EuclideanDistanceMatchingFilterType::LandmarkListType LandmarkListType; + typedef EuclideanDistanceMatchingFilterType::LandmarkListType + LandmarkListType; typedef PointSetType::PointsContainer PointsContainerType; typedef PointsContainerType::Iterator PointsIteratorType; @@ -165,7 +167,8 @@ int main (int argc, char* argv[]) // Software Guide : BeginLatex // - // Two readers are instantiated : one for the fixed image, and one for the moving image. + // Two readers are instantiated : one for the fixed image, and one + // for the moving image. // // Software Guide : EndLatex @@ -234,7 +237,8 @@ int main (int argc, char* argv[]) // Software Guide : EndCodeSnippet MatchVectorType trueSecondOrder; - for(LandmarkListType::Iterator it = landmarkList->Begin(); it != landmarkList->End();++it) + for(LandmarkListType::Iterator it = landmarkList->Begin(); + it != landmarkList->End();++it) { PointType point1 = it.Get()->GetPoint1(); PointType point2 = it.Get()->GetPoint2(); @@ -348,10 +352,12 @@ int main (int argc, char* argv[]) LandmarkContainerPointer; typedef DeformationSourceType::LandmarkContainer LandmarkContainerType; - typedef DeformationSourceType::LandmarkPointType LandmarkPointType; + typedef DeformationSourceType::LandmarkPointType LandmarkPointType; - LandmarkContainerType::Pointer sourceLandmarks = LandmarkContainerType::New(); - LandmarkContainerType::Pointer targetLandmarks = LandmarkContainerType::New(); + LandmarkContainerType::Pointer sourceLandmarks = + LandmarkContainerType::New(); + LandmarkContainerType::Pointer targetLandmarks = + LandmarkContainerType::New(); LandmarkPointType sourcePoint; LandmarkPointType targetPoint; @@ -400,7 +406,8 @@ int main (int argc, char* argv[]) deformer->UpdateLargestPossibleRegion(); - DeformationFieldType::ConstPointer deformationField = deformer->GetOutput(); + DeformationFieldType::ConstPointer deformationField = + deformer->GetOutput(); deformer->Update(); @@ -454,7 +461,7 @@ int main (int argc, char* argv[]) // \includegraphics[width=0.40\textwidth]{ROISpot5Warped.eps} // \includegraphics[width=0.40\textwidth]{SIFTdeformationFieldOutput.eps} // \itkcaption[Deformation field from SIFT disparity map estimation]{From left - // to right and top to bottom: fixed input image, moving image with a sinusoid deformation, + // to right and top to bottom: fixed input image, moving image with a deformation, // estimated deformation field in the horizontal direction.} // \label{fig:SIFTDME} // \end{figure} diff --git a/Examples/FeatureExtraction/SIFTExample.cxx b/Examples/FeatureExtraction/SIFTExample.cxx index c7d7005d49fac4a5a38e26b637db9133a380eee4..c495b42b5b094c98ff47a5e22735f69fe5b6b665 100644 --- a/Examples/FeatureExtraction/SIFTExample.cxx +++ b/Examples/FeatureExtraction/SIFTExample.cxx @@ -134,7 +134,7 @@ int main(int argc, char * argv[]) reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); // Software Guide : EndCodeSnippet diff --git a/Examples/FeatureExtraction/SIFTFastExample.cxx b/Examples/FeatureExtraction/SIFTFastExample.cxx index ec73e0df4e5047f2bdbc43966c5d2bba0e894865..758bdcaf1419c28be5f9252300c85f5648f2796e 100644 --- a/Examples/FeatureExtraction/SIFTFastExample.cxx +++ b/Examples/FeatureExtraction/SIFTFastExample.cxx @@ -139,7 +139,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginCodeSnippet - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetNumberOfScales(scales); filter->Update(); @@ -260,7 +260,8 @@ int main(int argc, char * argv[]) ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); - OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); + OutputImageType::SizeType size = + outputImage->GetLargestPossibleRegion().GetSize(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff --git a/Examples/FeatureExtraction/SURFExample.cxx b/Examples/FeatureExtraction/SURFExample.cxx index 282cef00ccc1fe0d35744d376df24f900e4a0f42..cb3ec5b6823279a6986dd2c9a5433302be318ac4 100644 --- a/Examples/FeatureExtraction/SURFExample.cxx +++ b/Examples/FeatureExtraction/SURFExample.cxx @@ -23,11 +23,12 @@ PURPOSE. See the above copyright notices for more information. // Software Guide : BeginLatex // -// This example illustrates the use of the \doxygen{otb}{ImageToSURFKeyPointSetFilter}. -// The Speed-Up Robust Features (or SURF) is an algorithm in -// computer vision to detect and describe local features in -// images. The algorithm is detailed in \cite{SURF}. The applications -// of SURF are the same as those for SIFT. +// This example illustrates the use of the +// \doxygen{otb}{ImageToSURFKeyPointSetFilter}. The Speed-Up Robust +// Features (or SURF) is an algorithm in computer vision to detect and +// describe local features in images. The algorithm is detailed in +// \cite{SURF}. The applications of SURF are the same as those for +// SIFT. // // The first step required to use this filter is to include its header file. // @@ -136,7 +137,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginCodeSnippet - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetOctavesNumber(octaves); filter->SetScalesNumber(scales); filter->Update(); @@ -164,7 +165,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginLatex // // We set the regions of the image by copying the information from the -// input image and we allocate the memeory for the output image. +// input image and we allocate the memory for the output image. // // Software Guide : EndLatex @@ -258,7 +259,8 @@ int main(int argc, char * argv[]) ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); - OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); + OutputImageType::SizeType size = + outputImage->GetLargestPossibleRegion().GetSize(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff --git a/Examples/IO/LidarToImageExample.cxx b/Examples/IO/LidarToImageExample.cxx index 98df57c3d0ae663581c4e8eb36ffd181cc1e9aab..ad5cc863815dcfb940c11d52676c24fa37f543d9 100644 --- a/Examples/IO/LidarToImageExample.cxx +++ b/Examples/IO/LidarToImageExample.cxx @@ -27,8 +27,8 @@ // Software Guide : BeginCommandLineArgs // INPUTS: {TO_core_last_zoom.las} -// OUTPUTS: {lidar-image-8.hdr}, {lidar-image-8-pretty.png} -// 1.0 5 8 +// OUTPUTS: {lidar-image-6.hdr}, {lidar-image-6-pretty.png} +// 1.0 5 6 // Software Guide : EndCommandLineArgs @@ -259,8 +259,8 @@ int main( int argc, char* argv[] ) // \begin{figure} // \center // \includegraphics[width=0.40\textwidth]{lidar-image-4-pretty.eps} - // \includegraphics[width=0.40\textwidth]{lidar-image-8-pretty.eps} - // \itkcaption[Image from lidar data]{Image obtained with 4 level spline interpolation (left) and 8 levels (right)} + // \includegraphics[width=0.40\textwidth]{lidar-image-6-pretty.eps} + // \itkcaption[Image from lidar data]{Image obtained with 4 level spline interpolation (left) and 6 levels (right)} // \label{fig:LIDARTOIMAGEEXAMPLE} // \end{figure} // diff --git a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputAscii.cxx index 9e58dc90273024d6e85f08f36941c318079e5110..ec6cf6b9004e584e156b7c0744f75ba2de8d0305 100644 --- a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputAscii.cxx @@ -55,7 +55,7 @@ int otbImageToFastSIFTKeyPointSetFilterOutputAscii(int argc, char * argv[]) ImageToFastSIFTKeyPointSetFilterType::Pointer filter = ImageToFastSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetNumberOfScales(scales); filter->Update(); diff --git a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputImage.cxx b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputImage.cxx index 3f08c2426d6387cfc4a072f9f4553e9e2d430c43..ac6f677cfdc5994b50f6deb0f67b5dc76573db9c 100644 --- a/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputImage.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputImage.cxx @@ -53,7 +53,7 @@ int otbImageToFastSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) ImageToFastSIFTKeyPointSetFilterType::Pointer filter = ImageToFastSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetNumberOfScales(scales); filter->Update(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx index c73c8f38e95bd45a64aebeab5be47dce5e40dbd6..deb2a081e4e2008885276405dc72c5de48e2a1cd 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx @@ -64,7 +64,7 @@ OutputImageType::Pointer sift(ImageType::Pointer input, SiftFilterType::Pointer sift = SiftFilterType::New(); PointSetFilterType::Pointer pointSetFilter = PointSetFilterType::New(); - sift->SetInput(0,input); + sift->SetInput(input); sift->SetOctavesNumber(octaves); sift->SetScalesNumber(scales); sift->SetDoGThreshold(threshold); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx index 05918fdfc31c04d9a6ae09ef6d0ddd14209292a8..e0c522c810e61b3b26b117d8df145a1c8de039bf 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx @@ -58,7 +58,7 @@ int otbImageToSIFTKeyPointSetFilterOutputAscii(int argc, char * argv[]) ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetOctavesNumber(octaves); filter->SetScalesNumber(scales); filter->SetDoGThreshold(threshold); diff --git a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx index 661508467f17b659ef12a2fd42834d52436a5fd8..c724c4e112895da45b12789045d0197f130b9908 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx @@ -57,7 +57,7 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) ImageToSIFTKeyPointSetFilterType::Pointer filter = ImageToSIFTKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetOctavesNumber(octaves); filter->SetScalesNumber(scales); filter->SetDoGThreshold(threshold); diff --git a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputAscii.cxx b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputAscii.cxx index 1d696bacd6a056b8efb7460d519b76fa13605536..2d4f90a1bef02dbec0ad39422be08ba0bde1379f 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputAscii.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputAscii.cxx @@ -66,7 +66,7 @@ int otbImageToSURFKeyPointSetFilterOutputAscii(int argc, char * argv[]) ImageToSURFKeyPointSetFilterType::Pointer filter = ImageToSURFKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetOctavesNumber(octaves); filter->SetScalesNumber(scales); filter->Update(); diff --git a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputImage.cxx b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputImage.cxx index 583f6047ba190c572def030aca316de84ad944c6..bbfa954cc5da0ba9b60e8beb32d50789ebdba514 100644 --- a/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputImage.cxx +++ b/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputImage.cxx @@ -56,7 +56,7 @@ int otbImageToSURFKeyPointSetFilterOutputImage(int argc, char * argv[]) ImageToSURFKeyPointSetFilterType::Pointer filter = ImageToSURFKeyPointSetFilterType::New(); reader->SetFileName(infname); - filter->SetInput(0,reader->GetOutput()); + filter->SetInput(reader->GetOutput()); filter->SetOctavesNumber(octaves); filter->SetScalesNumber(scales); diff --git a/Testing/Code/IO/otbImageFileReaderERS.cxx b/Testing/Code/IO/otbImageFileReaderERS.cxx index c2389d96efa5916c9d34d3843d54004319f95daf..53e7b969c72aa2bdd0b50d3652dc6b589b29831c 100644 --- a/Testing/Code/IO/otbImageFileReaderERS.cxx +++ b/Testing/Code/IO/otbImageFileReaderERS.cxx @@ -35,9 +35,9 @@ int otbImageFileReaderERS(int argc, char* argv[]) const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef short OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef unsigned short OutputPixelType; + const unsigned int Dimension = 2; typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; @@ -59,7 +59,6 @@ int otbImageFileReaderERS(int argc, char* argv[]) extractROIFilter->SetStartY( 10 ); extractROIFilter->SetSizeX( 100 ); extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetSizeY( 100 ); extractROIFilter->SetInput( complexReader->GetOutput() ); WriterType::Pointer writer = WriterType::New(); diff --git a/Testing/Code/IO/otbVectorDataFileReader.cxx b/Testing/Code/IO/otbVectorDataFileReader.cxx index fac6a0b93de0dc5cafd8f2fa83a55fa006767630..d2770238d4332406c3ba3636c2f72f07cf725944 100644 --- a/Testing/Code/IO/otbVectorDataFileReader.cxx +++ b/Testing/Code/IO/otbVectorDataFileReader.cxx @@ -20,19 +20,49 @@ #include "otbVectorData.h" #include <fstream> +#include "itkTreeContainer.h" +#include "itkDataObject.h" +#include "otbDataNode.h" + int otbVectorDataFileReader(int argc, char * argv[]) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); + typedef otb::DataNode<double,2,double> DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; + typedef itk::TreeContainer<DataNodePointerType> DataTreeType; + + typedef itk::DataObject dataobjectType; + itk::Indent indent; + reader->SetFileName(argv[1]); reader->Update(); VectorDataType::Pointer data = reader->GetOutput(); - + DataTreeType::Pointer dataTree = DataTreeType::New(); + dataTree = data->GetDataTree(); + std::ofstream fout (argv[2]); - fout << data <<std::endl; + + itk::PreOrderTreeIterator<DataTreeType> it(dataTree); + it.GoToBegin(); + + while(!it.IsAtEnd()) + { + itk::PreOrderTreeIterator<DataTreeType> itParent = it; + bool goesOn = true; + while(itParent.HasParent() && goesOn ) + { + fout<<indent; + goesOn = itParent.GoToParent(); + } + fout<<"+"<<it.Get()->GetNodeTypeAsString()<<std::endl; + ++it; + } + /*added PrintSelf*/ + fout.close(); return EXIT_SUCCESS; }