Commit c166d185 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

Merge branch 'faster_sample_augmentation' into 'develop'

Faster SampleAugmentation tests

See merge request orfeotoolbox/otb!357
parents 525b8691 db958814
...@@ -204,6 +204,13 @@ SampleAugmentationFilter ...@@ -204,6 +204,13 @@ SampleAugmentationFilter
auto featureCount = outputLayer.GetFeatureCount(false); auto featureCount = outputLayer.GetFeatureCount(false);
auto templateFeature = this->SelectTemplateFeature(inputLayer, classField, label); auto templateFeature = this->SelectTemplateFeature(inputLayer, classField, label);
OGRErr err = outputLayer.ogr().StartTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << outputLayer.ogr().GetName() << ".");
}
for(const auto& sample : samples) for(const auto& sample : samples)
{ {
ogr::Feature dstFeature(outputLayer.GetLayerDefn()); ogr::Feature dstFeature(outputLayer.GetLayerDefn());
...@@ -220,6 +227,11 @@ SampleAugmentationFilter ...@@ -220,6 +227,11 @@ SampleAugmentationFilter
} }
outputLayer.CreateFeature( dstFeature ); outputLayer.CreateFeature( dstFeature );
} }
err = outputLayer.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << outputLayer.ogr().GetName() << ".");
}
} }
std::set<size_t> std::set<size_t>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment