Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
b7c81c63
Commit
b7c81c63
authored
13 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
ENH: replace direct use of MemoryPrintEstimator by integrated functionnality in StreamingFileWriter
parent
83423b53
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Projections/otbBundleToPerfectSensor.cxx
+4
-53
4 additions, 53 deletions
Projections/otbBundleToPerfectSensor.cxx
with
4 additions
and
53 deletions
Projections/otbBundleToPerfectSensor.cxx
+
4
−
53
View file @
b7c81c63
...
...
@@ -34,9 +34,6 @@
#include
"itkFixedArray.h"
#include
"otbPipelineMemoryPrintCalculator.h"
#include
"itkExtractImageFilter.h"
namespace
otb
{
int
BundleToPerfectSensor
::
Describe
(
ApplicationDescriptor
*
descriptor
)
...
...
@@ -142,61 +139,15 @@ int BundleToPerfectSensor::Execute(otb::ApplicationOptionsResult* parseResult)
writer
->
SetFileName
(
parseResult
->
GetOutputImage
());
writer
->
SetInput
(
fusionFilter
->
GetOutput
());
writer
->
SetWriteGeomFile
(
true
);
otb
::
StandardWriterWatcher
w4
(
writer
,
resampler
,
"Perfect sensor fusion"
);
// Estimate memory print
otb
::
PipelineMemoryPrintCalculator
::
Pointer
memoryPrintCalculator
=
otb
::
PipelineMemoryPrintCalculator
::
New
();
const
double
byteToMegabyte
=
1.
/
vcl_pow
(
2.0
,
20
);
// Trick to avoid having the resampler compute the whole
// deformation field
ExtractFilterType
::
Pointer
extractFilter
=
ExtractFilterType
::
New
();
extractFilter
->
SetInput
(
fusionFilter
->
GetOutput
());
XsImageType
::
RegionType
smallRegion
;
XsImageType
::
SizeType
smallSize
;
smallSize
.
Fill
(
100
);
XsImageType
::
IndexType
index
;
index
[
0
]
=
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetIndex
()[
0
]
+
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetSize
()[
0
]
/
2
-
50
;
index
[
1
]
=
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetIndex
()[
1
]
+
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetSize
()[
1
]
/
2
-
50
;
smallRegion
.
SetSize
(
smallSize
);
smallRegion
.
SetIndex
(
index
);
extractFilter
->
SetExtractionRegion
(
smallRegion
);
bool
smallRegionSuccess
=
smallRegion
.
Crop
(
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
());
if
(
smallRegionSuccess
)
{
memoryPrintCalculator
->
SetDataToWrite
(
extractFilter
->
GetOutput
());
double
regionTrickFactor
=
(
double
)
fusionFilter
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetNumberOfPixels
()
/
(
double
)(
smallRegion
.
GetNumberOfPixels
());
memoryPrintCalculator
->
SetBiasCorrectionFactor
(
1.27
*
regionTrickFactor
);
}
else
{
memoryPrintCalculator
->
SetDataToWrite
(
fusionFilter
->
GetOutput
());
memoryPrintCalculator
->
SetBiasCorrectionFactor
(
1.27
);
}
memoryPrintCalculator
->
SetAvailableMemory
(
256
/
byteToMegabyte
);
unsigned
int
ram
=
256
;
if
(
parseResult
->
IsOptionPresent
(
"AvailableMemory"
))
{
long
long
int
memory
=
static_cast
<
long
long
int
>
(
parseResult
->
GetParameterUInt
(
"AvailableMemory"
));
memoryPrintCalculator
->
SetAvailableMemory
(
memory
/
byteToMegabyte
);
ram
=
parseResult
->
GetParameterUInt
(
"AvailableMemory"
);
}
writer
->
SetAutomaticTiledStreaming
(
ram
);
memoryPrintCalculator
->
Compute
();
std
::
cout
<<
"Total memory usage: "
<<
memoryPrintCalculator
->
GetMemoryPrint
()
*
byteToMegabyte
<<
" Mb"
<<
std
::
endl
;
std
::
cout
<<
"Optimal stream division: "
<<
memoryPrintCalculator
->
GetOptimalNumberOfStreamDivisions
()
<<
std
::
endl
;
writer
->
SetTilingStreamDivisions
(
memoryPrintCalculator
->
GetOptimalNumberOfStreamDivisions
());
otb
::
StandardWriterWatcher
w4
(
writer
,
resampler
,
"Perfect sensor fusion"
);
writer
->
Update
();
}
catch
(
itk
::
ExceptionObject
&
err
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment