This commit is contained in:
Florent Guiotte 2018-04-04 16:02:35 +02:00
parent c48f0497e2
commit 05e7474a33
4 changed files with 42 additions and 8 deletions

32
ld2dap/LoadTIFF.py Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# \file LoadTIFF.py
# \brief TODO
# \author Florent Guiotte <florent.guiotte@gmail.com>
# \version 0.1
# \date 04 avril 2018
#
# TODO details
from core import Input
import numpy as np
## TODO: dep
import sys
sys.path.append('../triskele/python')
import triskele
class LoadTIFF(Input):
def __init__(self, tiffFiles):
super().__init__(self.__class__.__name__)
self.files = tiffFiles
def _process(self, data, metadata):
layers = list()
for file in self.files:
print('Loading {}'.format(file))
layers.append(triskele.read(file))
return np.stack(layers, axis=2), self.files

View File

@ -13,5 +13,5 @@ from .Output import Output
class Filter(Output, Input):
"""Output should be first"""
def __init__(self):
super().__init__('Filter')
def __init__(self, name='__CHILD__'):
super().__init__('Filter:{}'.format(name))

View File

@ -9,7 +9,7 @@
# TODO details
class Node:
class Node(object):
def __init__(self, name='A NODE HAS NO NAME'):
self.name = name
@ -20,7 +20,8 @@ class Node:
self._process(data)
def _process(self, data, metadata=None):
raise NotImplementedError('{} should override _process()'.format(self))
raise NotImplementedError(
'{} should override _process(self, data, metadata)'.format(self))
def _run(self):
raise NotImplementedError('{} should override _run()'.format(self))

View File

@ -9,12 +9,13 @@
# TODO details
from core import Input, Output, Filter
from LoadTIFF import LoadTIFF
def main():
i = Input()
o = Output()
n = Filter()
f = Filter()
i = LoadTIFF(['../Data/test.tiff'])
o = Output('o')
n = Filter('n')
f = Filter('f')
print(n)
#n.run()
print(n.input)