Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
f1061c58
Commit
f1061c58
authored
Oct 10, 2013
by
Julien Michel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: LSMS integration (typedef cleaning)
parent
138a0ab0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
28 deletions
+12
-28
Applications/Segmentation/otbLSMSSegmentation.cxx
Applications/Segmentation/otbLSMSSegmentation.cxx
+12
-28
No files found.
Applications/Segmentation/otbLSMSSegmentation.cxx
View file @
f1061c58
...
...
@@ -15,8 +15,6 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbMultiChannelExtractROI.h"
...
...
@@ -27,13 +25,10 @@
#include "itkStatisticsImageFilter.h"
#include "itkChangeLabelImageFilter.h"
#include "itkImageRegionConstIterator.h"
#include "otbTileImageFilter.h"
#include "itkLabelToRGBImageFilter.h"
#include "itkScalarConnectedComponentImageFilter.h"
#include "otbConcatenateVectorImageFilter.h"
#include "otbMultiToMonoChannelExtractROI.h"
#include "otbObjectList.h"
#include "otbImportGeoInformationImageFilter.h"
#include <time.h>
...
...
@@ -61,40 +56,26 @@ public:
itkTypeMacro
(
MeanShiftSegmentation
,
otb
::
Application
);
typedef
float
ImagePixelType
;
typedef
otb
::
VectorImage
<
ImagePixelType
,
2
>
ImageType
;
typedef
FloatVectorImageType
ImageType
;
typedef
ImageType
::
InternalPixelType
ImagePixelType
;
typedef
UInt32ImageType
LabelImageType
;
typedef
LabelImageType
::
InternalPixelType
LabelPixelType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ImageReaderType
;
typedef
otb
::
ImageFileWriter
<
ImageType
>
ImageWriterType
;
typedef
unsigned
int
LabelImagePixelType
;
typedef
otb
::
Image
<
LabelImagePixelType
,
2
>
LabelImageType
;
typedef
otb
::
ImageFileReader
<
LabelImageType
>
LabelImageReaderType
;
typedef
otb
::
ImageFileWriter
<
LabelImageType
>
LabelImageWriterType
;
typedef
otb
::
MultiChannelExtractROI
<
ImagePixelType
,
ImagePixelType
>
MultiChannelExtractROIFilterType
;
typedef
otb
::
ExtractROI
<
LabelImagePixelType
,
LabelImagePixelType
>
ExtractROIFilterType
;
typedef
otb
::
ExtractROI
<
LabelImagePixelType
,
LabelImagePixelType
>
ExtractROIFilterType
;
typedef
otb
::
MultiToMonoChannelExtractROI
<
ImagePixelType
,
LabelImagePixelType
>
MultiToMonoChannelExtractROIFilterType
;
typedef
otb
::
ObjectList
<
MultiToMonoChannelExtractROIFilterType
>
MultiToMonoChannelExtractROIFilterListType
;
typedef
otb
::
Functor
::
ConnectedComponentMuParserFunctor
<
ImageType
::
PixelType
>
CCFunctorType
;
typedef
itk
::
ConnectedComponentFunctorImageFilter
<
ImageType
,
LabelImageType
,
CCFunctorType
,
otb
::
Image
<
unsigned
int
>
>
CCFilterType
;
typedef
itk
::
ScalarConnectedComponentImageFilter
<
LabelImageType
,
LabelImageType
>
ScalarCCFilterType
;
typedef
otb
::
BandMathImageFilter
<
LabelImageType
>
BandMathImageFilterType
;
typedef
itk
::
StatisticsImageFilter
<
LabelImageType
>
StatisticsImageFilterType
;
typedef
itk
::
ChangeLabelImageFilter
<
LabelImageType
,
LabelImageType
>
ChangeLabelImageFilterType
;
typedef
otb
::
TileImageFilter
<
LabelImageType
>
TileImageFilterType
;
typedef
otb
::
ImportGeoInformationImageFilter
<
LabelImageType
,
ImageType
>
ImportGeoInformationImageFilterType
;
typedef
itk
::
ImageRegionConstIterator
<
LabelImageType
>
LabelImageIterator
;
typedef
itk
::
RGBPixel
<
unsigned
char
>
RGBPixelType
;
typedef
otb
::
Image
<
RGBPixelType
,
2
>
RGBImageType
;
typedef
itk
::
LabelToRGBImageFilter
<
LabelImageType
,
RGBImageType
>
LabelToRGBFilterType
;
typedef
otb
::
ImageFileWriter
<
RGBImageType
>
RGBWriterType
;
typedef
otb
::
ConcatenateVectorImageFilter
<
ImageType
,
ImageType
,
ImageType
>
ConcatenateType
;
private:
...
...
@@ -160,7 +141,7 @@ private:
std
::
string
outfname
=
GetParameterString
(
"out"
);
std
::
string
vrtfname
=
outfname
.
substr
(
0
,
outfname
.
size
()
-
itksys
::
SystemTools
::
GetFilenameExtension
(
outfname
.
c_str
()).
size
()).
append
(
".vrt"
);
std
::
cout
<<
"Creating vrt: "
<<
vrtfname
<<
std
::
endl
;
otbAppLogINFO
(
<<
"Creating vrt: "
<<
vrtfname
)
;
std
::
ofstream
ofs
(
vrtfname
.
c_str
());
...
...
@@ -514,7 +495,7 @@ private:
}
LUT
[
label
]
=
can
;
}
otbAppLogINFO
(
<<
"LUT size: "
<<
LUT
.
size
());
otbAppLogINFO
(
<<
"LUT size: "
<<
LUT
.
size
()
<<
" segments"
);
// These variables will be used to estimate the size of each
// region on the flow
...
...
@@ -578,6 +559,8 @@ private:
// Clear lut, we do not need it anymore
LUT
.
clear
();
unsigned
int
smallCount
=
0
;
// Create the LUT to filter small regions and assign min labels
otbAppLogINFO
(
<<
"Small regions pruning ..."
);
LabelImagePixelType
newLab
=
1
;
...
...
@@ -587,6 +570,7 @@ private:
if
(
sizePerRegion
[
curLabel
]
<
minRegionSize
)
{
newLabels
[
curLabel
]
=
0
;
++
smallCount
;
}
else
{
...
...
@@ -594,8 +578,8 @@ private:
newLab
+=
1
;
}
}
otbAppLogINFO
(
<<
"LUT size: "
<<
newLabels
.
size
());
otbAppLogINFO
(
<<
smallCount
<<
" small regions will be removed"
);
// Clear sizePerRegion, we do not need it anymore
sizePerRegion
.
clear
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment