Interlacer
Interlacer
dataclass
#
Interlacer(
crawl_index: str | pathlib.Path | pandas.DataFrame,
)
Builds and queries a forest of SeriesNode objects from DICOM series data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str | pathlib.Path | pandas.DataFrame
|
Path to the CSV file or DataFrame containing the series data |
required |
Attributes:
Name | Type | Description |
---|---|---|
crawl_df |
pandas.DataFrame
|
DataFrame containing the data loaded from the CSV file or passed in |
series_nodes |
dict[str, imgtools.dicom.interlacer.SeriesNode]
|
Maps SeriesInstanceUID to SeriesNode objects |
root_nodes |
list[imgtools.dicom.interlacer.SeriesNode]
|
List of root nodes in the forest |
Methods:
Name | Description |
---|---|
print_tree |
Print a representation of the forest. |
query |
Query the forest for specific modalities. |
query_all |
Simply return ALL possible matches |
visualize_forest |
Visualize the forest as an interactive network graph. |
print_tree
#
query
#
query(
query_string: str, group_by_root: bool = True
) -> list[list[imgtools.dicom.interlacer.SeriesNode]]
Query the forest for specific modalities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Comma-separated string of modalities to query (e.g., 'CT,MR') |
required |
|
bool
|
If True, group the returned SeriesNodes by their root CT/MR/PT node (i.e., avoid duplicate root nodes across results). |
True
|
Returns:
Type | Description |
---|---|
list[list[dict[str, str]]]
|
List of matched series groups where each series is represented by a dict containing 'Series' and 'Modality' keys |
Notes
Supported modalities: - CT: Computed Tomography - PT: Positron Emission Tomography - MR: Magnetic Resonance Imaging - SEG: Segmentation - RTSTRUCT: Radiotherapy Structure - RTDOSE: Radiotherapy Dose
Source code in src/imgtools/dicom/interlacer.py
query_all
#
query_all() -> (
list[list[imgtools.dicom.interlacer.SeriesNode]]
)
Simply return ALL possible matches Note this has a different approach than query, since we dont care about the order of the modalities, just that they exist in the Branch
Source code in src/imgtools/dicom/interlacer.py
visualize_forest
#
visualize_forest(
save_path: str | pathlib.Path,
) -> pathlib.Path
Visualize the forest as an interactive network graph.
Creates an HTML visualization showing nodes for each SeriesNode and edges for parent-child relationships.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str | pathlib.Path
|
Path to save the HTML visualization. |
required |
Returns:
Type | Description |
---|---|
pathlib.Path
|
Path to the saved HTML visualization |
Source code in src/imgtools/dicom/interlacer.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
|