Fraxinus  18.10
An IGT application
cxImageFileStreamerService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
12 
13 #include "cxStringProperty.h"
14 #include "cxDoubleProperty.h"
15 #include "cxBoolProperty.h"
16 #include "cxMHDImageStreamer.h"
18 #include "cxTypeConversions.h"
19 #include "cxFilePathProperty.h"
20 
21 
22 namespace cx
23 {
24 
25 
29 
31 {
32  return "3D Image File";
33 }
34 
36 {
37  return "image_file_streamer";
38 }
39 
40 std::vector<PropertyPtr> ImageFileStreamerService::getSettings(QDomElement root)
41 {
42  std::vector<PropertyPtr> retval;
43 
44  std::vector<PropertyPtr> opencvArgs = ImageStreamerDummyArguments().getSettings(root);
45  std::copy(opencvArgs.begin(), opencvArgs.end(), back_inserter(retval));
46 
47  std::vector<PropertyPtr> localsvrArgs = LocalServerStreamerArguments().getSettings(root);
48  std::copy(localsvrArgs.begin(), localsvrArgs.end(), back_inserter(retval));
49 
50  return retval;
51 }
52 
54 {
55 // std::cout << "filecontent create streamer\n" << root.ownerDocument().toString().toStdString() << std::endl;
56 
58  StreamerPtr localServerStreamer = LocalServerStreamer::createStreamerIfEnabled(root, args);
59 
60  if (localServerStreamer)
61  {
62  return localServerStreamer;
63  }
64  else
65  {
66  boost::shared_ptr<DummyImageStreamer> streamer(new DummyImageStreamer());
67 
68  QString filename = ImageStreamerDummyArguments().getFilenameOption(root)->getValue();
69  bool secondary = ImageStreamerDummyArguments().getSecondaryOption(root)->getValue();
70  streamer->initialize(filename, secondary);
71  return streamer;
72  }
73 }
74 
75 } // namespace cx
76 
virtual StreamerPtr createStreamer(QDomElement root)
FilePathPropertyPtr getFilenameOption(QDomElement root)
static StreamerPtr createStreamerIfEnabled(QDomElement root, StringMap args)
virtual std::vector< PropertyPtr > getSettings(QDomElement root)
virtual std::vector< PropertyPtr > getSettings(QDomElement root)
std::map< QString, QString > StringMap
StringMap convertToCommandLineArguments(QDomElement root)
BoolPropertyBasePtr getSecondaryOption(QDomElement root)
boost::shared_ptr< class Streamer > StreamerPtr
std::vector< PropertyPtr > getSettings(QDomElement root)
Namespace for all CustusX production code.