Comments (3)
The EvilDICOM library does not currently have Tag descriptions. I am not sure it is worth the time it would take to aggregate all of the descriptions into a class or dictionary. Why do you need those in your software?
The library is open source. You could roll your own. Something like :
public class TagDescriptionHelper {
public static string GetTagDescription(string completeId){
//Look up in xml file with the maps...the hard part is to create this file
}
}
On the untyped data thing, can you show me what you are trying to do? I don't think you should have to use that.
from evil-dicom.
I wasn't very clear on my requirements. The tag name actually was what I was looking for. Here's a section of my code where I figured out how to retrieve it using your library. The FirstOrDefault linq enumerable method was used to pull the TagInfo for the tag associated with the IDICOMElement. From the TagInfo I was able to pull the tag name, e.g. TagInfo.Name. In addition, I needed to get the DICOM standard short VR code, which was accomplished using the VRDictionary. Is there an easier way to get at this info?
Also, this method shows how I wound up pulling the subsequence info from the IDICOMElement. I needed to be able to loop through all elements at all levels in the DICOM data in order to keep track of parent-child relationships using a GUID in the hiarchial table I'm inserting the data into. I couldn't figure out how to get the parent info when using the AllElements method of the DICOMObject so I ended up using the Elements method and de.GetType() to determine if the multiplicity IDICOMElement could be cast to a EvilDICOM.Core.DICOMObject to get the children. It's ugly. If you can give me an example of the correct way to do this, I can figure it out. I can usually get things done, albeit the hard way, but my OOP understanding is still a work in progress! :-)
Thanks for putting together such a great open DICOM library and for all your help!
private void processDataElement(EvilDICOM.Core.Interfaces.IDICOMElement de)
{
try
{
EvilDICOM.Core.Dictionaries.TagDictionary td = new EvilDICOM.Core.Dictionaries.TagDictionary();
EvilDICOM.Core.Dictionaries.VRDictionary vr = new EvilDICOM.Core.Dictionaries.VRDictionary();
EvilDICOM.Core.Dictionaries.TagInfo ti = td.Tags.FirstOrDefault(s => s.TagID == de.Tag.CompleteID);
string deTypeName = de.GetType().Name;
string tag = String.Format("({0},{1})", de.Tag.Group, de.Tag.Element);
Guid dicomDataID = Guid.Empty;
// setup temporary variables
string desc = "Unknown";
string vrabbr = "UN";
if (ti != null)
{
desc = ti.Name.ToString();
vrabbr = VRDictionary.GetAbbreviationFromVR(ti.VR);
}
System.DateTime dtNow = System.DateTime.UtcNow;
int fileLevel = DICOMFileInfo.FileLevel;
Guid parentDICOMDataID = Guid.Empty;
if (DICOMFileInfo.ParentDICOMDataID != Guid.Empty)
{
parentDICOMDataID = DICOMFileInfo.ParentDICOMDataID;
}
// create a separate record for each value
char[] delims = { '|' };
string[] vals = de.UntypedData.ToString().Split(delims);
foreach (string val in vals)
{
Norton_DICOMDataSet.tblDICOMDataRow dr = DICOMdataTable.NewtblDICOMDataRow();
dicomDataID = Guid.NewGuid();
dr.DICOMDataID = dicomDataID;
dr.SOPInstanceUID = DICOMFileInfo.SOPInstanceUID;
dr.Tag = tag;
if (deTypeName == VR.Sequence.ToString())
{
dr.Length = 0;
}
else
{
dr.Length = val.Length;
}
dr.CreateDateTime = dtNow;
dr.Level = fileLevel;
dr.ParentDICOMDataID = parentDICOMDataID;
dr.VR = vrabbr;
dr.Description = desc;
dr.Value = val;
AddtblDICOMDataRow(dr);
}
// nested sequence
if (deTypeName == VR.Sequence.ToString())
{
DICOMFileInfo.ParentDICOMDataID = dicomDataID;
DICOMFileInfo.FileLevel++;
foreach (EvilDICOM.Core.DICOMObject dobj in ((EvilDICOM.Core.DICOMData<EvilDICOM.Core.DICOMObject>)de.UntypedData).MultipicityValue)
{
processDataSet(dobj);
}
DICOMFileInfo.ParentDICOMDataID = dicomDataID;
DICOMFileInfo.FileLevel--;
}
}
catch (Exception ex)
{
Console.Error.WriteLine("Unable to create DICOM data records for file:\n" +
DICOMFileInfo.File + "\n" +
ex.Message);
}
}
from evil-dicom.
Thanks CBrianMarks!! I had the same problem of getting TagDescription from IDICOMElement, since last two days. The code posted above got me the solution, specifically the line in your code:
EvilDICOM.Core.Dictionaries.TagInfo ti = td.Tags.FirstOrDefault(s => s.TagID == de.Tag.CompleteID);
Thank You Very Much for sharing the code!
I think rexcardan must think of providing this facility of getting TagDescription from elements.
from evil-dicom.
Related Issues (20)
- Feature Request: Single Association Mass CStore request
- Feature Request: Get (300A,000C) RTPlanGeometry Dicom tag HOT 1
- DICOM to BEV Transformation
- SendCStore skips important RS-DICOM-Tag (0008,0106) for Eclipse-Import
- Dicom File Larger than 2 GB HOT 7
- DICOMSCP error when a contour has many points HOT 1
- A typo in method bool IsInBounds(Vector3 pt) in RT package
- Anonymization fails for RP-files HOT 1
- Possible leak in DICOMSCU HOT 2
- MaskImageFast Error
- Unable to read Primary Fluence Mode Sequence
- CMove from ARIA to Self - CT Images (EvilDICOM v2.0.6.5) HOT 2
- ReadIndefiniteBigEndian uses LittleEndian for EndOfSequenceItem
- Queue.Anonymize() throws System.InvalidOoperationException HOT 2
- Progress and Roadmap of Evil-DICOM
- Meta/Header information not being written
- Unable to retrieve tag BeamDeliveryDurationLimit (300A,005C) HOT 1
- Is there any tool for writing Dicom-RT structure easily?
- How to delete one structure from loaded DICOM StructureSet
- RTDose CStore error when sending to MIM HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evil-dicom.