Thursday, February 09, 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: VMCCNY
New Today New Today: 18
New Yesterday New Yesterday: 26
User Count Overall: 20581

People Online People Online:
Visitors Visitors: 11
Members Members: 3
Total Total: 14

Online Now Online Now:
01: okdicom
02: ednfran
03: sfrank

ClearCanvas Community Forums

Need help about imagePixelMacroIod.PixelAspectRatio. Please help me
Last Post 2009-09-23 07:39 AM by ss5309. 40 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 1 of 3123 > >>
Author Messages
cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-26 11:59 PM  

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



dblanchard
Senior Member
Senior Member
Posts:185

--
2009-04-27 12:47 AM  

I think you are right.   The BasicGrayscaleImageSequenceIod is setting the PixelAspectRatio which is causing issues.

Try this:

 

        private void SendRequest(string clientAETitle, string remoteAE, string remoteHost, int remotePort, string file1)
        {
            BasicGrayscalePrintScu printScu = new BasicGrayscalePrintScu();
            printScu.Timeout = 100000;
            BasicFilmSessionModuleIod basicFilmSessionModuleIod = new BasicFilmSessionModuleIod();
            basicFilmSessionModuleIod.NumberOfCopies = 1;

            BasicFilmBoxModuleIod basicFilmBoxModuleIod = new BasicFilmBoxModuleIod();

            basicFilmBoxModuleIod.ImageDisplayFormat = @"STANDARD\1,1";
            basicFilmBoxModuleIod.FilmSizeId = FilmSize.IN8x10;
            basicFilmBoxModuleIod.MagnificationType = MagnificationType.None;
            basicFilmBoxModuleIod.FilmOrientation = FilmOrientation.Portrait;

            IList imageBoxPixelModuleIods = new List();

            // Configure 1st Image
            ImageBoxPixelModuleIod imageBoxPixelModuleIod = new ImageBoxPixelModuleIod();
            imageBoxPixelModuleIod.ImageBoxPosition = 1;

            DicomSequenceItem basicGrayscaleImageSequence2 = new DicomSequenceItem();

            DicomFile dicomFile = new DicomFile(file1);
            dicomFile.Load();
            var dicomTags = new List()
                {
                    DicomTags.ImageType,
                    DicomTags.SopClassUid,
                    DicomTags.SopInstanceUid,
                    DicomTags.StudyInstanceUid,
                    DicomTags.SamplesPerPixel,
                    DicomTags.PhotometricInterpretation,
                    DicomTags.NumberOfFrames,
                    DicomTags.Rows,
                    DicomTags.Columns,
                    DicomTags.BitsAllocated,
                    DicomTags.BitsStored,
                    DicomTags.HighBit,
                    DicomTags.PixelRepresentation,
                    DicomTags.SmallestImagePixelValue,
                    DicomTags.LargestImagePixelValue,
                    DicomTags.WindowCenter,
                    DicomTags.WindowWidth,
                    DicomTags.PixelData
                };

            foreach (var dicomTag in dicomTags)
                basicGrayscaleImageSequence2[dicomTag].Values = dicomFile.DataSet[dicomTag].Values;

            imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.BasicGrayscaleImageSequence].AddSequenceItem(basicGrayscaleImageSequence2);
            imageBoxPixelModuleIods.Add(imageBoxPixelModuleIod);

            printScu.Print(clientAETitle, remoteAE, remoteHost, remotePort, basicFilmSessionModuleIod, basicFilmBoxModuleIod, imageBoxPixelModuleIods);
}

 



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 02:40 AM  

Thanks

But I have a question before running your new Code

Must I update some class as you guide in this topic below

http://www.clearcanvas.ca/dnn/Porta...lIod.patch

 



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 02:48 AM  

 I am using VS2008 and C# but I don't know which namespace to be added so that I can use List object var dicomTags = new List()

