File: store.cpp

package info (click to toggle)
odil 0.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,476 kB
  • sloc: cpp: 55,982; python: 3,947; javascript: 460; xml: 182; makefile: 99; sh: 36
file content (45 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "odil/Association.h"
#include "odil/DataSet.h"
#include "odil/EchoSCU.h"
#include "odil/Reader.h"
#include "odil/StoreSCU.h"

int main(int argc, char** argv)
{
    odil::Association association;
    association.set_peer_host("184.73.255.26");
    association.set_peer_port(11112);
    association.update_parameters()
        .set_calling_ae_title("myself")
        .set_called_ae_title("AWSPIXELMEDPUB")
        .set_presentation_contexts({
            {
                odil::registry::MRImageStorage,
                { odil::registry::ImplicitVRLittleEndian }, 
                odil::AssociationParameters::PresentationContext::Role::SCP
            },
            {
                odil::registry::Verification,
                { odil::registry::ImplicitVRLittleEndian }, 
                odil::AssociationParameters::PresentationContext::Role::SCU
            }
        });
    
    association.associate();

    odil::EchoSCU echo_scu(association);
    echo_scu.echo();
    
    odil::StoreSCU scu(association);
    
    for(int i=1; i<argc; ++i)
    {
        std::ifstream stream(argv[i], std::ios::binary);
        auto const header_and_data_set = odil::Reader::read_file(stream);
        
        scu.set_affected_sop_class(header_and_data_set.first);
        scu.store(header_and_data_set.first);
    }
    
    association.release();
}