From 4c8b9738e454d76dd22c55e14ad5ae2869b6d63d Mon Sep 17 00:00:00 2001 From: Karamaz0V1 Date: Wed, 4 Apr 2018 18:28:05 +0200 Subject: [PATCH] Start of AttributeProfiles --- ld2dap/AttributeProfiles.py | 34 ++++++++++++++++++++++++++++++++++ ld2dap/test.py | 17 ++++++----------- 2 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 ld2dap/AttributeProfiles.py diff --git a/ld2dap/AttributeProfiles.py b/ld2dap/AttributeProfiles.py new file mode 100644 index 0000000..c8551cf --- /dev/null +++ b/ld2dap/AttributeProfiles.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# \file AttributeProfiles.py +# \brief TODO +# \author Florent Guiotte +# \version 0.1 +# \date 04 avril 2018 +# +# TODO details + +from core import Filter + +## TODO: dep +import sys +sys.path.append('../triskele/python') +import triskele + +class AttributeProfiles(Filter): + def __init__(self, area=None, sd=None, moi=None): + super().__init__(self.__class__.__name__) + self.area = area + self.sd = sd + self.moi = moi + + def _process(self, data, metadata): + t = triskele.Triskele(data, verbose=False) + att_min = t.filter(tree='min-tree', area=self.area, + standard_deviation=self.sd, + moment_of_inertia=self.moi) + att_max = t.filter(tree='max-tree', area=self.area, + standard_deviation=self.sd, + moment_of_inertia=self.moi) + + return att, None diff --git a/ld2dap/test.py b/ld2dap/test.py index cea299e..1e3fbed 100644 --- a/ld2dap/test.py +++ b/ld2dap/test.py @@ -10,22 +10,17 @@ from core import Input, Output, Filter from LoadTIFF import LoadTIFF +from AttributeProfiles import AttributeProfiles as APs def main(): i = LoadTIFF(['../Data/test.tiff']) + ap = APs() o = Output('o') - n = Filter('n') - f = Filter('f') - print(n) - #n.run() - print(n.input) - f.input = i - n.input = f - o.input = n + + ap.input = i + o.input = i + o.run() - #i.process(None) - print(n.input) - print(f.outputs) if __name__ == '__main__': main()