plastimatch
Loading...
Searching...
No Matches
segmentation.h
Go to the documentation of this file.
1/* -----------------------------------------------------------------------
2 See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
3 ----------------------------------------------------------------------- */
4#ifndef _segmentation_h_
5#define _segmentation_h_
6
7#include "plmbase_config.h"
8
9#include "itk_image_type.h"
10#include "metadata.h"
11#include "rtss.h"
12#include "xform.h"
13#include "xio_studyset.h" /* enum Xio_version */
14
15class Plm_image;
17class Rt_study;
18class Segmentation_private;
19class Rtss_roi;
21class Warp_parms;
22
24public:
26public:
27 Segmentation_private *d_ptr;
28
29public:
30 Segmentation ();
32
33 void clear ();
34 void load (const char *ss_img, const char *ss_list);
35 void load_cxt (const std::string& input_fn, Rt_study_metadata *rsm);
36 void load_prefix (const char *prefix_dir);
37 void load_prefix (const std::string& prefix_dir);
38 void load_xio (const Xio_studyset& xio_studyset);
39 static bool valid_extension (const char *filename);
40
41 size_t get_num_structures ();
42
43 std::string get_structure_name (size_t index);
44 void set_structure_name (size_t index, const std::string& name);
45
46 UCharImageType::Pointer get_structure_image (int index);
47
48 void save_colormap (const std::string& colormap_fn);
49 void save_cxt (const Rt_study_metadata::Pointer& rsm,
50 const std::string& cxt_fn, bool prune_empty);
51 void save_fcsv (const Rtss_roi *curr_structure, const std::string& fn);
52 void save_prefix_fcsv (const std::string& output_prefix);
53 void save_ss_image (const std::string& ss_img_fn);
54 void save_labelmap (const std::string& labelmap_fn);
55 void save_opt4d (const std::string& output_prefix);
56 void save_prefix (const std::string& output_prefix,
57 const std::string& extension = "mha");
58 void save_prefix (const char *output_prefix);
59 void save_ss_list (const std::string& ss_list_fn);
60 void save_xio (
62 Xio_ct_transform *xio_transform, Xio_version xio_version,
63 const std::string& output_dir);
64 UInt32ImageType::Pointer get_ss_img_uint32 (void);
65 UCharVecImageType::Pointer get_ss_img_uchar_vec (void);
66
67 void apply_dicom_dir (const Rt_study_metadata::Pointer& rsm);
68 void convert_ss_img_to_cxt (void);
69 void convert_to_uchar_vec (void);
70 void cxt_extract (void);
71 void cxt_re_extract (void);
72 void prune_empty (void);
73 void keyholize ();
74 void rasterize (Plm_image_header *pih, bool want_labelmap,
75 bool xor_overlapping);
76 void set_geometry (const Plm_image_header *pih);
77 void find_rasterization_geometry (Plm_image_header *pih);
78 Segmentation::Pointer warp_nondestructive (
79 const Xform::Pointer& xf, Plm_image_header *pih,
80 bool use_itk = false) const;
81 void warp (const Xform::Pointer& xf, Plm_image_header *pih,
82 bool use_itk = false);
83 void warp (const Xform::Pointer& xf, Plm_image_header *pih,
84 Warp_parms *parms);
85
86 void add_structure (
87 UCharImageType::Pointer itk_image,
88 const char *structure_name = 0,
89 const char *structure_color = 0);
90 Rtss_roi* add_rtss_roi (
91 const char *structure_name = 0,
92 const char *structure_color = 0);
93
94 bool have_ss_img ();
95 void set_ss_img (UCharImageType::Pointer ss_img);
96 Plm_image::Pointer get_ss_img ();
97
98 bool have_structure_set ();
99 Rtss::Pointer& get_structure_set ();
100 Rtss* get_structure_set_raw ();
101 void set_structure_set (Rtss::Pointer& rtss_ss);
102 void set_structure_set (Rtss *rtss_ss);
103
104 void set_structure_image (
105 UCharImageType::Pointer uchar_img,
106 unsigned int bit
107 );
108
109 void resample (float spacing[3]);
110
111protected:
112 void initialize_ss_image (
113 const Plm_image_header& pih, int vector_length);
114 void broaden_ss_image (
115 int new_vector_length);
116
117};
118
119#endif
The Plm_image_header class defines the geometry of an image. It defines image origin,...
Definition plm_image_header.h:24
The Plm_image class represents a three-dimensional volume. The volume is an abstraction that can co...
Definition plm_image.h:27
std::shared_ptr< Self > Pointer
Definition plm_image.h:29
The Rt_study_metadata encapsulate DICOM metadata for an Rt_study. The Rt_study_metadata includes sepa...
Definition rt_study_metadata.h:27
std::shared_ptr< Self > Pointer
Definition rt_study_metadata.h:29
The Rt_study class encapsulates the concept of a radiotherapy planning data set, including image,...
Definition rt_study.h:28
Definition rtss_roi.h:12
The Rtss class represents a set of segmentations in polyline format, analogous to the DICOM-RT RTSTRU...
Definition rtss.h:25
std::shared_ptr< Self > Pointer
Definition rtss.h:27
Definition segmentation.h:23
std::shared_ptr< Self > Pointer
Definition segmentation.h:25
Segmentation_private * d_ptr
Definition segmentation.h:27
Definition warp_parms.h:14
Definition xio_ct_transform.h:13
Definition xio_studyset.h:38
void cxt_extract(Rtss *cxt, T image, int num_structs, bool check_cxt_bits)
Definition cxt_extract.cxx:151
#define PLMBASE_API
Definition plmbase_config.h:19
#define SMART_POINTER_SUPPORT(T)
Definition smart_pointer.h:19
Xio_version
Definition xio_studyset.h:11