{

DicomTags.ImageType,DicomTags.SopClassUid,DicomTags.SopInstanceUid,DicomTags.StudyInstanceUid, DicomTags.SamplesPerPixel, ,...

};

Please tell me



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 02:51 AM  
Error 6 'ClearCanvas.Dicom.Iod.Modules.ImageBoxPixelModuleIod' does not contain a definition for 'DicomAttributeProvider' and no extension method 'DicomAttributeProvider' accepting a first argument of type 'ClearCanvas.Dicom.Iod.Modules.ImageBoxPixelModuleIod' could be found (are you missing a using directive or an assembly reference?) D:\ClearCV\Dicom\Samples\SamplesForm.cs 406 36 ClearCanvas.Dicom.Samples



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 03:09 AM  
IList imageBoxPixelModuleIods = new List();
Here are all errors after I copy your code
Error 3 Using the generic type 'System.Collections.Generic.List' requires '1' type arguments D:\ClearCV\Dicom\Samples\SamplesForm.cs 371 49 ClearCanvas.Dicom.Samples

------------------------------------------------------------
var dicomTags = new List()
{
DicomTags.ImageType,
DicomTags.SopClassUid,
DicomTags.SopInstanceUid,
DicomTags.StudyInstanceUid,
DicomTags.SamplesPerPixel,
DicomTags.PhotometricInterpretation,
DicomTags.NumberOfFrames,
DicomTags.Rows,
DicomTags.Columns,
DicomTags.BitsAllocated,
DicomTags.BitsStored,
DicomTags.HighBit,
DicomTags.PixelRepresentation,
DicomTags.SmallestImagePixelValue,
DicomTags.LargestImagePixelValue,
DicomTags.WindowCenter,
DicomTags.WindowWidth,
DicomTags.PixelData
};
Error 6 Cannot initialize object of type 'List' with a collection initializer D:\ClearCV\Dicom\Samples\SamplesForm.cs 382 17 ClearCanvas.Dicom.Samples
Error 5 Using the generic type 'System.Collections.Generic.List' requires '1' type arguments D:\ClearCV\Dicom\Samples\SamplesForm.cs 381 33 ClearCanvas.Dicom.Samples

-----------------
imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.BasicGrayscaleImageSequence].AddSequenceItem(basicGrayscaleImageSequence2);

Error 7 'ClearCanvas.Dicom.Iod.Modules.ImageBoxPixelModuleIod' does not contain a definition for 'DicomAttributeProvider' and no extension method 'DicomAttributeProvider' accepting a first argument of type 'ClearCanvas.Dicom.Iod.Modules.ImageBoxPixelModuleIod' could be found (are you missing a using directive or an assembly reference?) D:\ClearCV\Dicom\Samples\SamplesForm.cs 406 36 ClearCanvas.Dicom.Samples

------------------------------

printScu.Print(clientAETitle, remoteAE, remoteHost, remotePort, basicFilmSessionModuleIod, basicFilmBoxModuleIod, imageBoxPixelModuleIods);


Error 8 The best overloaded method match for 'ClearCanvas.Dicom.Network.Scu.BasicGrayscalePrintScu.Print(string, string, string, int, ClearCanvas.Dicom.Iod.Modules.BasicFilmSessionModuleIod, ClearCanvas.Dicom.Iod.Modules.BasicFilmBoxModuleIod, System.Collections.Generic.IList)' has some invalid arguments D:\ClearCV\Dicom\Samples\SamplesForm.cs 410 13 ClearCanvas.Dicom.Samples
Error 9 Argument '7': cannot convert from 'System.Collections.IList' to 'System.Collections.Generic.IList' D:\ClearCV\Dicom\Samples\SamplesForm.cs 410 184 ClearCanvas.Dicom.Samples



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 03:30 AM  

 Hi you!

