diff --git a/Examples/Projections/VectorDataExtractROIExample.cxx b/Examples/Projections/VectorDataExtractROIExample.cxx index edfd7979af344dd138f42564fa46adb93589a870..6b51a8429f703bd3e787916e3dbc619d7cbb034b 100644 --- a/Examples/Projections/VectorDataExtractROIExample.cxx +++ b/Examples/Projections/VectorDataExtractROIExample.cxx @@ -29,6 +29,9 @@ // Most of the time, you won't be interested in the whole area and would like // to focuss only on the area corresponding to your satellite image. // +// The \doxygen{otb}{VectorDataExtractROI} is able to extract the area corresponding +// to your satellite image, even if the image is still in sensor geometry (provided +// the sensor model is supported by OTB). Let's see how we can do that. // // This example demonstrates the use of the // \doxygen{otb}{VectorDataExtractROI}. @@ -60,7 +63,7 @@ int main( int argc, char* argv[] ) typedef double Type; typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataExtractROI< VectorDataType > FilterType; + typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType; @@ -72,11 +75,28 @@ int main( int argc, char* argv[] ) imageReader->SetFileName(inImageName); imageReader->UpdateOutputInformation(); + // Software Guide : BeginLatex + // + // After the usual declaration (you can check the source file for the details), + // we can declare the \doxygen{otb}{VectorDataExtractROI}: + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet + typedef otb::VectorDataExtractROI< VectorDataType > FilterType; FilterType::Pointer filter = FilterType::New(); - VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); - VectorDataWriterType::Pointer writer = VectorDataWriterType::New(); - + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Then, we need to specify the region to extract. This region is a bit special as + // it contains also information related to its reference system (cartographic projection + // or sensor model projection). We retrieve all these information from the image + // we gave as an input. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet TypedRegion region; TypedRegion::SizeType size; TypedRegion::IndexType index; @@ -92,18 +112,34 @@ int main( int argc, char* argv[] ) region.SetSize(size); region.SetOrigin(index); - otb::ImageMetadataInterface::Pointer imageMetadataInterface = otb::ImageMetadataInterface::New(); - region.SetRegionProjection(imageMetadataInterface->GetProjectionRef(imageReader->GetOutput()->GetMetaDataDictionary())); + otb::ImageMetadataInterface::Pointer imageMetadataInterface + = otb::ImageMetadataInterface::New(); + region.SetRegionProjection( + imageMetadataInterface->GetProjectionRef( + imageReader->GetOutput()->GetMetaDataDictionary())); region.SetKeywordList(imageReader->GetOutput()->GetImageKeywordlist()); - reader->SetFileName(inVectorName); - - filter->SetInput(reader->GetOutput()); filter->SetRegion(region); + // Software Guide : EndCodeSnippet + VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); + VectorDataWriterType::Pointer writer = VectorDataWriterType::New(); + reader->SetFileName(inVectorName); writer->SetFileName(outVectorName); + + + // Software Guide : BeginLatex + // + // And finally, we can plug the filter in the pipeline: + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); + // Software Guide : EndCodeSnippet + writer->Update();