| 379 | // --------------------------------------------------------------------------- |
| 380 | |
| 381 | void InitMultiLabelSegmentation(py::module_& m) |
| 382 | { |
| 383 | // ======================================================================= |
| 384 | // mitk.DICOMCodeSequence |
| 385 | // ======================================================================= |
| 386 | py::class_<DICOMCodeSequence>(m, "DICOMCodeSequence", |
| 387 | R"(DICOM coded entry: a ``(value, scheme, meaning)`` triple. |
| 388 | |
| 389 | Used to identify standardized concepts in DICOM (anatomic regions, |
| 390 | segmented property types, ...). For example:: |
| 391 | |
| 392 | DICOMCodeSequence("T-A0095", "SRT", "Brain") |
| 393 | |
| 394 | Most MITK APIs that take a ``DICOMCodeSequence`` also accept a |
| 395 | ``(value, scheme, meaning)`` 3-tuple for convenience. |
| 396 | )") |
| 397 | .def(py::init<>(), |
| 398 | "Construct an empty coded entry.") |
| 399 | .def(py::init<const std::string&, const std::string&, const std::string&>(), |
| 400 | py::arg("value"), py::arg("scheme"), py::arg("meaning"), |
| 401 | R"(Construct a coded entry. |
| 402 | |
| 403 | Args: |
| 404 | value: Code value (e.g. ``"T-A0095"``). |
| 405 | scheme: Coding scheme designator (e.g. ``"SRT"``). |
| 406 | meaning: Human-readable meaning (e.g. ``"Brain"``). |
| 407 | )") |
| 408 | .def_property("value", &DICOMCodeSequence::GetValue, &DICOMCodeSequence::SetValue) |
| 409 | .def_property("scheme", &DICOMCodeSequence::GetScheme, &DICOMCodeSequence::SetScheme) |
| 410 | .def_property("meaning", &DICOMCodeSequence::GetMeaning, &DICOMCodeSequence::SetMeaning) |
| 411 | .def_property_readonly("is_empty", &DICOMCodeSequence::IsEmpty) |
| 412 | .def("__eq__", &DICOMCodeSequence::operator==, py::is_operator()) |
| 413 | .def("__ne__", &DICOMCodeSequence::operator!=, py::is_operator()) |
| 414 | .def("__repr__", [](const DICOMCodeSequence& c) { |
| 415 | std::ostringstream os; |
| 416 | os << "DICOMCodeSequence(value='" << c.GetValue() |
| 417 | << "', scheme='" << c.GetScheme() |
| 418 | << "', meaning='" << c.GetMeaning() << "')"; |
| 419 | return os.str(); |
| 420 | }); |
| 421 | |
| 422 | // ======================================================================= |
| 423 | // mitk.DICOMCodeSequenceWithModifiers |
| 424 | // ======================================================================= |
| 425 | py::class_<DICOMCodeSequenceWithModifiers, DICOMCodeSequence>(m, "DICOMCodeSequenceWithModifiers", |
| 426 | R"(:py:class:`DICOMCodeSequence` extended with optional modifier sequences. |
| 427 | |
| 428 | Used by DICOM constructs that allow further qualification of a coded |
| 429 | entry (for example "Liver" + modifier "Left lobe"). |
| 430 | )") |
| 431 | .def(py::init<>(), |
| 432 | "Construct an empty coded entry with no modifiers.") |
| 433 | .def(py::init<const std::string&, const std::string&, const std::string&>(), |
| 434 | py::arg("value"), py::arg("scheme"), py::arg("meaning"), |
| 435 | R"(Construct a coded entry without modifiers. |
| 436 | |
| 437 | Args: |
| 438 | value: Code value. |
no test coverage detected