本文整理汇总了C#中DicomAttributeCollection.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# DicomAttributeCollection.Copy方法的具体用法?C# DicomAttributeCollection.Copy怎么用?C# DicomAttributeCollection.Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomAttributeCollection
的用法示例。
在下文中一共展示了DicomAttributeCollection.Copy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupMRSeries
public IList<DicomAttributeCollection> SetupMRSeries(int seriesCount, int instancesPerSeries, string studyInstanceUid)
{
List<DicomAttributeCollection> instanceList = new List<DicomAttributeCollection>();
DicomAttributeCollection baseCollection = new DicomAttributeCollection();
SetupMR(baseCollection);
baseCollection[DicomTags.StudyInstanceUid].SetStringValue(studyInstanceUid);
int acquisitionNumber = 1;
int instanceNumber = 100;
float positionX = -61.7564f;
float positionY = -212.04848f;
float positionZ = -99.6208f;
float orientation1 = 0.861f;
float orientation2 = 0.492f;
float orientation3 = 0.126f;
float orientation4 = -0.2965f;
for (int i = 0; i < seriesCount; i++)
{
string seriesInstanceUid = DicomUid.GenerateUid().UID;
for (int j = 0; j < instancesPerSeries; j++)
{
string sopInstanceUid = DicomUid.GenerateUid().UID;
DicomAttributeCollection instanceCollection = baseCollection.Copy();
instanceCollection[DicomTags.SopInstanceUid].SetStringValue(sopInstanceUid);
instanceCollection[DicomTags.SeriesInstanceUid].SetStringValue(seriesInstanceUid);
instanceCollection[DicomTags.SeriesNumber].SetStringValue((i + 1).ToString());
instanceCollection[DicomTags.SeriesDescription].SetStringValue("Series" + (i + 1).ToString());
instanceCollection[DicomTags.AcquisitionNumber].SetStringValue(acquisitionNumber++.ToString());
instanceCollection[DicomTags.InstanceNumber].SetStringValue(instanceNumber++.ToString());
instanceCollection[DicomTags.ImagePositionPatient].SetFloat32(0, positionX);
instanceCollection[DicomTags.ImagePositionPatient].SetFloat32(1, positionY);
instanceCollection[DicomTags.ImagePositionPatient].SetFloat32(2, positionZ);
positionY += 0.1f;
instanceCollection[DicomTags.ImageOrientationPatient].SetFloat32(0, orientation1);
instanceCollection[DicomTags.ImageOrientationPatient].SetFloat32(1, orientation2);
instanceCollection[DicomTags.ImageOrientationPatient].SetFloat32(2, orientation3);
instanceCollection[DicomTags.ImageOrientationPatient].SetFloat32(2, orientation4);
orientation2 += 0.01f;
instanceList.Add(instanceCollection);
}
}
return instanceList;
}
示例2: TestAttributesEqual
public void TestAttributesEqual()
{
DicomAttributeCollection collection = new DicomAttributeCollection();
foreach (DicomTag tag in _tags)
TrySetValue(0, collection[tag]);
DicomAttributeCollection copy = collection.Copy(true, true, true);
foreach(DicomAttribute attribute in collection)
{
DicomAttribute copyAttribute = copy[attribute.Tag];
Assert.AreEqual(attribute, copyAttribute);
}
Assert.AreEqual(collection, copy);
}
示例3: TestEmptyAttributesEqual
public void TestEmptyAttributesEqual()
{
DicomAttributeCollection collection = new DicomAttributeCollection();
foreach (DicomTag tag in _tags)
{
object ignore = collection[tag].Values;
}
DicomAttributeCollection copy = collection.Copy(true, true, true);
foreach(DicomAttribute attribute in collection)
{
DicomAttribute copyAttribute = copy[attribute.Tag];
Assert.AreEqual(attribute, copyAttribute);
}
Assert.AreEqual(collection, copy);
}
示例4: TestCopy
public void TestCopy()
{
DicomAttributeCollection collection = new DicomAttributeCollection();
SetupMR(collection);
DicomAttributeCollection copy = collection.Copy(true, true, true);
Assert.AreEqual(collection.Count, copy.Count);
foreach(DicomAttribute attribute in collection)
{
DicomAttribute attribute2 = copy[attribute.Tag];
Assert.AreEqual(attribute2, attribute);
}
Assert.AreEqual(collection, copy);
collection = new DicomAttributeCollection();
SetupMultiframeXA(collection, 512, 512, 5);
copy = collection.Copy(true, true, true);
Assert.AreEqual(collection.Count, copy.Count);
foreach (DicomAttribute attribute in collection)
{
DicomAttribute attribute2 = copy[attribute.Tag];
Assert.AreEqual(attribute2, attribute);
}
Assert.AreEqual(collection, copy);
}
示例5: CreateInstance
private static DicomFile CreateInstance(int number, string description, SopClass sopClass, DicomAttributeCollection baseDataSet)
{
DateTime now = DateTime.Now;
DicomUid sopInstanceUid = DicomUid.GenerateUid();
DicomFile dicomFile = new DicomFile(string.Empty, new DicomAttributeCollection(), baseDataSet.Copy(true, true, true));
//meta info
dicomFile.MediaStorageSopInstanceUid = sopInstanceUid.UID;
dicomFile.MediaStorageSopClassUid = sopClass.Uid;
//Series
dicomFile.DataSet[DicomTags.Modality].SetStringValue("OT");
dicomFile.DataSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
dicomFile.DataSet[DicomTags.SeriesNumber].SetInt32(0, number);
dicomFile.DataSet[DicomTags.SeriesDescription].SetStringValue(description);
//General Image
dicomFile.DataSet[DicomTags.InstanceNumber].SetInt32(0, 1);
//SC Image
dicomFile.DataSet[DicomTags.DateOfSecondaryCapture].SetDateTime(0, now);
dicomFile.DataSet[DicomTags.TimeOfSecondaryCapture].SetDateTime(0, now);
//Sop Common
dicomFile.DataSet[DicomTags.InstanceCreationDate].SetDateTime(0, now);
dicomFile.DataSet[DicomTags.InstanceCreationTime].SetDateTime(0, now);
dicomFile.DataSet[DicomTags.SopClassUid].SetStringValue(sopClass.Uid);
dicomFile.DataSet[DicomTags.SopInstanceUid].SetStringValue(sopInstanceUid.UID);
return dicomFile;
}