[英]Creating Dicom Sequences with fo-dicom
After extracting information out of a radiation therapy plan stored as a DICOM-File, my issue is now a different one. 从存储为DICOM文件的放射治疗计划中提取信息后,我的问题现在有所不同。
I know, that I can add or update items in an existing plan with (eg) 我知道,我可以使用(例如)在现有计划中添加或更新项目
file.Dataset.AddOrUpdate(Dicom.DicomTag.PatientAge,23);
Even handling DicomTags in a sequence is not the problem with (eg) 即使按顺序处理DicomTag,也不是问题所在(例如)
file.Dataset.Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamSequence).Items[1].
Get<Dicom.DicomSequence>(Dicom.DicomTag.ControlPointSequence).Items[0].
Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamLimitingDevicePositionSequence).Items[2].
AddOrUpdate(Dicom.DicomTag.LeafJawPositions, "-30\\30");
But now I am wondering if it is possible to create a complete new sequence and store information in it? 但是现在我想知道是否有可能创建一个完整的新序列并在其中存储信息? I know that wanting this forces me to create not only one item, but much more information arround this item, cause there is no sequence in the plans I looked through which have this. 我知道,希望这样做不仅迫使我创建一个项目,而且要创建更多有关该项目的信息,因为我查看的计划中没有顺序。
In the fo-dicom API documentation I found the Dicom.IO.Writer
Namespace. 在fo-dicom API文档中,我找到了Dicom.IO.Writer
命名空间。 I looked through but didn't find what i expected to find. 我浏览了一下,但没有找到想要的东西。 Following my first instinct, I would have written this 按照我的第一个直觉,我会写这篇
string filename = "output.dcm";
DicomWriter file = new DicomWriter(@filename);
... trying to create TagElements
Also the other command line DicomFileWriter file = new DicomFileWriter(...);
还有另一个命令行DicomFileWriter file = new DicomFileWriter(...);
doesn't work because the constructor only wants to receive options. 不起作用,因为构造方法只希望接收选项。 The other DicomWriter()
constructor is similar to this. 其他DicomWriter()
构造函数与此类似。
I also checked the file.Dataset
possibilities for writing new tags, but without succes. 我还检查了file.Dataset
编写新标签的可能性,但没有成功。 So I hope one of you can give me a hint where I did a wrong step. 因此,我希望你们中的一个能给我提示我做错了一步的地方。
This is one way of doing it: 这是一种实现方式:
string filename = "output.dcm";
DicomDataset ds = new DicomDataset(); //Main dataset
ds.Add(DicomTag.SpecificCharacterSet, "ISO_IR 100"); //Add some items
ds.Add(DicomTag.PatientID, "191212121212");
DicomDataset sqContent = new DicomDataset(); //Content of the sequence
sqContent.Add(DicomTag.Modality, "US");
sqContent.Add(DicomTag.ScheduledProcedureStepStartDate, DateTime.Now.Date);
DicomSequence sq = new DicomSequence(DicomTag.ScheduledProcedureStepSequence, sqContent); // Create sequence, add content
ds.Add(sq); //Add sequence to main dataset
DicomFile file = new DicomFile();
file.Dataset.Add(ds); //Add main dataset to DicomFile
file.FileMetaInfo.TransferSyntax = DicomTransferSyntax.ImplicitVRLittleEndian; //Specify transfer syntax
file.Save(filename); //Save file to disk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.