internal DicomAttributeSQ(DicomAttributeSQ attrib, bool copyBinary, bool copyPrivate, bool copyUnknown)
            : base(attrib)
        {
            DicomSequenceItem[] items = (DicomSequenceItem[])attrib.Values;

			if (items != null)
			{
				_values = new DicomSequenceItem[items.Length];
				for (int i = 0; i < items.Length; i++)
					_values[i] = (DicomSequenceItem) items[i].Copy(copyBinary, copyPrivate, copyUnknown);
			}
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the DicomDirectory class.
        /// </summary>
        /// <remarks>Sets most default values which can be changed via </remarks>
        /// <param name="aeTitle">The AE Title of the Media Reader/Writer accessing the DICOMDIR</param>
        public DicomDirectory(string aeTitle)
        {
            try
            {
                _dicomDirFile = new DicomFile();

                _dicomDirFile.MetaInfo[DicomTags.FileMetaInformationVersion].Values = new byte[] { 0x00, 0x01 };
                _dicomDirFile.MediaStorageSopClassUid = DicomUids.MediaStorageDirectoryStorage.UID;
                _dicomDirFile.SourceApplicationEntityTitle = aeTitle;
                _dicomDirFile.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;

                //_dicomDirFile.PrivateInformationCreatorUid = String.Empty;
                _dicomDirFile.DataSet[DicomTags.FileSetId].Values = String.Empty;
                ImplementationVersionName = DicomImplementation.Version;
                ImplementationClassUid = DicomImplementation.ClassUID.UID;

                _dicomDirFile.MediaStorageSopInstanceUid = DicomUid.GenerateUid().UID;

                // Set zero value so we can calculate the file Offset
				_dicomDirFile.DataSet[DicomTags.OffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntity].SetUInt32(0, 0);
                _dicomDirFile.DataSet[DicomTags.OffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntity].SetUInt32(0,0);
                _dicomDirFile.DataSet[DicomTags.FileSetConsistencyFlag].SetUInt16(0,0);

                _directoryRecordSequence = (DicomAttributeSQ)_dicomDirFile.DataSet[DicomTags.DirectoryRecordSequence];
            }
            catch (Exception ex)
            {
				Platform.Log(LogLevel.Error, ex, "Exception initializing DicomDirectory");
                throw;
            }
        }