modifié : MakefileNoOTB
modifié : include/Attributes/MoIAttributes.tpp modifié : include/Attributes/SDAttributes.tpp modifié : src/Appli/Option.cpp modifié : src/testMain.cpp
This commit is contained in:
parent
d5590bc10a
commit
4a994e093f
@ -48,7 +48,7 @@ $(TST_OUT): $(TST_SRC) $(LIB_DIR)/libtriskele.a
|
||||
testMain: $(TST_OUT)
|
||||
# $(TST_OUT) data/nairobi-byte.tif data/result.tif -b 0 -w 4000 -h 4000 --min-tree -A data/areaThresholds.txt # --debug
|
||||
# $(TST_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
|
||||
$(TST_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
|
||||
$(TST_OUT) data/10m.tif data/result.tif --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
|
||||
|
||||
|
||||
## DEPENDS #############################
|
||||
|
||||
@ -16,6 +16,8 @@ inline void
|
||||
MoIAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
||||
const vector<double> &thresholds) const {
|
||||
DEF_LOG ("MoIAttributes::cut", "thresholds:" << thresholds.size ());
|
||||
if (!thresholds.size ())
|
||||
return;
|
||||
double maxValue = CompAttribute<double>::getMaxValue ();
|
||||
cerr << "moi max value:" << maxValue << endl;
|
||||
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
||||
|
||||
@ -16,6 +16,8 @@ inline void
|
||||
SDAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
|
||||
const vector<double> &thresholds) const {
|
||||
DEF_LOG ("SDAttributes::cut", "thresholds:" << thresholds.size ());
|
||||
if (!thresholds.size ())
|
||||
return;
|
||||
double maxValue = CompAttribute<double>::getMaxValue ();
|
||||
cerr << "sd max value:" << maxValue << endl;
|
||||
CompAttributeC<double>::cut (allBands, attributeProfiles, 0,
|
||||
|
||||
@ -191,8 +191,11 @@ Option::parse (int argc, char** argv) {
|
||||
GDALDataType inputType = inputImage.getDataType ();
|
||||
|
||||
int bandInputCount = inputImage.getBandCount ();
|
||||
if (selectedBand.empty ())
|
||||
selectedBand = Selected (0, bandInputCount-1);
|
||||
selectedBand.setLimits (0, bandInputCount-1);
|
||||
selectedBand.toSet ();
|
||||
cerr << "coucou:" << selectedBand << endl;
|
||||
|
||||
Size orgSize = inputImage.getSize ();
|
||||
if (width < 0 || width > orgSize.width)
|
||||
|
||||
@ -51,7 +51,7 @@ void apGenerator (Option &option) {
|
||||
DimChanel maxThresholds = max (max (option.areaThresholds.size (), option.sdThresholds.size ()), option.moiThresholds.size ());
|
||||
vector <vector <PixelT> > allBands (maxThresholds, vector<PixelT> (leafCount, 0));
|
||||
|
||||
DimChanel outputBandsCard = 1+treeTypesCard*(option.areaThresholds.size ()+option.sdThresholds.size ()+option.moiThresholds.size ()); // XXX * bands
|
||||
DimChanel outputBandsCard = option.selectedBand.getSet ().size ()*(1+treeTypesCard*(option.areaThresholds.size ()+option.sdThresholds.size ()+option.moiThresholds.size ()));
|
||||
option.outputImage.createImage (option.size, option.inputImage.getDataType (), outputBandsCard);
|
||||
|
||||
Raster<PixelT> raster;
|
||||
@ -69,17 +69,18 @@ void apGenerator (Option &option) {
|
||||
atb.setAttributProfiles (attributeProfiles);
|
||||
|
||||
AreaAttributes areaAttributes (tree);
|
||||
areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds);
|
||||
for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel)
|
||||
option.outputImage.writeBand (&allBands[c][0], chanel);
|
||||
|
||||
{ // free SDAttributes after use
|
||||
if (option.areaThresholds.size ()) {
|
||||
areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds);
|
||||
for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel)
|
||||
option.outputImage.writeBand (&allBands[c][0], chanel);
|
||||
}
|
||||
if (option.sdThresholds.size ()) {
|
||||
SDAttributes sdAttributes (tree, areaAttributes);
|
||||
sdAttributes.cut (allBands, attributeProfiles, option.sdThresholds);
|
||||
for (DimChanel c = 0; c < option.sdThresholds.size (); ++c, ++chanel)
|
||||
option.outputImage.writeBand (&allBands[c][0], chanel);
|
||||
}
|
||||
{ // free MoIAttributes after use
|
||||
if (option.moiThresholds.size ()) {
|
||||
XYAttributes xyAttributes (tree, areaAttributes);
|
||||
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes);
|
||||
moiAttributes.cut (allBands, attributeProfiles, option.moiThresholds);
|
||||
@ -88,15 +89,6 @@ void apGenerator (Option &option) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//weightAttributes.printValues ("weight");
|
||||
//tree.printTree ();
|
||||
//attributeProfiles.printValues ();
|
||||
//areaAttributes.printValues ("area");
|
||||
// AverageAttributes averageAttributes (tree, raster, areaAttributes);
|
||||
// averageAttributes.printValues ("average");
|
||||
// sdAttributes.printValues ("sd");
|
||||
// //xyAttributes.printValues ("XY"); // pb print de complexe
|
||||
// moiAttributes.printValues ("moi");
|
||||
|
||||
cerr << endl << "*** apGenerator done!" << endl;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user