예제 #1
0
//        (0x20100000,UL,0x000000AA) # 
//(0x20100010,ST,"STANDARD\1,1") # Image Display Format
//(0x20100050,CS,"8INX10IN") # Film Size ID
//(0x20100100,CS,"BLACK ") # Border Density
//(0x20100150,ST,"128 ") # Configuration Information
//(0x20100500,SQ,
//# Item Number 1
//# (0xFFFEE000, UNDEFINED) # ItemIntroducer 
//  >(0x00081150,UI,"1.2.840.10008.5.1.1.1") # Referenced SOP Class UID
//  >(0x00081155,UI,"1.2.826.0.1.3680043.2.1211.9.1") # Referenced SOP Instance UID
//# (0xFFFEE00D, 0) # ItemDelimiter 
//# (0xFFFEE0DD, 0) # SequenceDelimiter
//) # Referenced Film Session Sequence with length of: 0

        private Int16 CreateBasicFilmBox(UInt16 row,UInt16 col)
        {
            UnparsePDU u;
            var buff = new byte[0];
            try
            {
                var ncreate = new N_CREATE();
                var listAttributes = new List<DataElement>();
                DataElement dataElement;
                ImageDisplayFormat = String.Concat(@"STANDARD\",row.ToString( "D"),col.ToString( "D"));
                if ((ImageDisplayFormat.Length%2) != 0) ImageDisplayFormat += ' ';
                dataElement = new DataElement(DICOMTag.ImageDisplayFormatTag,
                                              Encoding.ASCII.GetBytes(ImageDisplayFormat));
                listAttributes.Add(dataElement);
                dataElement = new DataElement(DICOMTag.FilmOrientationTag, Encoding.ASCII.GetBytes(FilmOrientation));
                listAttributes.Add(dataElement);
                dataElement = new DataElement(DICOMTag. FilmSizeIDTag , Encoding.ASCII.GetBytes(FilmSizeID));
                listAttributes.Add(dataElement);
                
                //reference film session
                dataElement = new DataElement(DICOMTag.ReferencedFilmSessionSequenceTag, 0xFFFFFFFFU);
                listAttributes.Add(dataElement);                
                dataElement = new DataElement(DICOMTag.ItemIntroducerTag , 0xFFFFFFFFU);
                listAttributes.Add(dataElement);
                dataElement = new DataElement(DICOMTag.ReferencedSOPClassUIDTag, Encoding.ASCII.GetBytes(SOP.BasicFilmSessionSOPClassUID));
                listAttributes.Add(dataElement);
                dataElement = new DataElement(DICOMTag.ReferencedSOPInstanceUIDTag  , Encoding.ASCII.GetBytes(FilmSessionInstanceUID ));
                listAttributes.Add(dataElement);

                FilmBoxInstanceUID = Ultility.CreateInstanceUID(FilmBoxInstance);
                ncreate.NCREATERequestCommand(_stream, _presentationContextID, SOP.BasicFilmBoxSOPClassUID,
                                              bMessageID, FilmBoxInstanceUID, listAttributes);
                u = new UnparsePDU(_stream, buff);
                if (u.PDUType.Equals(4))
                {
                    var parsedPDU = new PDataTFPDU(u);
                    string ncreateRespondstring = ncreate.NCREATERespondParse(parsedPDU);
                    if (!ncreateRespondstring.Contains("FAILURE"))
                    {
                        Int16 retstatus = Convert.ToInt16(parsedPDU.PDVContent.DataElementHashTable[DICOMTag.StatusTag]);
                        _logger.Info("NCREATE RESPOND SUCCESS!");
                        if (!Convert.ToInt16(parsedPDU.PDVContent.DataElementHashTable[DICOMTag.DataSetTypeTag]).Equals(
                                CommandFieldConst.NoDataSet))
                        {
                            u = new UnparsePDU(_stream, buff);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.FatalException("Exception", ex);
            }
            return 0;
        }
예제 #2
0
 private Int16 CreateFilmSession(UInt16 NoOfCopies)
 {
     UnparsePDU u;
     var buff = new byte[0];
     try
     {
         FilmSessionInstance = new object();
         var ncreate = new N_CREATE();
         var listAttributes = new List<DataElement>();
         var dataElement = new DataElement(DICOMTag.NumberOfCopiesTag,
                                           Encoding.ASCII.GetBytes(NoOfCopies.ToString("D2")));
         listAttributes.Add(dataElement);
         FilmSessionInstanceUID = Ultility.CreateInstanceUID(FilmSessionInstance);
         ncreate.NCREATERequestCommand(_stream, _presentationContextID, SOP.BasicFilmSessionSOPClassUID,
                                       bMessageID,FilmSessionInstanceUID , listAttributes);
         u = new UnparsePDU(_stream, buff);
         if (u.PDUType.Equals(4))
         {
             var parsedPDU = new PDataTFPDU(u);
             string ncreateRespondstring = ncreate.NCREATERespondParse(parsedPDU);
             if (!ncreateRespondstring.Contains("FAILURE"))
             {
                 Int16 retstatus = Convert.ToInt16(parsedPDU.PDVContent.DataElementHashTable[DICOMTag.StatusTag]);
                 _logger.Info("NCREATE RESPOND SUCCESS!");
                 if (
                     !Convert.ToInt16(parsedPDU.PDVContent.DataElementHashTable[DICOMTag.DataSetTypeTag]).Equals(
                         CommandFieldConst.NoDataSet))
                 {
                     u = new UnparsePDU(_stream, buff);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         _logger.FatalException("Exception", ex);
     }
     return 0;
 }