Friday, February 10, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: 孙磊
New Today New Today: 1
New Yesterday New Yesterday: 27
User Count Overall: 20591

People Online People Online:
Visitors Visitors: 16
Members Members: 0
Total Total: 16

Online Now Online Now:

ClearCanvas Community Forums

Can you solve this problem for me..About BasicGrayscalePrintScu
Last Post 2010-08-09 12:26 PM by stewart. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
cuongdv
Basic Member
Basic Member
Posts:24

--
2010-07-28 12:32 AM  

 Hi All

 
I am having a problem of using BasicGrayscalePrintScu to print to fiml
 
Here is my problems:
 
-----------------
 
is the imagePixelMacroIod.PixelAspectRatio important to Image printing?
In the class BasicGrayscaleImageSequenceIod in ClearCanvas.Dicom.Iod.Sequences I found that imagePixelMacroIod.PixelAspectRatio always has value of null. So the clause if (ratio.IsNull) raise Exception. If I replace clause if (ratio.IsNull) = clause if(ratio==null) then the image is very gray when printing on the film. It's not exactly the Image I choose to print.
Note: I tried many Dicom Images but imagePixelMacroIod.PixelAspectRatio is always null. Can you explain to me and please check the constructor of ImagePixelMacroIod imagePixelMacroIod = new ImagePixelMacroIod(dicomFile.DataSet);
Hope to see you reply as soon as possible!
 
Here is the function of ClearCanvas that imagePixelMacroIod.PixelAspectRatio is always null value.
 
 
public void AddDicomFileValues(DicomFile dicomFile)
        {
            try
            {
                ImagePixelMacroIod imagePixelMacroIod = new ImagePixelMacroIod(dicomFile.DataSet);
 
                this.SamplesPerPixel = 1; // only possible value for grayscale as per dicom standard
 
                if (imagePixelMacroIod.PhotometricInterpretation != PhotometricInterpretation.Monochrome1 || imagePixelMacroIod.PhotometricInterpretation != PhotometricInterpretation.Monochrome2)
                {
                    // Dicom File doesn't have Monochrome1 or MonoChrome2 - what to do?  throw exception or pick one?  let's try picking one...
                    this.PhotometricInterpretation = PhotometricInterpretation.Monochrome1;
                }
                else
                {
                    this.PhotometricInterpretation = imagePixelMacroIod.PhotometricInterpretation;
                }
 
                this.Rows = imagePixelMacroIod.Rows;
                this.Columns = imagePixelMacroIod.Columns;
 
                PixelAspectRatio ratio = imagePixelMacroIod.PixelAspectRatio;
    if (ratio.IsNull)
     this.PixelAspectRatio = new PixelAspectRatio(1, 1);
 
                //TODO: figure out when to make it 12... possible values are only 8 or 12...
                this.BitsStored = 8;
 
                // Bits allocated is 8 if BitsStored = 8, 12 if BitsStored = 12...
                this.BitsAllocated = (this.BitsStored == (ushort)8) ? (ushort)8 : (ushort)16;
 
                // High bit is 7 if Bits Stored = 8, 11 if Bits Stored = 12..
                this.HighBit = (this.BitsStored == (ushort)8) ? (ushort)7 : (ushort)11;
 
                // Always 0 as per DICOM standard
                this.PixelRepresentation = 0;
 
                // Sets the pixel data from the Dicom File
                this.PixelData = imagePixelMacroIod.PixelData;
            }
            catch (Exception)
            {
                throw;
            }
        }
stewart
Senior Member
Senior Member
Posts:2033

--
2010-08-09 12:26 PM  
The method you pasted in should first check that ratio != null before checking ratio.IsNull ... either that or PixelAspectRatio.FromString should return a new PixelAspectRatio(0, 0) object. Personally, I prefer the latter approach.

Anyway, it's easy enough to fix from outside. Just make sure any DicomFile being passed into AddDicomFileValues has a valid value for PixelAspectRatio, even if it's 1/1.
Real-time support available to Clinical Edition and Team Edition customers
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2011 ClearCanvas Inc.