Create ld2dap package
This commit is contained in:
parent
3d13e1c1df
commit
f633ca0a64
@ -6,7 +6,16 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from pathlib import Path"
|
||||
"import sys\n",
|
||||
"from pathlib import Path\n",
|
||||
"import numpy as np\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import collections\n",
|
||||
"\n",
|
||||
"ld2dap_path = Path('../')\n",
|
||||
"sys.path.append(str(ld2dap_path.resolve()))\n",
|
||||
"import ld2dap\n",
|
||||
"from ld2dap.core import Filter"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -15,7 +24,47 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"url = '../Data/test.tiff'"
|
||||
"load = ld2dap.LoadTIFF('../Data/test.tiff')\n",
|
||||
"trsh = ld2dap.Treshold(1e3)\n",
|
||||
"disp = ld2dap.ShowFig(fname=None)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"disp.input = trsh\n",
|
||||
"trsh.input = load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"disp.run()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"load.files"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"A = 'est'\n",
|
||||
"isinstance(A, collections.Iterable)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
31
Notebooks/Node Streaming Debug.ipynb
Normal file
31
Notebooks/Node Streaming Debug.ipynb
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from core import Filter, Stack
|
||||
from .core import Filter, Stack
|
||||
|
||||
## TODO: dep
|
||||
import sys
|
||||
|
@ -8,7 +8,7 @@
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from core import Input, Stack
|
||||
from ld2dap.core import Input, Stack
|
||||
import numpy as np
|
||||
|
||||
## TODO: dep
|
||||
@ -19,7 +19,7 @@ import triskele
|
||||
class LoadTIFF(Input):
|
||||
def __init__(self, tiffFiles):
|
||||
super().__init__(self.__class__.__name__)
|
||||
self.files = tiffFiles
|
||||
self.files = tiffFiles if isinstance(tiffFiles, list) else [tiffFiles]
|
||||
|
||||
def _process(self, data, metadata):
|
||||
layers = list()
|
||||
|
@ -8,7 +8,7 @@
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from core import Output
|
||||
from ld2dap.core import Output
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from core import Output
|
||||
from ld2dap.core import Output
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
@ -26,6 +26,7 @@ class ShowFig(Output):
|
||||
img = f1.imshow(data[:,:,-1])
|
||||
plt.colorbar(img)
|
||||
if metadata is not None:
|
||||
f1.set_title(metadata[-1].desc)
|
||||
print (metadata[0].desc)
|
||||
f1.set_title(' > '.join(metadata[0].desc[-1]))
|
||||
plt.show()
|
||||
plt.close(fig)
|
||||
|
@ -8,7 +8,7 @@
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from core import Filter
|
||||
from ld2dap.core import Filter
|
||||
|
||||
class Treshold(Filter):
|
||||
def __init__(self, treshold, max_value=None):
|
||||
@ -21,6 +21,8 @@ class Treshold(Filter):
|
||||
self.max_value = data[data < self.treshold].max()
|
||||
|
||||
for stack in metadata:
|
||||
stack.desc.append('treshold {}'.format(self.treshold))
|
||||
for d, s in zip(stack.desc, stack.symb):
|
||||
d.append('treshold {}'.format(self.treshold))
|
||||
s.append('T_{{{}}}'.format(self.treshold))
|
||||
|
||||
return data * (data < self.treshold) + self.max_value * (data >= self.treshold), metadata
|
||||
|
15
ld2dap/__init__.py
Normal file
15
ld2dap/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file __init__.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 12 avril 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
from .AttributeProfiles import AttributeProfiles
|
||||
from .Treshold import Treshold
|
||||
from .LoadTIFF import LoadTIFF
|
||||
from .SaveFig import SaveFig
|
||||
from .ShowFig import ShowFig
|
@ -9,16 +9,13 @@
|
||||
# TODO details
|
||||
|
||||
#from core import Input, Output, Filter
|
||||
from LoadTIFF import LoadTIFF
|
||||
from AttributeProfiles import AttributeProfiles as APs
|
||||
from SaveFig import SaveFig
|
||||
from Treshold import Treshold
|
||||
from ShowFig import ShowFig
|
||||
from ld2dap import LoadTIFF, SaveFig, Treshold, ShowFig
|
||||
from ld2dap import AttributeProfiles as APs
|
||||
|
||||
import numpy as np
|
||||
|
||||
def main():
|
||||
i = LoadTIFF(['../Data/test.tiff', '../Data/test.tiff'])
|
||||
i = LoadTIFF(['Data/test.tiff', 'Data/test2.tiff'])
|
||||
t = Treshold(1e4)
|
||||
ap = APs(np.array([100,1e3,1e4]))
|
||||
o = SaveFig('test.png')
|
Loading…
Reference in New Issue
Block a user