Skip to content

Commit 362bb13

Browse files
committed
fix(dicom): do not output to stdout with write-rt-struct
1 parent 67ccfb1 commit 362bb13

File tree

5 files changed

+392
-50
lines changed

5 files changed

+392
-50
lines changed

packages/dicom/dcmtk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ if (EMSCRIPTEN OR WASI)
225225
endif()
226226
set(PLM_GIT_REPOSITORY "https://github.com/InsightSoftwareConsortium/plastimatch")
227227
# plastimatch-2024-10-30-5036f97-itk-wasm-2025-02-03
228-
set(PLM_GIT_TAG "a8e899092d52f6c7146592730c5dcd8e9331200b")
228+
set(PLM_GIT_TAG "babc354f210ba86a91cb6def718b45583c604e74")
229229
option(PLM_CONFIG_ENABLE_DCMTK "Enable DCMTK support" ON)
230230
option(PLM_CONFIG_ENABLE_OPENMP "Enable OpenMP support" OFF)
231231
option(PLM_CONFIG_ENABLE_OPENCL "Enable OpenCL support" OFF)

packages/dicom/dcmtk/itk_wasm_rt_study.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Itk_wasm_rt_study::~Itk_wasm_rt_study ()
2929
}
3030

3131
void
32-
Itk_wasm_rt_study::save_rtss (const char* fname, const ItkWasmRtStudyMetadata& metadata)
32+
Itk_wasm_rt_study::save_rtss (const char* fname, const ItkWasmRtStudyMetadata& metadata, bool quiet)
3333
{
3434
// Modified:
3535
// rt_study.cxx Rt_study::save_dicom
@@ -53,7 +53,7 @@ Itk_wasm_rt_study::save_rtss (const char* fname, const ItkWasmRtStudyMetadata& m
5353
logic should be improved to better keep track of
5454
when structure names are valid to avoid this. */
5555
this->d_ptr->m_seg->prune_empty ();
56-
this->d_ptr->m_seg->keyholize ();
56+
this->d_ptr->m_seg->keyholize (quiet);
5757
drs.set_rtss (this->d_ptr->m_seg->get_structure_set());
5858
}
5959
drs.set_dose (this->d_ptr->m_dose);

packages/dicom/dcmtk/itk_wasm_rt_study.h

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,13 @@
3333
class PLMBASE_API Itk_wasm_rt_study: public Rt_study {
3434
public:
3535
SMART_POINTER_SUPPORT (Itk_wasm_rt_study);
36-
public:
37-
// Itk_wasm_rt_study_private *d_ptr;
3836

39-
public:
4037
Itk_wasm_rt_study ();
4138
~Itk_wasm_rt_study ();
4239

43-
void save_rtss (const char *fname, const ItkWasmRtStudyMetadata &metadata);
44-
45-
// /*! \brief Get the Rt_study_metadata */
46-
// const Rt_study_metadata::Pointer& get_rt_study_metadata () const;
47-
// Rt_study_metadata::Pointer& get_rt_study_metadata ();
48-
// /*! \brief Set metadata items into study_metadata portion of Rt_study_metadata */
49-
// void set_study_metadata (const std::vector<std::string>& metadata);
50-
// /*! \brief Get the study_metadata portion of Rt_study_metadata */
51-
// Metadata::Pointer& get_study_metadata ();
52-
// /*! \brief Set metadata items into image portion of Rt_study_metadata */
53-
// void set_image_metadata (const std::vector<std::string>& metadata);
54-
// /*! \brief Get the image portion of Rt_study_metadata */
55-
// Metadata::Pointer& get_image_metadata ();
56-
// /*! \brief Set metadata items into dose portion of Rt_study_metadata */
57-
// void set_dose_metadata (const std::vector<std::string>& metadata);
58-
// /*! \brief Get the dose portion of Rt_study_metadata */
59-
// Metadata::Pointer& get_dose_metadata ();
60-
// /*! \brief Set metadata items into rtstruct portion
61-
// of Rt_study_metadata */
62-
// void set_rtstruct_metadata (const std::vector<std::string>& metadata);
63-
// /*! \brief Get the rtstruct portion of Rt_study_metadata */
64-
// Metadata::Pointer& get_rtstruct_metadata ();
65-
// /*! \brief Create new StudyInstanceUID and FrameOfReferenceUID for the study */
66-
// void generate_new_study_uids ();
67-
// /*! \brief Force the CT series UID to a certain value when saving */
68-
// void force_ct_series_uid (const std::string& series_uid);
40+
void save_rtss (const char *fname, const ItkWasmRtStudyMetadata &metadata, bool quiet = true);
6941

7042
protected:
71-
// void save_dcmtk (const char *dicom_dir, bool filenames_with_uid);
7243
};
7344

7445
#endif

packages/dicom/dcmtk/write-rt-struct.cxx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ int main (int argc, char * argv[])
4848
std::string dicomMetadataString("{}");
4949
if (dicomMetadataOption->count() > 0)
5050
{
51-
std::cout << "Reading DICOM metadata from JSON: " << dicomMetadataOption->count() << std::endl;
5251
dicomMetadataString = std::string(std::istreambuf_iterator<char>(dicomMetadataJson.Get()), {});
5352
}
5453
auto deserializedAttempt = glz::read_json<ItkWasmRtStudyMetadata>(dicomMetadataString);
@@ -60,26 +59,12 @@ int main (int argc, char * argv[])
6059
}
6160
const auto dicomMetadata = deserializedAttempt.value();
6261

63-
std::cout << "UID Prefix: " << dicomMetadata.uidPrefix << std::endl;
64-
6562
PlmUidPrefix::getInstance().set(dicomMetadata.uidPrefix);
6663

6764
Itk_wasm_rt_study rt_study;
6865

69-
rt_study.load_cxt(inputCxt.c_str());
70-
71-
Rt_study_metadata::Pointer rt_study_metadata = rt_study.get_rt_study_metadata();
72-
rt_study_metadata->set_study_description("A Test Prostate Lesion RT Struct Study");
73-
rt_study_metadata->set_patient_birth_date("19700101");
74-
rt_study_metadata->print();
75-
// rt_study.set_rt_study_metadata(rt_study_metadata);
76-
// rt_study_metadata->set_study_instance_uid("
77-
Metadata::Pointer study_metadata = rt_study_metadata->get_study_metadata();
78-
study_metadata->print_metadata();
79-
80-
Metadata::Pointer rtstruct_metadata = rt_study_metadata->get_rtstruct_metadata();
81-
rtstruct_metadata->print_metadata();
82-
66+
constexpr bool quiet{ true };
67+
rt_study.load_cxt(inputCxt.c_str(), quiet);
8368

8469
rt_study.save_rtss(outputDicom.c_str(), dicomMetadata);
8570

0 commit comments

Comments
 (0)