afmslicer.classes
¶
Classes for the AFMSlicer package.
AFMSlicer
¶
Bases: TopoStats
Class for AFMSlicer data and attributes.
The class inherits TopoStats class and has all of its attributes such as image, image_original,
filename and pixel_to_nm_scaling which are used (as well as others which are not used such as
grain_crops).
Attributes:
| Name | Type | Description |
|---|---|---|
image |
NDArray[float64]
|
Two-dimensional array of heights after filtering/flattening. |
image_original |
NDArray[float64]
|
Two-dimensional array of original heights. |
filename |
str
|
Image filename. |
pixel_to_nm_scaling |
float
|
Pixel to nano-metre scaling factor. |
layers |
(NDArray[float64], optional)
|
The boundaries of heights for sliced layers to be taken through the original image. |
sliced_array |
(NDArray[float64], optional)
|
Three dimensional array of |
sliced_mask |
(NDArray[bool], optional)
|
A three dimensional array of |
sliced_segments |
NDArray[int32]
|
A three dimensional array of |
sliced_segments_clean |
NDArray[int32]
|
A three dimensional array of |
sliced_region_properties |
list[list[Any]]
|
A list of |
segment_method |
(str, optional)
|
Method for segmenting individual layers. |
min_height |
(float, optional)
|
Minimum height. Determined from the data if not provided. |
max_height |
(float, optional)
|
Maximum height. Determined from the data if not provided. |
slices |
(int, optional)
|
The number of slices taken through the image between the |
full_width_half_max |
tuple[int, int]
|
The lower and upper bound of the Full Width Half Max from the distribution of the number of pores per layer. Used to select the layers whose areas are of interest and are plotted. |
fig_objects_per_layer |
(tuple[Figure, Axes], optional)
|
Matplotlib figure and axes objects from plotting the layer vs the number of objects. |
fig_log_objects_per_layer |
(tuple[Figure, Axes], optional)
|
Matplotlib figure and axes objects from plotting the layer vs the log number of objects. |
fig_area_per_layer |
(tuple[Figure, Axes], optional)
|
Matplotlib figure and axes objects from plotting the layer vs the total area of objects. |
fig_log_area_per_layer |
(tuple[Figure, Axes], optional)
|
Matplotlib figure and axes objects from plotting the layer vs the log of the total area of objects. |
area_by_layer |
(list[list[float]], optional)
|
List of the area of each object within a given layer. |
cumulative_area_by_layer |
(DataFrame, optional)
|
List of pandas dataframes of the sorted area, cumulative sum and cumulative fraction. |
hcfa |
(DataFrame, optional)
|
Pandas dataframes of the Half Cumulative Fraction of the total Area for each layer. |
centroid_by_layer |
(list[list[tuple[float, float]]], optional)
|
List of the centroid (as a tuple) of each object within a given layer. |
feret_maximum_by_layer |
(list[list[float]], optional)
|
List of the maximum feret distance of each object within a given layer. |
statistics |
DataFrame
|
Data frame of statistics about each pore on each layer. At a bare minimum it will contain the |
Source code in src/afmslicer/classes.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
__post_init__()
¶
Set attributes for the AFMSlice class on instantiation.
Source code in src/afmslicer/classes.py
slice_image()
¶
Slice the image.
Source code in src/afmslicer/classes.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
update_heights()
¶
Update minimum and maximum height attributes.
Initially heights are taken from the raw image stored in AFMSlicer.image_original. Flattening with
Filters changes the range of these values so we need to update the heights.