Also consult the wiki (https://github.com/fo-dicom/fo-dicom/wiki) for answers to common questions.
var pixelData = DicomPixelData.Create(multiframeDataset, false);
, then retrieve the n-th frame like var data = pixelData.GetFrame(n);
, then you clone the old dataset and remove the multiframe-pixels with var singleDataset = multiframeDataset.Clone(); singelDataset.Remove(DicomTag.PixelData);
. Then you create new pixeldata instance and add the data of the n-th frame there: var singleframePixelData = DicomPixelData.Create(singleDataset, true); singleframePixelData.AddFrame(data);
And then you save the new file.
(5200,9229)
, per-frame functional groups sequence (5200,9230)
, and the pixel data to the single-frame MR image (when possible). After that I have to assign new UIDs and convert/remove all the additional data of the enhanced image. Am I right?can anyone point me in the direction of some learning materials regarding "MaskTag" in private tags?
I am adding private tags to my dataset. In my example file the tag was (nnnn,1001).
I created a private dictionary to parse all the private tags from the example file using tags such as (nnnn,xx01), as per the wiki page: https://github.com/fo-dicom/fo-dicom/wiki/Adding-private-tags-to-dictionary.
This worked fine, but a the time I wasn't quite sure what the purpose of the 'xx' was in the entries. I had to do the same to get my entries working.
Now I am creating private tags, and I have got it working, but the final tag value is (nnnn,0001), but I want it to be the same as my example file e.g. (nnnn,1001).
Hello all, I am evaluating using fo-dicom in a legacy application. The app is not very DICOM heavy, it has fairly modest needs. It originally used Merge OpenEyes, then introduced a "DicomWrapper" layer to allow use of either OpenEyes or dcmtk (which was in turn given a C# friendly wrapper). In these days of medical device regulations regarding SOUP and OTS software, we have dropped support for OpenEyes (it is quite old and expensive and relied on Microsoft Visual J# which is long dead).
I kind of hate the codebase that we have now, layers of wrappers and cruft, and am debating ripping it all out and just using fo-dicom. To this end, I will be adding fo-dicom as a 3rd implementation under the existing wrapper. This will allow us to learn fo-dicom, selectively enable it for testing and give us a transition period. I have the obvious newbie questions...
#1) Can anyone state that they have fo-dicom being used in "production" systems or in commercial products? This seems like a live community, so I assume it is being used, but had to ask.
#2) And, of course I am immediately feeling stupid as I attempt to do a CEchoRequest... our wrapper returns different failure reasons (bad address/port, bad AE, etc). And I look at the example code for fo-dicom and... the examples only show sending the request, not determining any of the failure reasons... Of course, I see the OnTimeout and OnResponseRecieved delegates, and I see the various exception types... It appears that if I want to know the reason (so that I can communicate it to the person configuring the product's DICOM connecton) I will need to have a fairly long set to catch blocks... and then switch on the Abort/Reject Reasons?
for (var i = 0; i < dicomImage.NumberOfFrames; ++i){
using (var renderImage = dicomImage.RenderImage(i)){
//do what I'm doing with the pixel data here
}
}
Offset and count cannot be greater than 0 in EmptyBuffer (Parameter 'offset')
on their first .RenderImage call. Any ideas?
Unable to create JPEG Process 1 codec for bits stored == 12
, Should I cast it as 16 bit store and then try to change transfer syntax?var file = DicomFile.Open(@"E:\Reference Line\GHADERMAZI NADIYEH-37 624366\SR 301\IM00001.dcm");
var newFile = file.Clone(DicomTransferSyntax.JPEGProcess1);
newFile.Save(@"E:\Reference Line\GHADERMAZI NADIYEH-37 624366\SR 301\fo-IM00001.dcm");
Hello all,
I am trying to save images stored in a .dic file to jpeg or other file formats by looping through a new bitmap built from the height and width of the frames in the .dic file. However I am not sure what to make of the double value I get from the GetPixel method. How would I convert that to a RGB value to use in the SetPixel Method of the Bitmap class from system drawing?
Any assistance is very much appreciated. Thanks!
var file = DicomFile.Open(@"file.dic");
var patientName = file.Dataset.GetString(DicomTag.PatientName);
var header = DicomPixelData.Create(file.Dataset);
var pixelData = PixelDataFactory.Create(header, 0);
Bitmap bmp = new Bitmap(pixelData.Width, pixelData.Height);
for (int i = 0; i < pixelData.Width; i++)
{
for (int j = 0; j < pixelData.Height; j++)
{
double color = pixelData.GetPixel(i, j);
int red = Math.Min((int)(color * 256), 255);
int green = Math.Min((int)((color * 256 - red) * 256), 255);
int blue = Math.Min((int)(((color * 256 - red) * 256 - green) * 256), 255);
Color color2 = Color.FromArgb(red, blue, green);
bmp.SetPixel(i, j, color2);
}
}
bmp.Save(patientName+".png", ImageFormat.Jpeg);