comparison OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp @ 4899:3ab57510f6dd proto-filter-instance-returning-error-code

integration mainline->proto-filter-instance-returning-error-code
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 20 Feb 2022 12:59:30 +0100
parents 656784ac6759 43e613a7756b
children
comparison
equal deleted inserted replaced
4791:656784ac6759 4899:3ab57510f6dd
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium 5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 * 7 *
7 * This program is free software: you can redistribute it and/or 8 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License 9 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation, either version 3 of 10 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version. 11 * the License, or (at your option) any later version.
159 if (rsp->DimseStatus == STATUS_Success) 160 if (rsp->DimseStatus == STATUS_Success)
160 { 161 {
161 // which SOP class and SOP instance ? 162 // which SOP class and SOP instance ?
162 163
163 #if DCMTK_VERSION_NUMBER >= 364 164 #if DCMTK_VERSION_NUMBER >= 364
164 if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sizeof(sopClass), 165 if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sizeof(sopClass),
165 sopInstance, sizeof(sopInstance), /*opt_correctUIDPadding*/ OFFalse)) 166 sopInstance, sizeof(sopInstance), /*opt_correctUIDPadding*/ OFFalse))
166 #else 167 #else
167 if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sopInstance, /*opt_correctUIDPadding*/ OFFalse)) 168 if (!DU_findSOPClassAndInstanceInDataSet(*imageDataSet, sopClass, sopInstance, /*opt_correctUIDPadding*/ OFFalse))
168 #endif 169 #endif
169 { 170 {
170 //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName); 171 //LOG4CPP_ERROR(Internals::GetLogger(), "bad DICOM file: " << fileName);
171 rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand; 172 rsp->DimseStatus = STATUS_STORE_Error_CannotUnderstand;
172 } 173 }
173 else if (strcmp(sopClass, req->AffectedSOPClassUID) != 0) 174 else if (strcmp(sopClass, req->AffectedSOPClassUID) != 0)
174 { 175 {
175 rsp->DimseStatus = STATUS_STORE_Error_DataSetDoesNotMatchSOPClass; 176 rsp->DimseStatus = STATUS_STORE_Error_DataSetDoesNotMatchSOPClass;
176 } 177 }
180 } 181 }
181 else 182 else
182 { 183 {
183 try 184 try
184 { 185 {
185 int status = cbdata->handler->Handle(**imageDataSet, *cbdata->remoteIp, cbdata->remoteAET, cbdata->calledAET); 186 rsp->DimseStatus = cbdata->handler->Handle(**imageDataSet, *cbdata->remoteIp, cbdata->remoteAET, cbdata->calledAET);
186
187 if (status != 0)
188 {
189 rsp->DimseStatus = static_cast<DIC_US>(status);
190 }
191 } 187 }
192 catch (OrthancException& e) 188 catch (OrthancException& e)
193 { 189 {
194 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources; 190 rsp->DimseStatus = STATUS_STORE_Refused_OutOfResources;
195 191