I have solved my problem by code again you code like this

 BasicGrayscalePrintScu printScu = new BasicGrayscalePrintScu();

            printScu.Timeout = 100000;

            BasicFilmSessionModuleIod basicFilmSessionModuleIod = new BasicFilmSessionModuleIod();

            basicFilmSessionModuleIod.NumberOfCopies = 1;

 

            BasicFilmBoxModuleIod basicFilmBoxModuleIod = new BasicFilmBoxModuleIod();

 

            basicFilmBoxModuleIod.ImageDisplayFormat = @"STANDARD\1,1";

            basicFilmBoxModuleIod.FilmSizeId = FilmSize.IN8x10;

            basicFilmBoxModuleIod.MagnificationType = MagnificationType.None;

            basicFilmBoxModuleIod.FilmOrientation = FilmOrientation.Portrait;

 

            IList imageBoxPixelModuleIods = new List();

 

            // Configure 1st Image

            ImageBoxPixelModuleIod imageBoxPixelModuleIod = new ImageBoxPixelModuleIod();

            imageBoxPixelModuleIod.ImageBoxPosition = 1;

 

            DicomSequenceItem basicGrayscaleImageSequence2 = new DicomSequenceItem();

 

            DicomFile dicomFile = new DicomFile(ImgFilePath);

            dicomFile.Load();

            var dicomTags = new List()

                {

                    DicomTags.ImageType,

                    DicomTags.SopClassUid,

                    DicomTags.SopInstanceUid,

                    DicomTags.StudyInstanceUid,

                    DicomTags.SamplesPerPixel,

                    DicomTags.PhotometricInterpretation,

                    DicomTags.NumberOfFrames,

                    DicomTags.Rows,

                    DicomTags.Columns,

                    DicomTags.BitsAllocated,

                    DicomTags.BitsStored,

                    DicomTags.HighBit,

                    DicomTags.PixelRepresentation,

                    DicomTags.SmallestImagePixelValue,

                    DicomTags.LargestImagePixelValue,

                    DicomTags.WindowCenter,

                    DicomTags.WindowWidth,

                    DicomTags.PixelData

                };

 

            foreach (var dicomTag in dicomTags)

                basicGrayscaleImageSequence2[dicomTag].Values = dicomFile.DataSet[dicomTag].Values;

 

            imageBoxPixelModuleIod.DicomAttributeCollection[DicomTags.BasicGrayscaleImageSequence].AddSequenceItem(basicGrayscaleImageSequence2);

            imageBoxPixelModuleIods.Add(imageBoxPixelModuleIod);

 

           printScu.Print(AECallingTitle, AECalledTitle, Host, Port, basicFilmSessionModuleIod, basicFilmBoxModuleIod, (IList)imageBoxPixelModuleIods);

 

After that I try to print a dicom image to server and it print successfully and exactly the Image.

However, there are some existed problems. Here are problems

1. After printing, it seem to be that the printScu does not send SendDeleteFilmBoxRequest,SendDeleteFilmSessionRequest or ReleaseConnection. Because I see that the scp server still to work and does not allow new session

2. New code you sent only print a dicom image that has one frame. I have tried to print a multiple frame(page) dicom image but the Scpserver does not accept it. By using an simulator Film printer I see that

***** Connection wanted  Monday, April 27, 2009  at 14h20mn

-- Creating Film box

-- Film Box [A4 -> A4] created with 1 Grayscale Image Boxes

-> [n_set]: bitsStored value illegal

 

Here are two problems I saw.

Please help me to solved this

Thanks in advance!



cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 04:10 AM  
New problem I found
I have tried to print a large Dicom Image file(with only one frame), here it's about 12 Mb.
But it will raise exception at the code
foreach (var dicomTag in dicomTags)

basicGrayscaleImageSequence2[dicomTag].Values = dicomFile.DataSet[dicomTag].Values;
By debugging the code I see that
dicomFile.DataSet[ DicomTags.SmallestImagePixelValue].Values=null
and
dicomFile.DataSet[DicomTags.LargestImagePixelValue].Values=null
So It raise error. Please check it again with large dicom image
You can use two image in the link I uploaded to Mediafire(one is large Image and one is multiframe Image)
Thanks in advance
Here are the link
http://www.mediafire.com/?vk0zmeef59y
and
http://www.mediafire.com/?mzz32iji3hz


