Exemplo n.º 1
0
        public void Set_dvtkDataTag_vR_parameters()
        {
            DvtkData.Dimse.Tag dvtkDataTag = new DvtkData.Dimse.Tag(0x02, 0x10);
            VR vR = VR.UN;

            fileMetaInformation.Set(dvtkDataTag, vR);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the last tag in the tag sequence, the attribute
        /// is set in the FileMetaInformation or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag sequence, it is removed first before it is
        /// again set.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        internal void Set(TagSequence tagSequence, VR vR, params Object[] parameters)
        {
            // Check if the TagSequence supplied uniquely identifies one attribute.
            if (!tagSequence.IsSingleAttributeMatching)
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting an attribute.");
            }

            if (tagSequence.IsValidForFileMetaInformation)
            {
                FileMetaInformation.Set(tagSequence, vR, parameters);
            }
            else if (tagSequence.IsValidForDataSet)
            {
                DataSet.Set(tagSequence, vR, parameters);
            }
            else
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting a DicomFile attribute.");
            }
        }
Exemplo n.º 3
0
		void LoadDCMFile(string dicomFile)
		{	
			DCMFile = dicomFile;
			
			try
			{
				// Load the Definition Files
				foreach (string defFile in _DefFiles)
				{
					if(!_MainThread.Options.LoadDefinitionFile(defFile))
					{
						string theWarningText = string.Format("The Definition file {0} could not be loaded.\n", defFile);

						richTextBoxLog.AppendText(theWarningText);
					}
				}

				_DefFiles.Clear();

				// Set the Data directory
				_MainThread.Options.DataDirectory = _DataDirectory;

				// Read the DCM File
				DicomFile dcmFile = new DicomFile();
				dcmFile.DataSet.UnVrDefinitionLookUpWhenReading = false;
				dcmFile.Read(_DCMFileName, _MainThread);

				// Get the FMI from the selected DCM file
				// Get the FMI from the selected DCM file
				if(_FileMetaInfo == null)
					_FileMetaInfo = new FileMetaInformation();

				_FileMetaInfo = dcmFile.FileMetaInformation;

				string tsStr;
				if(_FileMetaInfo.Exists("0x00020010"))
				{
					// Get the Transfer syntax
					HLI.Attribute tranferSyntaxAttr = _FileMetaInfo["0x00020010"];
					_TransferSyntax = tranferSyntaxAttr.Values[0];
					tsStr = _TransferSyntax;
				}
				else
				{
					_TransferSyntax = "1.2.840.10008.1.2.1";
					tsStr = "Undefined, the default transfer syntax will Explicit VR Little Endian";
					_FileMetaInfo.Set("0x00020010",VR.UI,"1.2.840.10008.1.2.1");
				}

				// Get the Data set from the selected DCM file
				if(_DCMdataset == null)
					_DCMdataset = new HLI.DataSet();

				_DCMdataset = dcmFile.DataSet;

				string theInfoText;
				if(_DCMdataset != null)
				{
					UpdateAttributeDataGrid();
					UpdateFMIDataGrid();

					theInfoText = string.Format("DCM file {0} read successfully with Transfer Syntax {1}.\n\n", _DCMFileName,tsStr);

					richTextBoxLog.AppendText(theInfoText);
				}
				else
				{
					theInfoText = string.Format("Error in reading DCM file {0}\n\n", _DCMFileName);

					richTextBoxLog.AppendText(theInfoText);
				}	
			}
			catch(Exception exception)
			{
				string theErrorText;

				theErrorText = string.Format("DCM file {0} could not be read:\n{1}\n\n", _DCMFileName, exception.Message);

				richTextBoxLog.AppendText(theErrorText);

				_DCMdataset = null;
				_FileMetaInfo = null;
				//dataGridAttributes.SetDataBinding(null, "");
			}
			
		
			//Reset the variable 
			_IsNewDCMFileLoaded = false;
		}