slicing¶
tissue_simulator.slicing ¶
2D tissue slicing module for extracting planar sections through 3D tissue.
SliceCell
dataclass
¶
SliceCell(center_3d: ndarray, center_2d: ndarray, radius: float, cell_type: str, is_boundary: bool, distance_from_plane: float, intersection_radius: float)
Represents a cell captured in a 2D slice.
Attributes:
| Name | Type | Description |
|---|---|---|
center_3d |
ndarray
|
Original 3D center position |
center_2d |
ndarray
|
Position in 2D slice coordinates |
radius |
float
|
Cell radius |
cell_type |
str
|
Cell classification |
is_boundary |
bool
|
Whether cell was a boundary cell in 3D tissue |
distance_from_plane |
float
|
Perpendicular distance from slice plane |
intersection_radius |
float
|
Radius of circular intersection with plane |
TissueSlicer ¶
Handles 2D slicing operations on 3D tissue sections.
Initialize slicer with a tissue section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tissue
|
TissueSection
|
TissueSection object to slice |
required |
Source code in tissue_simulator/slicing.py
slice_plane ¶
slice_plane(point: Tuple[float, float, float] = None, normal: Tuple[float, float, float] = None, angle_x: float = 0.0, angle_y: float = 0.0, z_position: float = None) -> List[SliceCell]
Create a 2D slice through the tissue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
Tuple[float, float, float]
|
Point on the plane (default: center of tissue) |
None
|
normal
|
Tuple[float, float, float]
|
Normal vector to the plane (default: [0, 0, 1] for XY plane) |
None
|
angle_x
|
float
|
Rotation angle around X-axis in degrees (alternative to normal) |
0.0
|
angle_y
|
float
|
Rotation angle around Y-axis in degrees (alternative to normal) |
0.0
|
z_position
|
float
|
Z-position for horizontal slice (simplified interface) |
None
|
Returns:
| Type | Description |
|---|---|
List[SliceCell]
|
List of SliceCell objects intersecting the plane |
Source code in tissue_simulator/slicing.py
export_slice_csv ¶
Export slice data to CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Output CSV file path |
required |
include_3d
|
bool
|
Whether to include original 3D coordinates |
True
|
Source code in tissue_simulator/slicing.py
visualize_slice_2d ¶
Visualize the 2D slice showing cell cross-sections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_radii
|
bool
|
Whether to show cells as circles with intersection radii |
True
|
figsize
|
Tuple[int, int]
|
Figure size (width, height) |
(10, 10)
|
title
|
str
|
Plot title |
None
|
Source code in tissue_simulator/slicing.py
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 | |
visualize_slice_in_3d ¶
Visualize the slice plane within the 3D tissue context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_plane
|
bool
|
Whether to show the slice plane |
True
|
plane_alpha
|
float
|
Transparency of the slice plane |
0.3
|
plane_size
|
float
|
Size of plane to display (default: tissue dimensions) |
None
|
Source code in tissue_simulator/slicing.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
get_slice_statistics ¶
Calculate statistics about the slice.
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with slice statistics |
Source code in tissue_simulator/slicing.py
create_standard_slices ¶
Create multiple parallel slices through the tissue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tissue
|
TissueSection
|
TissueSection to slice |
required |
num_slices
|
int
|
Number of evenly-spaced slices |
5
|
Returns:
| Type | Description |
|---|---|
List[TissueSlicer]
|
List of TissueSlicer objects with computed slices |