dblanchard
Senior Member
Senior Member
Posts:185

--
2009-04-27 11:28 AM  
sorry for the errors i am using vs2008 / .net 3.5. perhaps it didn't copy and paste OK. i i thought generics would be ok, it's in System.Collections.Generic ... you could do IList dicomTags = new List() instad of the var dicomTags shortcut.

regaring error, that was a sample YMMV. did you take out those two offending tags it is sending? (SmallestImagePixelValue and LargestImagePixelValue) I am not sure if they are needed, it was just one program I used seemed to use those...

I can't download those files it keeps saying "Your user identity is invalid, please login or use a supported browser to save files." The site looks suspicious I don't want to use it. I would prefer rapidshare.com can you upload to this?


cuongdv
Basic Member
Basic Member
Posts:24

--
2009-04-27 08:55 PM  

 Hi you!

This is the link contain2 two my dicom file on rapid share

http://rapidshare.com/files/226545220/MultiframeDicomImage.rar.html

 

http://rapidshare.com/files/226547199/LargeDicomImage.rar.html

Thanks for your support and hope to see you response and solution for two kind of these dicom image!



ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-02 05:20 PM  

Hi,

I have tried the code you said that worked for printing exactly the same image that was seen on the screen, but whatever I did (applying patches, getting the latest version of the classes, giving the window width and window level parameters by hand at every possible place) I could not get rid of the gray image.

It feels like the parameters I set are never read or overwritten. Can you help me about this problem? Should I set a standart LUT somewhere? Or did you change anything in the BasicGrayscalePrintScu class?

Thanks,

ozahan



dblanchard
Senior Member
Senior Member
Posts:185

--
2009-07-03 11:31 AM  
ozahan, can you provide more of a code sample what you are doing?


ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-20 03:18 AM  

I have the latest trunk version of BasicGrayScaleScu (and all related classes) and have tried using two different  codes CODE1, CODE2:

 

CODE1:

       BasicGrayscalePrintScu printScu = new BasicGrayscalePrintScu();
       BasicFilmSessionModuleIod basicFilmSessionModuleIod = new BasicFilmSessionModuleIod();
       basicFilmSessionModuleIod.NumberOfCopies = 1;
      
       BasicFilmBoxModuleIod basicFilmBoxModuleIod = new BasicFilmBoxModuleIod();
       // Set it to print 1 image
       basicFilmBoxModuleIod.ImageDisplayFormat = @"STANDARD\1,1";
       basicFilmBoxModuleIod.FilmSizeId = FilmSize.IN14x17;
       basicFilmBoxModuleIod.MagnificationType = MagnificationType.None;
       basicFilmBoxModuleIod.FilmOrientation = FilmOrientation.Portrait;
      
       IList imageBoxPixelModuleIods = new List();
       ImageBoxPixelModuleIod imageBoxPixelModuleIod = new ImageBoxPixelModuleIod();
       imageBoxPixelModuleIod.ImageBoxPosition = 1;

       var basicGrayscaleImageSequence = new BasicGrayscaleImageSequenceIod();
       basicGrayscaleImageSequence.AddDicomFileValues(localSource.Filename);              

       imageBoxPixelModuleIod.BasicGrayscaleImageSequenceList.Add(basicGrayscaleImageSequence);
       imageBoxPixelModuleIods.Add(imageBoxPixelModuleIod);

       printScu.Print("PRINT_SCP", "PRINT_SCP", "localhost", 200, basicFilmSessionModuleIod, basicFilmBoxModuleIod, imageBoxPixelModuleIods);

 

----------------------------------------------------------------------------------

