File: gdcmNSetMessages.cxx

package info (click to toggle)
gdcm 3.0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 26,880 kB
  • sloc: cpp: 203,477; ansic: 78,582; xml: 48,129; python: 3,459; cs: 2,308; java: 1,629; lex: 1,290; sh: 334; php: 128; makefile: 117
file content (98 lines) | stat: -rw-r--r-- 2,740 bytes parent folder | download | duplicates (5)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*=========================================================================

  Program: GDCM (Grassroots DICOM). A DICOM library

  Copyright (c) 2006-2014 Mathieu Malaterre
  All rights reserved.
  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

#include "gdcmNSetMessages.h"
#include "gdcmUIDs.h"
#include "gdcmAttribute.h"
#include "gdcmImplicitDataElement.h"
#include "gdcmPresentationContextRQ.h"
#include "gdcmCommandDataSet.h"
#include "gdcmULConnection.h"

namespace gdcm{
  namespace network{

    std::vector<PresentationDataValue> NSetRQ::ConstructPDV(
      const ULConnection &inConnection, const BaseQuery* inQuery)
  {
  std::vector<PresentationDataValue> thePDVs;
  PresentationDataValue thePDV;
  
  PresentationContextRQ pc( inQuery->GetAbstractSyntaxUID() );
  uint8_t presidx = inConnection.GetPresentationContextIDFromPresentationContext(pc);
  if( !presidx )
  {
  // try harder:
  PresentationContextRQ pc2( inQuery->GetAbstractSyntaxUID(), UIDs::ExplicitVRLittleEndian);
  presidx = inConnection.GetPresentationContextIDFromPresentationContext(pc2);
  if( !presidx )
  {
      gdcmErrorMacro( "Could not find Pres Cont ID" );
      return thePDVs;
  }
  }
  thePDV.SetPresentationContextID( presidx );
  
  thePDV.SetCommand(true);
  thePDV.SetLastFragment(true);
  //ignore incoming data set, make your own

  CommandDataSet ds;
  ds.Insert( pc.GetAbstractSyntax().GetAsDataElement() );
  {
  Attribute<0x0,0x100> at = { 0x0120 };
  ds.Insert( at.GetAsDataElement() );
  }
  
  {
  Attribute<0x0,0x110> at = { 1 };
  ds.Insert( at.GetAsDataElement() );
  }
  
  {
  Attribute<0x0,0x800> at = { 1 };
  ds.Insert( at.GetAsDataElement() );
  }
  
  {
  Attribute<0x0,0x1001> at = { inQuery->GetSOPInstanceUID() };
  ds.Insert( at.GetAsDataElement() );
  }
  
  {
  Attribute<0x0,0x0> at = { 0 };
  unsigned int glen = ds.GetLength<ImplicitDataElement>();
  assert( (glen % 2) == 0 );
  at.SetValue( glen );
  ds.Insert( at.GetAsDataElement() );
  }
  
  thePDV.SetDataSet(ds);
  thePDVs.push_back(thePDV);
  thePDV.SetDataSet(inQuery->GetQueryDataSet());
  thePDV.SetMessageHeader( 2 );
  thePDVs.push_back(thePDV);
  return thePDVs;
}

  std::vector<PresentationDataValue>  
      NSetRSP::ConstructPDVByDataSet(const DataSet* inDataSet){
    std::vector<PresentationDataValue> thePDV;
    (void)inDataSet;
    assert( 0 && "TODO" );
    return thePDV;
  }

  }//namespace network
}//namespace gdcm