diff --git a/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx b/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx index 7e8df6ab358066e14723bad5b162ad9778b56751..2263ed97cee6e57e9401b288077f538329408093 100644 --- a/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx +++ b/Modules/Registration/Stereo/test/otbMulti3DMapToDEMFilter.cxx @@ -98,12 +98,10 @@ int otbMulti3DMapToDEMFilterEPSG(int argc, char* argv[]) for(unsigned int i=0; i<mapSize; i++) { multiFilter->Set3DMapInput(i,mapReaderList->GetNthElement(i)->GetOutput()); - // multiFilter->SetMapKeywordList(i,mapReaderList->GetNthElement(i)->GetOutput()->GetImageKeywordlist()); multiFilter->SetMaskInput(i,maskReaderList->GetNthElement(i)->GetOutput()); } //set output parameters - // multiFilter->SetOutputParametersFrom3DMap(); VectorImageType::IndexType start; start[0] = atoi(argv[argc-9]); start[1] = atoi(argv[argc-8]); @@ -132,7 +130,6 @@ int otbMulti3DMapToDEMFilterEPSG(int argc, char* argv[]) WriterType::Pointer writer = WriterType::New(); multiFilter->SetNumberOfThreads(atoi(argv[argc-11])); - //multiFilter->Update(); writer->SetInput(multiFilter->GetOutput()); @@ -141,153 +138,6 @@ int otbMulti3DMapToDEMFilterEPSG(int argc, char* argv[]) writer->Update(); return EXIT_SUCCESS; - - /* - if (argc != 12) - { - std::cout << argv[0] << - " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" - << std::endl; - - return EXIT_FAILURE; - } - - typedef otb::VectorImage<double, 2> VectorImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; - typedef otb::UtmInverseProjection UtmMapProjectionType; - typedef otb::OrthoRectificationFilter<VectorImageType, VectorImageType, UtmMapProjectionType> OrthoRectifFilterType; - - //Allocate pointer - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); - UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); - - // Set parameters ... - reader->SetFileName(argv[1]); - writer->SetFileName(argv[2]); - - reader->GenerateOutputInformation(); - std::cout << reader->GetOutput() << std::endl; - - orthoRectifFilter->SetInput(reader->GetOutput()); - - VectorImageType::IndexType start; - start[0] = 0; - start[1] = 0; - orthoRectifFilter->SetOutputStartIndex(start); - - VectorImageType::SizeType size; - size[0] = atoi(argv[5]); // X size - size[1] = atoi(argv[6]); //Y size - orthoRectifFilter->SetOutputSize(size); - - VectorImageType::SpacingType spacing; - spacing[0] = atof(argv[7]); - spacing[1] = atof(argv[8]); - orthoRectifFilter->SetOutputSpacing(spacing); - - VectorImageType::PointType origin; - origin[0] = strtod(argv[3], NULL); //Origin easting - origin[1] = strtod(argv[4], NULL); //Origin northing - orthoRectifFilter->SetOutputOrigin(origin); - - utmMapProjection->SetZone(atoi(argv[9])); - utmMapProjection->SetHemisphere(argv[10][0]); - orthoRectifFilter->SetMapProjection(utmMapProjection); - - // Deformation Field spacing - VectorImageType::SpacingType gridSpacing; - gridSpacing[0] = atof(argv[11]); - gridSpacing[1] = -atof(argv[11]); - orthoRectifFilter->SetDeformationFieldSpacing(gridSpacing); - - VectorImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel()); - no_data.Fill(0); - orthoRectifFilter->SetEdgePaddingValue(no_data); - - writer->SetInput(orthoRectifFilter->GetOutput()); - writer->SetNumberOfDivisionsTiledStreaming(4); - writer->Update(); - - return EXIT_SUCCESS; */ - - - - - /* - if (argc != 12) - { - std::cout << argv[0] << - " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" - << std::endl; - - return EXIT_FAILURE; - } - - typedef otb::VectorImage<double, 2> VectorImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; - typedef otb::UtmInverseProjection UtmMapProjectionType; - typedef otb::OrthoRectificationFilter<VectorImageType, VectorImageType, UtmMapProjectionType> OrthoRectifFilterType; - - //Allocate pointer - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); - UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); - - // Set parameters ... - reader->SetFileName(argv[1]); - writer->SetFileName(argv[2]); - - reader->GenerateOutputInformation(); - std::cout << reader->GetOutput() << std::endl; - - orthoRectifFilter->SetInput(reader->GetOutput()); - - VectorImageType::IndexType start; - start[0] = 0; - start[1] = 0; - orthoRectifFilter->SetOutputStartIndex(start); - - VectorImageType::SizeType size; - size[0] = atoi(argv[5]); // X size - size[1] = atoi(argv[6]); //Y size - orthoRectifFilter->SetOutputSize(size); - - VectorImageType::SpacingType spacing; - spacing[0] = atof(argv[7]); - spacing[1] = atof(argv[8]); - orthoRectifFilter->SetOutputSpacing(spacing); - - VectorImageType::PointType origin; - origin[0] = strtod(argv[3], NULL); //Origin easting - origin[1] = strtod(argv[4], NULL); //Origin northing - orthoRectifFilter->SetOutputOrigin(origin); - - utmMapProjection->SetZone(atoi(argv[9])); - utmMapProjection->SetHemisphere(argv[10][0]); - orthoRectifFilter->SetMapProjection(utmMapProjection); - - // Deformation Field spacing - VectorImageType::SpacingType gridSpacing; - gridSpacing[0] = atof(argv[11]); - gridSpacing[1] = -atof(argv[11]); - orthoRectifFilter->SetDeformationFieldSpacing(gridSpacing); - - VectorImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel()); - no_data.Fill(0); - orthoRectifFilter->SetEdgePaddingValue(no_data); - - writer->SetInput(orthoRectifFilter->GetOutput()); - writer->SetNumberOfDivisionsTiledStreaming(4); - writer->Update(); - - return EXIT_SUCCESS; */ } int otbMulti3DMapToDEMFilterManual(int argc, char* argv[]) @@ -354,12 +204,10 @@ multiFilter->SetCellFusionMode(fusionMode); for(unsigned int i=0; i<mapSize; i++) { multiFilter->Set3DMapInput(i,mapReaderList->GetNthElement(i)->GetOutput()); - // multiFilter->SetMapKeywordList(i,mapReaderList->GetNthElement(i)->GetOutput()->GetImageKeywordlist()); multiFilter->SetMaskInput(i,maskReaderList->GetNthElement(i)->GetOutput()); } //set output parameters -//multiFilter->SetOutputParametersFrom3DMap(); VectorImageType::IndexType start; start[0] = atoi(argv[argc-7]); start[1] = atoi(argv[argc-8]); @@ -385,7 +233,6 @@ multiFilter->SetOutputOrigin(origin); WriterType::Pointer writer = WriterType::New(); multiFilter->SetNumberOfThreads(atoi(argv[argc-10])); -//multiFilter->Update(); writer->SetInput(multiFilter->GetOutput()); @@ -395,79 +242,6 @@ writer->Update(); return EXIT_SUCCESS; - -/* -if (argc != 12) - { - std::cout << argv[0] << - " <input filename> <output filename> <origin easting> <origin northing> <x size> <y size> <x spacing> <y spacing> <UTM zone> <UTM hemisphere>" - << std::endl; - - return EXIT_FAILURE; - } - -typedef otb::VectorImage<double, 2> VectorImageType; -typedef otb::ImageFileReader<VectorImageType> ReaderType; -typedef otb::ImageFileWriter<VectorImageType> WriterType; -typedef otb::UtmInverseProjection UtmMapProjectionType; -typedef otb::OrthoRectificationFilter<VectorImageType, VectorImageType, UtmMapProjectionType> OrthoRectifFilterType; - -//Allocate pointer -ReaderType::Pointer reader = ReaderType::New(); -WriterType::Pointer writer = WriterType::New(); - -OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); -UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); - -// Set parameters ... -reader->SetFileName(argv[1]); -writer->SetFileName(argv[2]); - -reader->GenerateOutputInformation(); -std::cout << reader->GetOutput() << std::endl; - -orthoRectifFilter->SetInput(reader->GetOutput()); - -VectorImageType::IndexType start; -start[0] = 0; -start[1] = 0; -orthoRectifFilter->SetOutputStartIndex(start); - -VectorImageType::SizeType size; -size[0] = atoi(argv[5]); // X size -size[1] = atoi(argv[6]); //Y size -orthoRectifFilter->SetOutputSize(size); - -VectorImageType::SpacingType spacing; -spacing[0] = atof(argv[7]); -spacing[1] = atof(argv[8]); -orthoRectifFilter->SetOutputSpacing(spacing); - -VectorImageType::PointType origin; -origin[0] = strtod(argv[3], NULL); //Origin easting -origin[1] = strtod(argv[4], NULL); //Origin northing -orthoRectifFilter->SetOutputOrigin(origin); - -utmMapProjection->SetZone(atoi(argv[9])); -utmMapProjection->SetHemisphere(argv[10][0]); -orthoRectifFilter->SetMapProjection(utmMapProjection); - -// Deformation Field spacing -VectorImageType::SpacingType gridSpacing; -gridSpacing[0] = atof(argv[11]); -gridSpacing[1] = -atof(argv[11]); -orthoRectifFilter->SetDeformationFieldSpacing(gridSpacing); - -VectorImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel()); -no_data.Fill(0); -orthoRectifFilter->SetEdgePaddingValue(no_data); - -writer->SetInput(orthoRectifFilter->GetOutput()); -writer->SetNumberOfDivisionsTiledStreaming(4); -writer->Update(); - -return EXIT_SUCCESS; */ - } @@ -529,7 +303,7 @@ int otbMulti3DMapToDEMFilter(int argc, char* argv[]) for(unsigned int i=0; i<mapSize; i++) { multiFilter->Set3DMapInput(i,mapReaderList->GetNthElement(i)->GetOutput()); - // multiFilter->SetMapKeywordList(i,mapReaderList->GetNthElement(i)->GetOutput()->GetImageKeywordlist()); + multiFilter->SetMaskInput(i,maskReaderList->GetNthElement(i)->GetOutput()); } multiFilter->SetOutputParametersFrom3DMap(); @@ -537,7 +311,6 @@ int otbMulti3DMapToDEMFilter(int argc, char* argv[]) WriterType::Pointer writer = WriterType::New(); multiFilter->SetNumberOfThreads(atoi(argv[argc-2])); - //multiFilter->Update(); writer->SetInput(multiFilter->GetOutput());