L_DicomPrintSCUUpdateImageBox

Syntax

#include "ltdic.h"

L_LTDIC_API L_INT L_DicomPrintSCUUpdateImageBox(hPrintSCU, pszImageBoxInstanceUID, pImage, uIndex, pParameters, pszRefImageOverlayBoxInstanceUID, pszRefPresLUTInstanceUID)

Parameters

HDICOMPRINTSCU hPrintSCU

A handle to Dicom Print SCU.

const L_TCHAR *pszImageBoxInstanceUID

SOP Instance UID of the Image Box.

HDICOMDS pImage

Image to be printed in the Image Box.

L_UINT32 uIndex

Image Box index to be updated.

const pIMAGEBOXPARAMETERS pParameters

Image Box parameters to be updated.

const L_TCHAR *pszRefImageOverlayBoxInstanceUID

Referenced Image Overlay Box.

const L_TCHAR *pszRefPresLUTInstanceUID

Referenced Presentation LUT.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

When the Print SCP is requested to create a Film Box, it will also create one or more Image Boxes, based on the Image Display Format. This function updates a particular Image Box. The Image Box specified (by the SOP Instance UID) must belong to the current (last created) Film Box.

The type of the Image Boxes created by the Print SCP (Grayscale or Color) depends on the Meta SOP Class of the Film Session created at first. Refer to the function L_DicomPrintSCUCreateFilmSession for more information.

The function will not return until it receives the response of the Print SCP, or an error occurs. The function L_DicomPrintSCUGetLastOperationStatus can be used to obtain the status code specified in the response of the Print SCP. When the return value of the function UpdateImageBox is 0, then the Image Box was updated successfully, with either a Success or Warning status code in the response of the Print SCP.

The parameter pParameters points to an IMAGEBOXPARAMETERS structure that specifies the Image Box parameters to be updated. In this structure, if a string member is NULL, then the corresponding Attribute will not be included in the request to the Print SCP and hence will not be updated. Similarly, if a numeric member (that specifies an Attribute) is negative, the corresponding Attribute will not be included in the request and hence will not be updated. Notice that since the Attributes Min Density, Max Density, and Configuration Information are defined only for Grayscale Image Boxes, the function will ignore the following structure members for Color Image Boxes:

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT DicomPrintSCUUpdateImageBoxExample() 
 