CODE2:

       var dicomTags = new List()
                {
                    DicomTags.ImageType,
                    DicomTags.SopClassUid,
                    DicomTags.SopInstanceUid,
                    DicomTags.StudyInstanceUid,
                    DicomTags.SamplesPerPixel,
                    DicomTags.PhotometricInterpretation,
                    DicomTags.NumberOfFrames,
                    DicomTags.Rows,
                    DicomTags.Columns,
                    DicomTags.BitsAllocated,
                    DicomTags.BitsStored,
                    DicomTags.HighBit,
                    DicomTags.PixelRepresentation,
                    DicomTags.SmallestImagePixelValue,
                    DicomTags.LargestImagePixelValue,
                    DicomTags.WindowCenter,
                    DicomTags.WindowWidth,
                    DicomTags.PixelData,
                    DicomTags.SopClassesInStudy,
                    DicomTags.SourceFrameOfReferenceUid,
                    DicomTags.SourceImageSequence,
                    DicomTags.SourceInstanceSequence,
                    DicomTags.SourceSequence,
                    DicomTags.SourceStrength,
                    DicomTags.TableOfPixelValues,
                    DicomTags.Uid,
                    DicomTags.ServiceEpisodeId,
                    DicomTags.TransactionUid,
                    DicomTags.ConfigurationInformation,
                    DicomTags.ContentSequence,
                    DicomTags.ContrastFrameAveraging,
                    DicomTags.CorrectedImage,
                    DicomTags.EnergyWindowCenterlineRetired,
                    DicomTags.EnergyWindowRangeSequence,
                    DicomTags.FilmSessionLabel,
                    DicomTags.ImageBoxContentSequenceRetired,
                    DicomTags.ImageDisplayFormat,
                    DicomTags.ImageFrameOrigin,
                    DicomTags.MinDensity,
                    DicomTags.MaxDensity

                };

       BasicGrayscalePrintScu printScu = new BasicGrayscalePrintScu();
       BasicFilmSessionModuleIod basicFilmSessionModuleIod = new BasicFilmSessionModuleIod();
       basicFilmSessionModuleIod.NumberOfCopies = 1;
      
       BasicFilmBoxModuleIod basicFilmBoxModuleIod = new BasicFilmBoxModuleIod();
       // Set it to print 1 image
       basicFilmBoxModuleIod.ImageDisplayFormat = @"STANDARD\1,1";
       basicFilmBoxModuleIod.FilmSizeId = FilmSize.IN14x17;
       basicFilmBoxModuleIod.MagnificationType = MagnificationType.None;
       basicFilmBoxModuleIod.FilmOrientation = FilmOrientation.Portrait;
      
       IList imageBoxPixelModuleIods = new List();
       ImageBoxPixelModuleIod imageBoxPixelModuleIod = new ImageBoxPixelModuleIod();
       imageBoxPixelModuleIod.ImageBoxPosition = 1;
          
       //BasicGrayscaleImageSequenceIod basicGrayscaleImageSequence = new BasicGrayscaleImageSequenceIod();
       DicomSequenceItem basicGrayscaleImageSequence2 = new DicomSequenceItem();

       DicomFile dicomFile = new DicomFile(localSource.Filename);
       dicomFile.Load();
       foreach (var dicomTag in dicomTags)
       {
           DicomAttribute dicomAttribute;
           if (dicomFile.DataSet.TryGetAttribute(dicomTag, out dicomAttribute))
               basicGrayscaleImageSequence2[dicomTag].Values = dicomFile.DataSet[dicomTag].Values;
           System.Console.WriteLine(dicomFile.DataSet[dicomTag] + "");
       }
       //imageBoxPixelModuleIod.BasicGrayscaleImageSequenceList.Add(basicGrayscaleImageSequence);
   imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.BasicGrayscaleImageSequence].AddSequenceItem(basicGrayscaleImageSequence2);
          
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.SamplesPerPixel].Values = 1;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.Rows].Values = 512;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.Columns].Values = 512;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.BitsStored].Values = 16;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.BitsAllocated].Values = 16;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.HighBit].Values = 15;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.PixelData].Values = px;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.WindowCenter].Values = "40";
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.WindowWidth].Values = "400";
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.SmallestImagePixelValue].Values = "0";
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.LargestImagePixelValue].Values = "200";
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.PixelRepresentation].Values = 0;
           //imageBoxPixelModuleIod.DicomAttributeProvider[DicomTags.ConfigurationInformation].Values = "1,1";
           imageBoxPixelModuleIods.Add(imageBoxPixelModuleIod);
 
       printScu.Print("PRINT_SCP", "PRINT_SCP", "localhost", 200, basicFilmSessionModuleIod, basicFilmBoxModuleIod, imageBoxPixelModuleIods);

 

