cabana 1.0.1__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.
cabana-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Gavin Lin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cabana-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.2
2
+ Name: cabana
3
+ Version: 1.0.1
4
+ Summary: Collagen fibre analyser for quantifying collagen fibre architecture in IHC and fluorescence microscopy images.
5
+ Home-page: https://github.com/lxfhfut/cabana.git
6
+ Author: Gavin Lin
7
+ Author-email: x.lin@garvan.org.au
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: brotli
14
+ Requires-Dist: colorlog
15
+ Requires-Dist: imutils
16
+ Requires-Dist: jaraco.collections
17
+ Requires-Dist: jax-metal
18
+ Requires-Dist: mouseinfo
19
+ Requires-Dist: napari
20
+ Requires-Dist: notebook
21
+ Requires-Dist: numba
22
+ Requires-Dist: ome-types
23
+ Requires-Dist: opencv-python
24
+ Requires-Dist: pip-chill
25
+ Requires-Dist: pyconify
26
+ Requires-Dist: pygetwindow
27
+ Requires-Dist: pymsgbox
28
+ Requires-Dist: pyobjc
29
+ Requires-Dist: pyopengl-accelerate
30
+ Requires-Dist: pyqt5
31
+ Requires-Dist: pyscreeze
32
+ Requires-Dist: pytweening
33
+ Requires-Dist: ridge-detector
34
+ Requires-Dist: scikit-learn
35
+ Requires-Dist: seaborn
36
+ Requires-Dist: seaborn-image
37
+ Requires-Dist: streamlit
38
+ Requires-Dist: torchaudio
39
+ Requires-Dist: torchvision
40
+ Requires-Dist: twine
41
+ Requires-Dist: unicodedata2
42
+ Requires-Dist: zarr
43
+ Dynamic: author
44
+ Dynamic: author-email
45
+ Dynamic: classifier
46
+ Dynamic: description
47
+ Dynamic: description-content-type
48
+ Dynamic: home-page
49
+ Dynamic: requires-dist
50
+ Dynamic: summary
51
+
52
+ ## Instructions
53
+
54
+ This program is developed for analyzing the microscopic images of collagen fibre. Please follow the below instructions to run the program:
55
+
56
+ [//]: # (1. When running the program for the first time, launch "Anaconda Prompt" (move the mouse to the Windows Icon (lower left), type "Anaconda" and select "Anaconda Prompt". A command window named "Anaconda Prompt" will show up) and execute the "conda init" in the command window.)
57
+
58
+ [//]: # (2. Copy the "TWOMBLI" folder located in "C:\Program Files\Cabana\" to your personal user directory, such as "C:\Users\your_user_name\Documents", so that you will have your own copy of TWOMBLI and associated parameter files, which you can modify freely.)
59
+
60
+ [//]: # (3. There are 3 folders inside "TWOMBLI": 'Programs' folder containing 'Twombli_v4.ijm' and 3 parameter files, 'Input' folder used for storing images to be analyzed, and 'Output' folder used for storing analysis results.)
61
+
62
+ [//]: # (4. Copy the "Cabana" shortcut located in "C:\Program Files\Cabana" to your desktop and launch the program by double-clicking the icon. Once launched, it will sequentially ask for the locations of the 'Programs', 'Input', and 'Output' and the analysis will commence. The output of the analysis will be stored in subfolders within the 'Output' folder:)
63
+
64
+ [//]: # ()
65
+ [//]: # ( * **Eligible**: stores the images to be analyzed after the removal over-sized images. The 'Ignored_images.txt' file inside this subfolder recordes the names of the over-sized images that have been ignored.)
66
+
67
+ [//]: # ( * **Bins**: stores the binary masks resulted from RoI extraction. The RoI regions are highlighted in white while backgrounds are highlighted in black.)
68
+
69
+ [//]: # ( * **ROIs**: stores the extracted RoIs.)
70
+
71
+ [//]: # ( * **Masks**: this subfolder stores the results of ridge detection, anamorf, and gap analysis (in the 'GapAnalysis' folder). )
72
+
73
+ [//]: # ( * **Masks/GapAnalysis**: this subfolder stores the gap analysis outcomes, comprising two output images for each image. One image features red circles, visualizing all gaps, irrespective of whether they occur between collagen fibers. The other image shows green circles depicting gaps within collagen fiber areas. )
74
+
75
+ [//]: # ( )
76
+ [//]: # ( * **Ridges**: stores the visualization results of ridge detection in comparison to the original image.)
77
+
78
+ [//]: # ( * **Roads**: stores the ridge detection results with estimated width.)
79
+
80
+ [//]: # ( * **HDM**: stores the high density matrix areas generated by Twombli.)
81
+
82
+ [//]: # ( * **Twombli\_Results\_Final.csv**: contains all the resultant image statistics. )
83
+
84
+ [//]: # ( )
85
+ [//]: # ( )
86
+ [//]: # (## Parameter Settings)
87
+
88
+ [//]: # ()
89
+ [//]: # (It consists of two main components sequentially applied to the image:)
90
+
91
+ [//]: # ()
92
+ [//]: # (1. **Region of Interest (RoI) extraction**. This component aims to extract the collagen fibre areas in an image from cluttered background based on color and other low-level features. It relies on a self-supervised semantic segmenter based on convolutional neural networks to group semantically similar neighboring pixels. The mean color of the pixels in the same segment will be compared with a user-specified threshold to determine whether the segment is the region of interest. Its parameters can be specified in 'SegmenterParameters.txt':)
93
+
94
+ [//]: # ()
95
+ [//]: # ( - **Number of Labels**: the number of labels for semantic segmentation. It controls the level of granularity of segmentation. A higher number of labels will more likely result in segments of smaller size. The default value is 48.)
96
+
97
+ [//]: # ()
98
+ [//]: # ( - **Max Iterations**: the maximal number of iterations for semantic segmentation. This value should be large encough to generate reliable segmentation results but not too high to group all pixels into a single segment. The default value is 30.)
99
+
100
+ [//]: # ( )
101
+ [//]: # ( - **Normalized Hue Value**: the normalized hue value in [0,1] for the color of interest in HSB/HSV color space. The typical hue values for green, blue, and red color are 0.33, 0.66, and 1.0, respectively.)
102
+
103
+ [//]: # ( )
104
+ [//]: # ( - **Color Threshold**: color threshold used to determine RoI. Only segments with a mean color greater than this threshold will be extracted as RoI. The default value is 0.2.)
105
+
106
+ [//]: # ( )
107
+ [//]: # ( - **Min Size**: the minimal size of segments. Any segment with a size smaller than this parameter will be ignored. The default value is 64.)
108
+
109
+ [//]: # ( )
110
+ [//]: # ( - **Max Size**: the maximum allowable image size. Any image with a size larger than the *square* of this parameter will be ignored by the program. The default value is 2048.)
111
+
112
+ [//]: # ( )
113
+ [//]: # ( - **Mode**: Three modes are supported. "segmentation": only segmentation is performed, "twombli": image analysis is applied to the original image (not regions of interests output by segmentation), and "both": image analysis is applied to the region of interest, i.e. both segmentation and twombli will be executed.)
114
+
115
+ [//]: # ( )
116
+ [//]: # (2. **Twombli**. This component aims for image quantification using Fiji plugins including [*Ridge Detection*](https://imagej.net/plugins/ridge-detection), *[Anamorf](https://github.com/djpbarry/AnaMorf/wiki)*, and optional *[Gap Analysis](https://imagej.net/plugins/max-inscribed-circles)*. The parameters of Anamorf can be specified in 'AnamorfProperties.xml', while those of Ridge Detection and the optional gap analysis can be specified in 'TwombliParameters.txt'. Please refer to this [doc](https://github.com/wershofe/TWOMBLI/blob/master/TWOMBLI_v1/TwombliDocumentation.docx) for more details about parameter settings. Special attention is required for the following parameters:)
117
+
118
+ [//]: # ()
119
+ [//]: # ( * **Dark Line**: a boolean value. If it is specified as 0 (false), the program assumes that fibres are light on a dark background. Otherwise, the program assumes that matrix fibres are dark on a light background.)
120
+
121
+ [//]: # ( * **Contrast Saturation**: a value in [0,1] shows the percent of pixels that will be saturated for constrast enhancement.)
122
+
123
+ [//]: # ( * **Min Line Width $\omega_{min}$**: the minimum ridge/line width in pixels that the ridge detection algorithm can detect. The line width ($\omega$) is used to estimate the 'Sigma' ($\sigma$) parameter of Gaussian filtering kernel: $\sigma=\frac{\omega}{2\sqrt{3}} +0.5$.)
124
+
125
+ [//]: # ( * **Max Line Width $\omega_{max}$**: the maximum ridge/line width in pixels that the ridege detection algorithm can detect. Twombli runs ridge detection repeatedly with every value in $[\omega_{min}, \omega_{max}]$ and takes the union of the detected ridges. **Setting a large line width (e.g., >15) gives rise to the chance of getting 'straight line artefacts', which are caused by the small (close to zero) upper threshold of filtering response.**)
126
+
127
+ [//]: # ( * **Line Width Step**: This parameter controls the sampling factor for line widths in [$\omega_{min}$, $\omega_{max}$]. It allows for increasing line width with a step larger than 1. For instance, if you want to detect ridges with multiple line widths 5, 7, and 9, you can specify line width step to 2 for $\omega_{min}=7$, $\omega_{max}=9$. The default value is 1, which means all line widths in [$\omega_{min}$, $\omega_{max}$] will be used for ridge detection.)
128
+
129
+ [//]: # ( * **Low Constrast $b_{l}$**: the lowest grayscale value of the line. This parameter is used to estimate the lower threshold ($T_L$) for filtering response: $T_L = \frac{0.17\omega b_l}{\sqrt{2\pi}\sigma^3}e^{-\frac{\omega^2}{8\sigma^2}}$. Line points with a response smaller as $T_L$ are rejected.)
130
+
131
+ [//]: # ( * **High Constrast $b_{u}$**: the highest grayscale value of the line. This parameter is used to estimate the upper threshold ($T_U$) for filtering response: $T_U = \frac{0.17\omega b_u}{\sqrt{2\pi}\sigma^3}e^{-\frac{\omega^2}{8\sigma^2}}$. Line points with a response larger as $T_U$ are accepted. Note that if Dark Line is set to 1 (true), $b_u$ and $b_l$ will be calculated as $255-b_l$ and $255-b_u$, respectively.)
132
+
133
+ [//]: # ( * **Min/Max Curvature Window**: Towmbli quantifies the curvature of ridges/lines in curvature windows bounded by the minimum and maximum curvature windows with a step of 10.)
134
+
135
+ [//]: # ( * **Minimum Branch Length**: Any line/ridge with a lenght smaller than this value are ignored.)
136
+
137
+ [//]: # ( * **Minimum Gap Diameter**: the minimal gap diameter for gap analysis. *If it is specified a value no greater than 0, no gap analysis will be performed*.)
@@ -0,0 +1,4 @@
1
+ name = "cabana"
2
+
3
+ from .batch_processor import BatchProcessor
4
+ from .cabana import Cabana
@@ -0,0 +1,21 @@
1
+ from PyQt5.QtWidgets import QApplication
2
+ from PyQt5.QtGui import QIcon
3
+ from PyQt5.QtCore import Qt
4
+ import sys
5
+ from pathlib import Path
6
+ from .cabana_gui import MainWindow
7
+
8
+ def main():
9
+ # Enable High DPI display before creating QApplication
10
+ QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
11
+ QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
12
+
13
+ app = QApplication(sys.argv)
14
+ window = MainWindow()
15
+ icon_path = Path(__file__).parent.parent / "cabana-logo.ico"
16
+ app.setWindowIcon(QIcon(str(icon_path)))
17
+ window.show()
18
+ sys.exit(app.exec_())
19
+
20
+ if __name__ == "__main__":
21
+ main()