1 /*========================================================================= 2 3 Program: GDCM (Grassroots DICOM). A DICOM library 4 5 Copyright (c) 2006-2014 Mathieu Malaterre 6 All rights reserved. 7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 8 9 This software is distributed WITHOUT ANY WARRANTY; without even 10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 11 PURPOSE. See the above copyright notice for more information. 12 13 =========================================================================*/ 14 15 #include "gdcmNSetMessages.h" 16 #include "gdcmUIDs.h" 17 #include "gdcmAttribute.h" 18 #include "gdcmImplicitDataElement.h" 19 #include "gdcmPresentationContextRQ.h" 20 #include "gdcmCommandDataSet.h" 21 #include "gdcmULConnection.h" 22 23 namespace gdcm{ 24 namespace network{ 25 ConstructPDV(const ULConnection & inConnection,const BaseQuery * inQuery)26 std::vector<PresentationDataValue> NSetRQ::ConstructPDV( 27 const ULConnection &inConnection, const BaseQuery* inQuery) 28 { 29 std::vector<PresentationDataValue> thePDVs; 30 PresentationDataValue thePDV; 31 32 PresentationContextRQ pc( inQuery->GetAbstractSyntaxUID() ); 33 uint8_t presidx = inConnection.GetPresentationContextIDFromPresentationContext(pc); 34 if( !presidx ) 35 { 36 // try harder: 37 PresentationContextRQ pc2( inQuery->GetAbstractSyntaxUID(), UIDs::ExplicitVRLittleEndian); 38 presidx = inConnection.GetPresentationContextIDFromPresentationContext(pc2); 39 if( !presidx ) 40 { 41 gdcmErrorMacro( "Could not find Pres Cont ID" ); 42 return thePDVs; 43 } 44 } 45 thePDV.SetPresentationContextID( presidx ); 46 47 thePDV.SetCommand(true); 48 thePDV.SetLastFragment(true); 49 //ignore incoming data set, make your own 50 ; 51 CommandDataSet ds; 52 ds.Insert( pc.GetAbstractSyntax().GetAsDataElement() ); 53 { 54 Attribute<0x0,0x100> at = { 0x0120 }; 55 ds.Insert( at.GetAsDataElement() ); 56 } 57 58 { 59 Attribute<0x0,0x110> at = { 1 }; 60 ds.Insert( at.GetAsDataElement() ); 61 } 62 63 { 64 Attribute<0x0,0x800> at = { 1 }; 65 ds.Insert( at.GetAsDataElement() ); 66 } 67 68 { 69 Attribute<0x0,0x1001> at = { inQuery->GetSOPInstanceUID() }; 70 ds.Insert( at.GetAsDataElement() ); 71 } 72 73 { 74 Attribute<0x0,0x0> at = { 0 }; 75 unsigned int glen = ds.GetLength<ImplicitDataElement>(); 76 assert( (glen % 2) == 0 ); 77 at.SetValue( glen ); 78 ds.Insert( at.GetAsDataElement() ); 79 } 80 81 thePDV.SetDataSet(ds); 82 thePDVs.push_back(thePDV); 83 thePDV.SetDataSet(inQuery->GetQueryDataSet()); 84 thePDV.SetMessageHeader( 2 ); 85 thePDVs.push_back(thePDV); 86 return thePDVs; 87 } 88 89 std::vector<PresentationDataValue> ConstructPDVByDataSet(const DataSet * inDataSet)90 NSetRSP::ConstructPDVByDataSet(const DataSet* inDataSet){ 91 std::vector<PresentationDataValue> thePDV; 92 (void)inDataSet; 93 assert( 0 && "TODO" ); 94 return thePDV; 95 } 96 97 }//namespace network 98 }//namespace gdcm 99