From 738d24ae873bb37d580bd1fd7ad01055c28dc6dc Mon Sep 17 00:00:00 2001 From: Marat Nagayev Date: Tue, 13 Dec 2022 14:43:02 +0300 Subject: [PATCH 1/2] Add example edit --- examples/edit.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/edit.cpp diff --git a/examples/edit.cpp b/examples/edit.cpp new file mode 100644 index 0000000..cbd99c1 --- /dev/null +++ b/examples/edit.cpp @@ -0,0 +1,32 @@ +//compile with clang++ --std=c++11 -lvega -lz edit.cpp -o edit +#include +#include +#include + +#include "vega/dictionary/dictionary.h" +#include "vega/dicom/file.h" + +int main(int argc, char *argv[]) { + if (argc < 3) { + std::cout << "Usage: edit input_file output_file" << std::endl; + return 1; + } + // Optional you can set the dictionary file + // vega::dictionary::Dictionary::set_dictionary("/path/to/dictionary/dictionary.txt"); + vega::dicom::File file(argv[1]); + + auto element = file.data_set->element(); + if (element) { + // If there are patient names, set them all to "Smith^Alice" + for (auto& name : element->manipulator()) { + name = "Smith^Alice"; + } + } else { + std::cout << "Coudn't find patient name, creating it" << std::endl; + // If there are no patient names, add one with value "Smith^Alice" + element = file.data_set()->new_element(); + element->manipulator()->push_back("Smith^Alice"); + } + file.write(argv[2]); + return 0; +} From 051acbb406514c91b01ad9683fbaa6a4c5cdba2f Mon Sep 17 00:00:00 2001 From: Marat Nagayev Date: Tue, 13 Dec 2022 14:44:32 +0300 Subject: [PATCH 2/2] Add paragraph for docs --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 31f0177..34e4fa1 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,10 @@ The supported file options are: - `--remove_undefined_lengths`: forces the output file(s) to have no data elements with udnefined lengths - `--anonymize` or `--anonymize=my_new_patient_id`: anonymizes the input file(s) +## Documentation + +Please visit [github pages](https://project-eutopia.github.io/vega/). + ## Reading/writing files Here is a simple example of using the library to read a file in and print a string representation of the content to standard out.