-----------------------------------------

I have also tried to insert the window width and window level as hardcoded data, but the printed image is still a gray one, different from the displayed image. I am stuck. Thanks.

ozahan



ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-20 03:27 AM  

By the way, the text between '<' and '>' tags does not appear on the forum page, I think the code is understood, I have used conventional samples, so I am not pasting the html encoded version.

ozahan



dblanchard
Senior Member
Senior Member
Posts:185

--
2009-07-20 02:28 PM  
Ozahan, can you upload some sample images? I only tested with our images, so not sure what's going on...

dan


ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-20 04:59 PM  

OK. When I try to print the dcm file attached, the printed outcome is like the"image_gray.jpg" (attached), while it should be like "image_correct.jpg".

I can succeed in obtaining "image_correct" using the dcm4che toolkit (PrintSCUFrame), but cannot get the image as it is displayed with BasicGrayscalePrintScu class. I am testing the outcome with a dcmprinter simulator source code and when I debug I see that the NCreate, NSet and NAction dataset inputs look also same for both PrintSCUFrame and BasicGrayscalePrintScu. I could not find the reason out.

I hope I could picture the situation. Thanks,

ozahan


Attachment: image_correct.jpg
Attachment: image_gray.jpg
Attachment: 1.2.840.113619.2.30.1.1762295590.1623.97866895.dcm

dblanchard
Senior Member
Senior Member
Posts:185

--
2009-07-20 05:29 PM  
looks like the image is not window leveled. perhaps dcm client is window leveling the actual pixel data before it sends it over...? i have not done a lot of testing w/ dicom printers, perhaps it is expecting the image to be exactly how you want it printed.

Is there a window level routine in CC library somewhere?


ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-20 05:49 PM  

There is a window level routine in WindowLevelTool.cs. Using some code blocks in this class, I got the window width and level of the displayed image and set it as SequenceItem values. However, these values are somehow overwritten or not taken into account by the PrintSCP. It acts as if the window width and level are not set and it takes some default values.

Perhaps I should do some settings about Standard LUT? Or should I set the window level attributes to the pixeldata itself?

ozahan



dblanchard
Senior Member
Senior Member
Posts:185

--
2009-07-20 06:00 PM  
Ozahan, I think you need to window level the actual pixel data. This means we have to probably refactor BasicGrayscaleImageSequenceIod.AddDicomFileValues(DicomFile dicomFile) to take a IDicomAttributeProvider (and then update the overload w/ filePath to pass in the dicomFile.DataSet), or just create another overload. And then in the calling code, to get the window level tags from the attribute collection, and then apply it to and update the pixel data in the attribute collection, and pass that into the new AddDicomFileValues method...

HTH

dan


ozahan
Basic Member
Basic Member
Posts:25

--
2009-07-21 01:22 AM  
OK, I will try that. However, I am still suspicious about missing sth because cuongdv above said "it prints successfully and exactly the image" with the code he applied which is nearly the same as my code. Is this a coincidence of the default values of the PrintSCP being the same as the image?


You are not authorized to post a reply.
Page 1 of 3123 > >>


Active Forums 4.1
Copyright 2011 ClearCanvas Inc.