{ 
   L_INT          nRet; 
   HDICOMPRINTSCU hPrintSCU;  
 
   hPrintSCU = L_DicomPrintSCUCreate(NULL); 
    
   L_DicomPrintSCUSetTimeout (hPrintSCU, 60); // 60 seconds 
 
   L_TCHAR szMsg[32];  
 
   // Establish the Association 
 
   nRet = L_DicomPrintSCUAssociate (hPrintSCU, 
                             TEXT("10.0.2.20"), 7104, TEXT("PrintSCP"), 2704, 
                             TEXT("PrintSCP"), TEXT("PrintSCU"), 
                             PRINTSCU_BASIC_GRAYSCALE_PM_META_SOP_CLASS | 
                             PRINTSCU_BASIC_COLOR_PM_META_SOP_CLASS | 
                             PRINTSCU_BASIC_ANNOTATION_BOX_SOP_CLASS | 
                             PRINTSCU_BASIC_PRINT_IMAGE_OVERLAY_BOX_SOP_CLASS | 
                             PRINTSCU_PRESENTATION_LUT_SOP_CLASS | 
                             PRINTSCU_PRINT_JOB_SOP_CLASS | 
                             PRINTSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS);  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   if (nRet == DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED)  
 
   { 
 
      L_UCHAR nSource, nReason;  
 
      L_DicomPrintSCUGetAssociateRejectInfo (hPrintSCU, NULL, &nSource, &nReason);  
 
      wsprintf(szMsg, TEXT("Source = %i, Reason = %i"), nSource, nReason);  
 
      MessageBox(NULL, szMsg, TEXT("Association Request was Rejected"), MB_OK);  
 
      return nRet; 
 
   } 
 
   else if (nRet != DICOM_SUCCESS)  
 
   { 
 
      wsprintf(szMsg, TEXT("Error code: %i"), nRet);  
 
      MessageBox(NULL, szMsg, TEXT("Failed to Establish the Association"), MB_OK);  
 
      return nRet;  
 
   } 
 
   // Display some printer info 
 
   //GetPrinterInfo(PrintSCU);  
 
   // Display some printer configuration info 
 
   //GetPrinterConfigInfo(PrintSCU);  
 
   FILMSESSIONPARAMETERS FilmSessionParams;  
 
   // Create a Film Session 
 
   L_DicomPrintSCUGetDefaultFilmSessionParameters (hPrintSCU, &FilmSessionParams,  
                                            sizeof(FILMSESSIONPARAMETERS));  
 
   FilmSessionParams.nNumberOfCopies = 1;  
 
   nRet = L_DicomPrintSCUCreateFilmSession (hPrintSCU, &FilmSessionParams, FALSE);  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   MessageBox(NULL, L_DicomPrintSCUGetFilmSessionInstanceUID (hPrintSCU), 
              TEXT("Film Session SOP Instance UID"), MB_OK);  
 
   // Update the Film Session to specify a "MED" Print Priority 
 
   nRet = L_DicomPrintSCUGetDefaultFilmSessionParameters (hPrintSCU, &FilmSessionParams,  
                                            sizeof(FILMSESSIONPARAMETERS));  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   FilmSessionParams.pszPrintPriority = TEXT("MED"); 
 
   nRet = L_DicomPrintSCUUpdateFilmSession (hPrintSCU, &FilmSessionParams);  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   FILMBOXPARAMETERS FilmBoxParams;  
 
   nRet = L_DicomPrintSCUGetDefaultFilmBoxParameters (hPrintSCU, &FilmBoxParams,  
                                        sizeof(FILMBOXPARAMETERS));  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   if (L_DicomPrintSCUIsClassSupported (hPrintSCU, PRINTSCU_BASIC_ANNOTATION_BOX_SOP_CLASS))  
 
   { 
 
      FilmBoxParams.pszAnnotationDisplayFormatID = TEXT("SomeID"); 
 
   } 
 
   // Create a Film Box 
 
   nRet = L_DicomPrintSCUCreateFilmBox (hPrintSCU, &FilmBoxParams, NULL);  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   MessageBox(NULL, L_DicomPrintSCUGetFilmBoxInstanceUID (hPrintSCU), 
              TEXT("Film Box SOP Instance UID"), MB_OK);  
 
   L_PCTSTR pszPresLUTInstanceUID = NULL;  
 
   // Create a Presentation LUT 
 
   if (L_DicomPrintSCUIsClassSupported (hPrintSCU, PRINTSCU_PRESENTATION_LUT_SOP_CLASS))  
 
   { 
 
      LDicomDS PresLUT;  
 
      nRet = PresLUT.LoadDS(MAKE_IMAGE_PATH(TEXT("IMAGE1.dcm")), DS_LOAD_CLOSE); 
      if (nRet == DICOM_SUCCESS) 
      { 
 
         nRet = L_DicomPrintSCUCreatePresentationLUT (hPrintSCU, &PresLUT, NULL);  
         if(nRet != DICOM_SUCCESS) 
            return nRet; 
 
         pszPresLUTInstanceUID = L_DicomPrintSCUGetPresentationLUTInstanceUID (hPrintSCU); 
 
         MessageBox(NULL, pszPresLUTInstanceUID,  
                    TEXT("PresLUT SOP Instance UID"), MB_OK);  
 
      } 
      else 
         return nRet; 
 
   } 
 
   if (pszPresLUTInstanceUID)  
 
   { 
 
      // Update the Film Box to reference the Presentation LUT we just created 
 
      nRet = L_DicomPrintSCUUpdateFilmBox (hPrintSCU, NULL, pszPresLUTInstanceUID);  
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
   } 
 
   L_PCTSTR pszOverlayBoxInstanceUID = NULL;  
   L_PCTSTR pszRefPresLUTInstanceUID = NULL; 
 
   // The image to be printed in the Image Box 
 
   LDicomDS Image;  
 
   nRet = Image.LoadDS (MAKE_IMAGE_PATH(TEXT("Image1.dcm")), DS_LOAD_CLOSE);  
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   // Update the Image Box. Since the Image Display Format of the Film Box was 
 
   // set to "STANDARD\1,1", then we are supposed to have one Image Box created 
 
   // by the Print SCP.  
 
   if (L_DicomPrintSCUGetImageBoxesCount (hPrintSCU)) 
 
   { 
 
      L_PCTSTR pszImageBoxInstanceUID = L_DicomPrintSCUGetImageBoxInstanceUID (hPrintSCU, 0);  
 
      MessageBox(NULL, pszImageBoxInstanceUID,  
                 TEXT("Image Box SOP Instance UID"), MB_OK);  
 
      IMAGEBOXPARAMETERS ImageBoxParams;  
 
      nRet = L_DicomPrintSCUGetDefaultImageBoxParameters(hPrintSCU, &ImageBoxParams,  
                                            sizeof(IMAGEBOXPARAMETERS));  
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
      ImageBoxParams.nImagePosition = 1;  
 
      #if defined(LEADTOOLS_V19_OR_LATER) 
            nRet = L_DicomPrintSCUUpdateImageBox (hPrintSCU, pszImageBoxInstanceUID,  
                                            &Image, 
                                            0, 
                                            &ImageBoxParams, 
                                            pszOverlayBoxInstanceUID,  
                                            pszRefPresLUTInstanceUID);  
      #else 
            nRet = L_DicomPrintSCUUpdateImageBox (hPrintSCU, pszImageBoxInstanceUID, 
               &Image,  
               &ImageBoxParams,  
               pszOverlayBoxInstanceUID);  
      #endif 
 
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
      // We don't need them any more 
 
      L_DicomPrintSCUFreeImageBoxesInstanceUIDs(hPrintSCU); 
 
   } 
 
   // Update the Annotation Boxes (if there are any)  
 
   L_UINT32 uAnnBoxesCount = L_DicomPrintSCUGetAnnotationBoxesCount (hPrintSCU); 
 
   for (L_UINT32 i = 0; i < uAnnBoxesCount; i++) 
 
   { 
 
      nRet = L_DicomPrintSCUUpdateAnnotationBox (hPrintSCU, L_DicomPrintSCUGetAnnotationBoxInstanceUID (hPrintSCU, i),  
                                   L_UINT16(i + 1), TEXT("Some Text")); 
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
   } 
 
   L_DicomPrintSCUFreeAnnotationBoxesInstanceUIDs (hPrintSCU); // We don't need them any more 
 
   // Print the Film Session (or the Film Box; there is no difference since we 
 
   // have a single Film Box in the Film Session)  
   nRet = L_DicomPrintSCUPrintFilmSession (hPrintSCU); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   // Display some info about the Print Job 
 
   if (L_DicomPrintSCUIsClassSupported (hPrintSCU, PRINTSCU_PRINT_JOB_SOP_CLASS))  
   { 
      //GetPrintJobInfo(PrintSCU, L_DicomPrintSCUGetPrintJobInstanceUID (hPrintSCU)); 
   } 
 
   // Delete the Film Box (anyway, it would be deleted when the Film Session 
 
   // is deleted)  
 
   nRet = L_DicomPrintSCUDeleteFilmBox (hPrintSCU); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   // Delete the Film Session 
 
   nRet = L_DicomPrintSCUDeleteFilmSession (hPrintSCU); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   // Delete the Presentation LUT 
 
   if (pszPresLUTInstanceUID)  
 
   { 
 
      nRet = L_DicomPrintSCUDeletePresentationLUT (hPrintSCU, pszPresLUTInstanceUID);  
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
   } 
 
   // Delete the Image Overlay Box 
 
   if (pszOverlayBoxInstanceUID)  
 
   { 
 
      nRet = L_DicomPrintSCUDeleteOverlayBox (hPrintSCU, pszOverlayBoxInstanceUID);  
      if(nRet != DICOM_SUCCESS) 
         return nRet; 
 
   } 
 
   // Release the Association and close the connection 
 
   nRet = L_DicomPrintSCURelease(hPrintSCU); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   L_DicomPrintSCUFree(hPrintSCU); 
 
   return DICOM_SUCCESS; 
} 
Help Version 23.0.2024.7.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.