stacklp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
stacklp-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.3
2
+ Name: stacklp
3
+ Version: 0.1.0
4
+ Summary: This library contains various functions to manage stack of images.
5
+ Requires-Dist: arrlp
6
+ Requires-Dist: corelp
7
+ Requires-Dist: numpy
8
+ Requires-Dist: tifffile
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+
12
+ # stackLP
13
+
14
+ ```text
15
+ Author : Lancelot PINCET
16
+ GitHub : https://github.com/LancelotPincet/stackLP
17
+ HTTPS : https://github.com/LancelotPincet/stackLP.git
18
+ SSH : git@github.com:LancelotPincet/stackLP.git
19
+ PyPI : https://pypi.org/project/stackLP
20
+ Docs : https://stackLP.readthedocs.io
21
+ ```
22
+
23
+ **This library contains various functions to manage stack of images.**
24
+
25
+ stackLP is available on [PyPI](https://pypi.org/project/stackLP) for pip installs.
26
+ For more information, do not hesitate to consult the [Documentation](https://stackLP.readthedocs.io).
27
+
28
+ ---
29
+
30
+ ## MIT License
31
+
32
+ <details>
33
+ <summary>details</summary>
34
+
35
+ Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
36
+
37
+ The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
38
+
39
+ The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
40
+
41
+ </details>
@@ -0,0 +1,30 @@
1
+ # stackLP
2
+
3
+ ```text
4
+ Author : Lancelot PINCET
5
+ GitHub : https://github.com/LancelotPincet/stackLP
6
+ HTTPS : https://github.com/LancelotPincet/stackLP.git
7
+ SSH : git@github.com:LancelotPincet/stackLP.git
8
+ PyPI : https://pypi.org/project/stackLP
9
+ Docs : https://stackLP.readthedocs.io
10
+ ```
11
+
12
+ **This library contains various functions to manage stack of images.**
13
+
14
+ stackLP is available on [PyPI](https://pypi.org/project/stackLP) for pip installs.
15
+ For more information, do not hesitate to consult the [Documentation](https://stackLP.readthedocs.io).
16
+
17
+ ---
18
+
19
+ ## MIT License
20
+
21
+ <details>
22
+ <summary>details</summary>
23
+
24
+ Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
25
+
26
+ The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
27
+
28
+ The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
29
+
30
+ </details>
@@ -0,0 +1,25 @@
1
+ [project]
2
+ name = "stacklp"
3
+ version = "0.1.0"
4
+ description = "This library contains various functions to manage stack of images."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [ "arrlp", "corelp", "numpy", "tifffile",]
8
+
9
+ [build-system]
10
+ requires = [ "uv_build",]
11
+ build-backend = "uv_build"
12
+
13
+ [dependency-groups]
14
+ tests = [ "pytest",]
15
+ docs = [ "sphinx", "sphinx-design", "sphinx-rtd-theme", "toml",]
16
+ anaconda = [ "ipykernel", "spyder-kernels",]
17
+
18
+ [tool.uv]
19
+ required-environments = [ "sys_platform == 'linux' and platform_machine == 'x86_64'", "sys_platform == 'win32' and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",]
20
+
21
+ [tool.uv.sources.arrlp]
22
+ workspace = true
23
+
24
+ [tool.uv.sources.corelp]
25
+ workspace = true
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-02-10
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : stackLP
7
+
8
+ """
9
+ This library contains various functions to manage stack of images.
10
+ """
11
+
12
+
13
+
14
+ # %% Source import
15
+ sources = {
16
+ 'appendtif': 'stacklp.modules.appendtif_LP.appendtif',
17
+ 'remove_bleach': 'stacklp.modules.remove_bleach_LP.remove_bleach'
18
+ }
19
+
20
+
21
+
22
+ # %% Lazy imports
23
+ from corelp import getmodule
24
+ __getattr__, __all__ = getmodule(sources)
File without changes
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Author : Lancelot PINCET
4
+ # GitHub : https://github.com/LancelotPincet
5
+
6
+
7
+
8
+ # %% Libraries
9
+
10
+
11
+
12
+
13
+ # %% Function
14
+ def temp(**kwargs) :
15
+ '''
16
+ TODO
17
+ '''
18
+
19
+ print('Hello world!')
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-02-10
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : stackLP
7
+ # Module : appendtif
8
+
9
+ """
10
+ This function appends a stack to a tif file.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ import tifffile as tiff
17
+ import os
18
+ from pathlib import Path
19
+
20
+
21
+
22
+ # %% Function
23
+ def appendtif(tif:str, stack, *, photometric='minisblack', flush=False) :
24
+ '''
25
+ This function appends a stack to a tif file.
26
+
27
+ Parameters
28
+ ----------
29
+ tif : str or tiff.TiffWriter
30
+ path to file or TiffWritter of preopened file.
31
+ stack : array
32
+ image stack to add to tiff file
33
+ photometric : str
34
+ image mode ['minisblack', 'miniswhite', 'rgb']
35
+ flush : str
36
+ True to flush buffered data to disk when using TiffWritter
37
+
38
+ Examples
39
+ --------
40
+ >>> from stacklp import appendtif
41
+ ...
42
+ >>> appendtif() # TODO
43
+ '''
44
+
45
+ if isinstance(tif, str) or isinstance(tif, type(Path(''))) :
46
+ with tiff.TiffWriter(Path(tif), bigtiff=True, append=True) as tif :
47
+ return appendtif(tif, stack, photometric=photometric, flush=flush)
48
+ else :
49
+ tif.write(stack, photometric=photometric, metadata=None, contiguous=False)
50
+ if flush :
51
+ fd = tif._fh.fileno()
52
+ os.fsync(fd) # Force OS to write buffered data to disk
53
+
54
+
55
+
56
+ # %% Test function run
57
+ if __name__ == "__main__":
58
+ from corelp import test
59
+ test(__file__)
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-02-10
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : template_[library]
7
+ # Module : appendtif
8
+
9
+ """
10
+ This file allows to test appendtif
11
+
12
+ appendtif : This function appends a stack to a tif file.
13
+ """
14
+
15
+
16
+
17
+ # %% Libraries
18
+ from corelp import print, debug
19
+ import pytest
20
+ from template_[lowerlib] import appendtif
21
+ debug_folder = debug(__file__)
22
+
23
+
24
+
25
+ # %% Function test
26
+ def test_function() :
27
+ '''
28
+ Test appendtif function
29
+ '''
30
+ print('Hello world!')
31
+
32
+
33
+
34
+ # %% Instance fixture
35
+ @pytest.fixture()
36
+ def instance() :
37
+ '''
38
+ Create a new instance at each test function
39
+ '''
40
+ return appendtif()
41
+
42
+ def test_instance(instance) :
43
+ '''
44
+ Test on fixture
45
+ '''
46
+ pass
47
+
48
+
49
+ # %% Returns test
50
+ @pytest.mark.parametrize("args, kwargs, expected, message", [
51
+ #([], {}, None, ""),
52
+ ([], {}, None, ""),
53
+ ])
54
+ def test_returns(args, kwargs, expected, message) :
55
+ '''
56
+ Test appendtif return values
57
+ '''
58
+ assert appendtif(*args, **kwargs) == expected, message
59
+
60
+
61
+
62
+ # %% Error test
63
+ @pytest.mark.parametrize("args, kwargs, error, error_message", [
64
+ #([], {}, None, ""),
65
+ ([], {}, None, ""),
66
+ ])
67
+ def test_errors(args, kwargs, error, error_message) :
68
+ '''
69
+ Test appendtif error values
70
+ '''
71
+ with pytest.raises(error, match=error_message) :
72
+ appendtif(*args, **kwargs)
73
+
74
+
75
+
76
+ # %% Test function run
77
+ if __name__ == "__main__":
78
+ from corelp import test
79
+ test(__file__)
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Author : Lancelot PINCET
4
+ # GitHub : https://github.com/LancelotPincet
5
+
6
+
7
+
8
+ # %% Libraries
9
+
10
+
11
+
12
+
13
+ # %% Function
14
+ def temp(**kwargs) :
15
+ '''
16
+ TODO
17
+ '''
18
+
19
+ print('Hello world!')
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-02-10
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : stackLP
7
+ # Module : remove_bleach
8
+
9
+ """
10
+ This function normalizes frames to avoid bleaching effects in time.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ from arrlp import img_correlate, xp
17
+
18
+
19
+
20
+ # %% Function
21
+ def remove_bleach(stack, *, out=None, window=10, cuda=False, parallel=False, print=None) :
22
+ '''
23
+ This function normalizes frames to avoid bleaching effects in time.
24
+
25
+ Parameters
26
+ ----------
27
+ stack : array
28
+ stack to correct.
29
+ out : array
30
+ stack to return.
31
+ window : int
32
+ percent of image to define kernel.
33
+ cuda : bool
34
+ True to apply cuda.
35
+ parallel : bool
36
+ True to apply parallel.
37
+ print : object
38
+ print object to print status.
39
+
40
+ Returns
41
+ -------
42
+ nobleach : array
43
+ stack copy without bleach.
44
+
45
+ Examples
46
+ --------
47
+ >>> from stacklp import remove_bleach
48
+ ...
49
+ >>> remove_bleach(stack, window=10)
50
+ '''
51
+
52
+ y, x = stack.shape[1], stack.shape[2]
53
+ channels = stack.ndim == 4
54
+ _xp = xp(cuda)
55
+ stack = _xp.asarray(stack)
56
+
57
+ # Correlation
58
+ if print is not None : print('Applying correlations to remove bleach:')
59
+ window = min(int(y * window / 100), int(x * window / 100))
60
+ out = img_correlate(stack, window=window, cuda=cuda, parallel=parallel, stacks=True, channels=channels, out=out, print=print)
61
+ if print is not None : print('Done correlations.')
62
+
63
+ # Normalizing
64
+ if print is not None : print('Normalizing...')
65
+ slice_mean = out.mean(axis=0)
66
+ for pos in range(len(stack)) :
67
+ out[pos] = stack[pos] / out[pos] * slice_mean
68
+ if print is not None : print('Done normalizing.')
69
+
70
+ return out
71
+
72
+
73
+
74
+ # %% Test function run
75
+ if __name__ == "__main__":
76
+ from corelp import test
77
+ test(__file__)
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2026-02-10
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : template_[library]
7
+ # Module : remove_bleach
8
+
9
+ """
10
+ This file allows to test remove_bleach
11
+
12
+ remove_bleach : This function normalizes frames to avoid bleaching effects in time.
13
+ """
14
+
15
+
16
+
17
+ # %% Libraries
18
+ from corelp import print, debug
19
+ import pytest
20
+ from template_[lowerlib] import remove_bleach
21
+ debug_folder = debug(__file__)
22
+
23
+
24
+
25
+ # %% Function test
26
+ def test_function() :
27
+ '''
28
+ Test remove_bleach function
29
+ '''
30
+ print('Hello world!')
31
+
32
+
33
+
34
+ # %% Instance fixture
35
+ @pytest.fixture()
36
+ def instance() :
37
+ '''
38
+ Create a new instance at each test function
39
+ '''
40
+ return remove_bleach()
41
+
42
+ def test_instance(instance) :
43
+ '''
44
+ Test on fixture
45
+ '''
46
+ pass
47
+
48
+
49
+ # %% Returns test
50
+ @pytest.mark.parametrize("args, kwargs, expected, message", [
51
+ #([], {}, None, ""),
52
+ ([], {}, None, ""),
53
+ ])
54
+ def test_returns(args, kwargs, expected, message) :
55
+ '''
56
+ Test remove_bleach return values
57
+ '''
58
+ assert remove_bleach(*args, **kwargs) == expected, message
59
+
60
+
61
+
62
+ # %% Error test
63
+ @pytest.mark.parametrize("args, kwargs, error, error_message", [
64
+ #([], {}, None, ""),
65
+ ([], {}, None, ""),
66
+ ])
67
+ def test_errors(args, kwargs, error, error_message) :
68
+ '''
69
+ Test remove_bleach error values
70
+ '''
71
+ with pytest.raises(error, match=error_message) :
72
+ remove_bleach(*args, **kwargs)
73
+
74
+
75
+
76
+ # %% Test function run
77
+ if __name__ == "__main__":
78
+ from corelp import test
79
+ test(__file__)
File without changes
File without changes