LoadTIFF
This commit is contained in:
parent
c48f0497e2
commit
05e7474a33
32
ld2dap/LoadTIFF.py
Normal file
32
ld2dap/LoadTIFF.py
Normal 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
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user