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;
}
}