8000 I have a question about DICOM Print. · Issue #1849 · fo-dicom/fo-dicom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

I have a question about DICOM Print. #1849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cslee99 opened this issue Sep 21, 2024 · 0 comments
Open

I have a question about DICOM Print. #1849

cslee99 opened this issue Sep 21, 2024 · 0 comments
Labels

Comments

@cslee99
Copy link
cslee99 commented Sep 21, 2024

Describe the bug

09:01:56[1]<<: Associate Request
Called AE: BUNNY
Calling AE: PrintSCU
Application Context: 1.2.840.10008.3.1.1.1
Presentation Context ID: 1 - 1.2.840.10008.5.1.1.9
Transfer Syntax: 1.2.840.10008.1.2
Presentation Context ID: 3 - 1.2.840.10008.5.1.1.18
Transfer Syntax: 1.2.840.10008.1.2
Maximum Length: 262144
Implementation Class UID: 1.3.6.1.4.1.30071.8
Implementation Version Name: fo-dicom 4.0.8
09:01:56[1]>>: Associate Accept
Called AE: BUNNY
Calling AE: PrintSCU
Application Context: 1.2.840.10008.3.1.1.1
Presentation Context ID: 1 - Accepted
Transfer Syntax: 1.2.840.10008.1.2
Presentation Context ID: 3 - Rejected
Maximum Length: 262144
Implementation Class UID: 1.2.826.0.1.3680043.2.1211.1
Implementation Version Name: DTK
09:01:56[1]:<< NCreate Request
PID: 1, Message ID: 13, Dataset: 0202h
Affected SOP Class UID: 1.2.840.10008.5.1.1.1
Affected SOP Instance UID: 2.25.257677750321689558050707301560348758412
09:01:56[1]:<< NCreate Request Single Dataset
(2000,0010) IS 0x00000002 Number of Copies

            [1]
(2000,0020) CS 0x00000004 Print Priority 

            [LOW]
(2000,0030) CS 0x0000000A Medium Type 

            [BLUE FILM]
(2000,0040) CS 0x0000000A Film Destination 

            [PROCESSOR]

09:01:56[1]:>> NCreate Response
PID: 1, Message ID: 13, Dataset: 0101h, Status: 0000h
Affected SOP Class UID: 1.2.840.10008.5.1.1.1
Affected SOP Instance UID: 1.2.826.0.1.3680043.2.1211.9.1
09:01:56[1]:<< NCreate Request
PID: 1, Message ID: 14, Dataset: 0202h
Affected SOP Class UID: 1.2.840.10008.5.1.1.2
Affected SOP Instance UID: 2.25.300094047817618521352642136711381500308
09:01:56[1]:<< NCreate Request Single Dataset
(2010,0010) ST 0x0000000C Image Display Format

            [STANDARD]
            [1,1]
(2010,0040) CS 0x00000008 Film Orientation 

            [PORTRAIT]
(2010,0050) CS 0x0000000A Film Size ID 

            [14INX17IN]
(2010,0060) CS 0x0000000A Magnification Type 

            [REPLICATE]
(2010,0080) CS 0x00000000 Smoothing Type 


(2010,0100) CS 0x00000006 Border Density 

            [BLACK]
(2010,0110) CS 0x00000006 Empty Image Density 

            [BLACK]
(2010,0120) US 0x00000002 Min Density 

            [0]
(2010,0130) US 0x00000002 Max Density 

            [400]
(2010,0140) CS 0x00000004 Trim 

            [YES]
(2010,0150) ST 0x00000000 Configuration Information 

==> The data exchange ends here without success.

To Reproduce
Steps to reproduce the behavior (code snippet or clear description)

Expected behavior

    public async Task SendPrintJobAsync(Dicom.Network.Client.DicomClient client, string imagePath)
    {
        var filmSession = new DicomDataset();
        filmSession.Add(DicomTag.NumberOfCopies, 1);
        filmSession.Add(DicomTag.PrintPriority, "LOW");
        filmSession.Add(DicomTag.MediumType, "BLUE FILM");
        filmSession.Add(DicomTag.FilmDestination, "PROCESSOR");

        var filmBox = new DicomDataset();
        filmBox.Add(DicomTag.ImageDisplayFormat, "STANDARD\\1,1");
        filmBox.Add(DicomTag.FilmOrientation, "PORTRAIT");
        filmBox.Add(DicomTag.FilmSizeID, "14INX17IN");
        filmBox.Add(DicomTag.MagnificationType, "REPLICATE");
        filmBox.Add(DicomTag.SmoothingType, "");
        filmBox.Add(DicomTag.BorderDensity, "BLACK");
        filmBox.Add(DicomTag.EmptyImageDensity, "BLACK");
        filmBox.Add(DicomTag.MinDensity, "0");
        filmBox.Add(DicomTag.MaxDensity, "400");
        filmBox.Add(DicomTag.Trim, "YES");
        filmBox.Add(DicomTag.ConfigurationInformation, "");

        var image = new DicomImage(imagePath);
        var bitmap = image.RenderImage().As<Bitmap>();
        var dataset = new DicomDataset();
        dataset.Add<ushort>(DicomTag.Columns, (ushort)bitmap.Width)
            .Add<ushort>(DicomTag.Rows, (ushort)bitmap.Height)
            .Add<ushort>(DicomTag.BitsAllocated, 8)
            .Add<ushort>(DicomTag.BitsStored, 8)
            .Add<ushort>(DicomTag.HighBit, 7)
            .Add(DicomTag.PixelRepresentation, (ushort)PixelRepresentation.Unsigned)
            .Add(DicomTag.PlanarConfiguration, (ushort)PlanarConfiguration.Interleaved)
            .Add<ushort>(DicomTag.SamplesPerPixel, 1)
            .Add(DicomTag.PhotometricInterpretation, PhotometricInterpretation.Monochrome2.Value);

        var pixelData = DicomPixelData.Create(dataset, true);

        var pixels = GetGrayBytes(bitmap);
        var buffer = new MemoryByteBuffer(pixels.Data);
        pixelData.AddFrame(buffer);

        var imageBox = dataset;

        try
        {
            var filmSessionUID = DicomUID.Generate();
            var createFilmSessionRequest = new DicomNCreateRequest(DicomUID.BasicFilmSession, filmSessionUID);
            createFilmSessionRequest.Dataset = filmSession;
            await client.AddRequestAsync(createFilmSessionRequest);

            var filmBoxUID = DicomUID.Generate();
            var createFilmBoxRequest = new DicomNCreateRequest(DicomUID.BasicFilmBox, filmBoxUID);
            createFilmBoxRequest.Dataset = filmBox;
            await client.AddRequestAsync(createFilmBoxRequest);

            var sopInstanceUID = DicomUID.Generate();
            var setImageBoxRequest = new DicomNSetRequest(DicomUID.BasicGrayscaleImageBox, sopInstanceUID);
            setImageBoxRequest.Dataset = imageBox;
            await client.AddRequestAsync(setImageBoxRequest);

            var printRequest = new DicomNActionRequest(DicomUID.BasicFilmSession, filmSessionUID, 1);
            await client.AddRequestAsync(printRequest);

            await client.SendAsync();

            Console.WriteLine("Print job sent successfully.");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }

Screenshots or test DICOM files
DICOM Print operation does not proceed to the end.
I added my code. Could you please comment where the problem is?

Environment
Fellow Oak DICOM version: 4.0.8
OS: Windows 10 x64
Platform: .NET Framework 4.8.2

@cslee99 cslee99 added the new label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant
0