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
LSGRM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cresson Remi
LSGRM
Commits
bb65d2e0
Commit
bb65d2e0
authored
Aug 23, 2016
by
remicres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REFAC: functions use ProcesingTiles instead of many numeric and string variables
parent
69882db5
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
399 deletions
+121
-399
include/lsgrmController.h
include/lsgrmController.h
+6
-8
include/lsgrmController.txx
include/lsgrmController.txx
+7
-10
include/lsgrmGraphOperations.h
include/lsgrmGraphOperations.h
+18
-10
include/lsgrmGraphOperations.txx
include/lsgrmGraphOperations.txx
+90
-371
No files found.
include/lsgrmController.h
View file @
bb65d2e0
...
...
@@ -49,13 +49,12 @@ public:
typename
LabelImageType
::
Pointer
GetLabeledClusteredOutput
();
itkGetMacro
(
Margin
,
unsigned
int
);
itkGetMacro
(
TemporaryFilesList
,
std
::
vector
<
std
::
string
>
);
itkGetMacro
(
CleanTemporary
Directory
,
bool
);
itkSetMacro
(
CleanTemporary
Directory
,
bool
);
itkGetMacro
(
CleanTemporary
Files
,
bool
);
itkSetMacro
(
CleanTemporary
Files
,
bool
);
itkGetMacro
(
Temporary
Directory
,
std
::
string
);
itkSetMacro
(
Temporary
Directory
,
std
::
string
);
itkGetMacro
(
Temporary
FilesPrefix
,
std
::
string
);
itkSetMacro
(
Temporary
FilesPrefix
,
std
::
string
);
itkGetMacro
(
Threshold
,
float
);
itkSetMacro
(
Threshold
,
float
);
...
...
@@ -94,8 +93,8 @@ private:
long
unsigned
int
GetMaximumNumberOfNodesInMemory
();
/* Parameters given by the user */
std
::
string
m_Temporary
Directory
;
// Directory
used to store intermediate files during the process.
bool
m_CleanTemporary
Directory
;
// Clean the temporary directory.
std
::
string
m_Temporary
FilesPrefix
;
// Path
used to store intermediate files during the process.
bool
m_CleanTemporary
Files
;
// Clean temporary files
ImageType
*
m_InputImage
;
// Input image
/* Segmentation parameters */
...
...
@@ -117,7 +116,6 @@ private:
LSGRMTilingMode
m_TilingMode
;
// tiling mode (none/user/auto)
unsigned
int
m_Margin
;
// stability margin related to m_NumberOfFirstIterations
std
::
vector
<
ProcessingTile
>
m_Tiles
;
// list of tiles
std
::
vector
<
std
::
string
>
m_TemporaryFilesList
;
// list of temporary files
typename
LabelImageType
::
Pointer
m_LabelImage
;
// output label image
};
}
// end of namespace lsgrm
...
...
include/lsgrmController.txx
View file @
bb65d2e0
...
...
@@ -14,7 +14,7 @@ Controller<TSegmenter>::Controller()
m_TileWidth = 0;
m_NbTilesX = 0;
m_NbTilesY = 0;
m_CleanTemporary
Directory
= true;
m_CleanTemporary
Files
= true;
m_Threshold = 75;
m_Memory = 0;
}
...
...
@@ -53,8 +53,8 @@ void Controller<TSegmenter>::RunSegmentation()
"\n\tTiling layout: " << m_NbTilesX << " x " << m_NbTilesY << std::endl;
// Compute the splitting scheme
SplitOTBImage<ImageType>(m_InputImage, m_TileWidth, m_TileHeight, m_Margin,
m_NbTilesX, m_NbTilesY, m_T
iles
);
m_Tiles =
SplitOTBImage<ImageType>(m_InputImage, m_TileWidth, m_TileHeight, m_Margin,
m_NbTilesX, m_NbTilesY, m_T
emporaryFilesPrefix
);
// Boolean indicating if there are remaining fusions
bool isFusion = false;
...
...
@@ -72,9 +72,7 @@ void Controller<TSegmenter>::RunSegmentation()
m_NbTilesY,
m_TileWidth,
m_TileHeight,
m_TemporaryDirectory,
isFusion);
// long long unsigned int accumulatedMemory = 19373051714;
// Update the given number of iterations
numberOfIterationsRemaining -= m_NumberOfFirstIterations;
...
...
@@ -96,7 +94,6 @@ void Controller<TSegmenter>::RunSegmentation()
m_Threshold,
numberOfIterationsForPartialSegmentations,
m_Tiles,
m_TemporaryDirectory,
m_NbTilesX,
m_NbTilesY,
m_InputImage->GetLargestPossibleRegion().GetSize()[0],
...
...
@@ -127,7 +124,6 @@ void Controller<TSegmenter>::RunSegmentation()
m_SpecificParameters,
m_Threshold,
m_Tiles,
m_TemporaryDirectory,
m_NbTilesX,
m_NbTilesY,
m_InputImage->GetLargestPossibleRegion().GetSize()[0],
...
...
@@ -176,7 +172,7 @@ unsigned int Controller<TSegmenter>::GetNodeMemory()
lsrm::GraphOperations<TSegmenter>::InitNodes(onePixelImage,segmenter,FOUR);
unsigned int memory = segmenter.GetGraphMemory() / (n*n);
itk
Warnin
gMacro(<<"Size of a node is " << memory);
itk
Debu
gMacro(<<"Size of a node is " << memory);
return memory;
}
...
...
@@ -198,7 +194,8 @@ long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
}
template<class TSegmenter>
void Controller<TSegmenter>::ComputeMaximumStabilityMargin(unsigned int width,
void
Controller<TSegmenter>::ComputeMaximumStabilityMargin(unsigned int width,
unsigned int height, unsigned int &niter, unsigned int &margin)
{
itkDebugMacro(<< "Computing maximum stability margin");
...
...
@@ -331,7 +328,7 @@ void Controller<TSegmenter>::GetAutomaticConfiguration()
long long unsigned int memoryUsed = GetNodeMemory();
memoryUsed *= static_cast<long long unsigned int>(m_TileHeight + 2*m_Margin);
memoryUsed *= static_cast<long long unsigned int>(m_TileWidth + 2*m_Margin);
itk
Warnin
gMacro(<< "An amount of " << memoryUsed/(1024.0*1024.0) << " Mbytes of RAM will be used for regular tiles of size "
itk
Debu
gMacro(<< "An amount of " << memoryUsed/(1024.0*1024.0) << " Mbytes of RAM will be used for regular tiles of size "
<< (m_TileWidth + 2*m_Margin) << "x" << (m_TileHeight + 2*m_Margin) );
}
...
...
include/lsgrmGraphOperations.h
View file @
bb65d2e0
...
...
@@ -16,6 +16,12 @@ struct ProcessingTile
long
int
tileNeighbors
[
8
];
// tile Neighbors at (top, top right, right, bottom right, bottom, bottom left, left, top left)
long
int
margin
[
4
];
// Is there a margin at top, left, bottom or right
otb
::
VectorImage
<
double
>::
RegionType
region
;
// The image region
// Temporary files
std
::
string
nodeFileName
;
std
::
string
edgeFileName
;
std
::
string
nodeMarginFileName
;
std
::
string
edgeMarginFileName
;
};
// Read an image region
...
...
@@ -30,7 +36,6 @@ MergeAllGraphsAndAchieveSegmentation(
const
typename
TSegmenter
::
ParameterType
&
params
,
const
float
&
threshold
,
std
::
vector
<
ProcessingTile
>&
tiles
,
const
std
::
string
&
tmpDir
,
const
unsigned
int
nbTilesX
,
const
unsigned
int
nbTilesY
,
const
unsigned
int
imageWidth
,
...
...
@@ -50,7 +55,6 @@ long long unsigned int RunFirstPartialSegmentation(
const
unsigned
int
nbTilesY
,
const
unsigned
int
tileWidth
,
const
unsigned
int
tileHeight
,
const
std
::
string
&
tmpDir
,
bool
&
isFusion
);
template
<
class
TSegmenter
>
...
...
@@ -59,7 +63,6 @@ long long unsigned int RunPartialSegmentation(
const
float
&
threshold
,
const
unsigned
int
niter
,
std
::
vector
<
ProcessingTile
>&
tiles
,
const
std
::
string
&
tmpDir
,
const
unsigned
int
nbTilesX
,
const
unsigned
int
nbTilesY
,
const
unsigned
int
imageWidth
,
...
...
@@ -101,9 +104,13 @@ void BuildBorderPixelMap(typename TSegmenter::GraphType& graph,
std
::
vector
<
typename
TSegmenter
::
NodePointerType
>
>&
borderPixelMap
,
const
unsigned
int
imageWidth
);
template
<
class
TSegmenter
>
void
InsertNodesFromTile
(
typename
TSegmenter
::
GraphType
&
graph
,
ProcessingTile
&
tile
,
bool
margin
=
true
);
template
<
class
TSegmenter
>
void
AddStabilityMargin
(
typename
TSegmenter
::
GraphType
&
graph
,
const
std
::
string
&
tmpDir
,
std
::
vector
<
ProcessingTile
>&
tiles
,
const
unsigned
int
row
,
const
unsigned
int
col
,
const
unsigned
int
nbTilesX
,
...
...
@@ -134,18 +141,19 @@ void DetectBorderNodes(typename TSegmenter::GraphType& graph,
const
unsigned
int
imageHeight
);
template
<
class
TSegmenter
>
void
ReadGraph
(
typename
TSegmenter
::
GraphType
&
graph
,
void
ReadGraph
(
TSegmenter
&
segmenter
,
const
std
::
string
&
nodesPath
,
const
std
::
string
&
edgesPath
);
template
<
class
TSegmenter
>
void
WriteGraph
(
typename
TSegmenter
::
GraphType
&
graph
,
const
std
::
string
&
tmpDir
,
const
unsigned
int
row
,
const
unsigned
int
col
);
void
ReadGraph
(
typename
TSegmenter
::
GraphType
&
graph
,
const
std
::
string
&
nodesPath
,
const
std
::
string
&
edgesPath
);
template
<
class
TSegmenter
>
long
long
unsigned
int
GetGraphMemory
(
TSegmenter
segmenter
);
void
WriteGraph
(
typename
TSegmenter
::
GraphType
&
graph
,
const
std
::
string
&
nodesFile
,
const
std
::
string
&
edgesFile
);
template
<
class
TSegmenter
>
void
RemoveUnstableSegments
(
typename
TSegmenter
::
GraphType
&
graph
,
...
...
include/lsgrmGraphOperations.txx
View file @
bb65d2e0
This diff is collapsed.
Click to expand it.
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