Dicom Annotations

Questions regarding the DCMPRINT library, a DCMTK add-on that implements a DICOM Print Management SCP and SCU

Moderator: Moderator Team

Post Reply
Message
Author
santosh
Posts: 61
Joined: Tue, 2007-07-31, 09:27
Location: Bangalore (India)

Dicom Annotations

#1 Post by santosh »

Hi All,

I need to print a line on each film box, like the hospital name at the top. I made the required settings in the configuration to support the annotations. In my code i create a new film box using the api

session.setPageAnnotationDisplayFormat("1");
temp = session.createNewFilmBox();

Num_BasicFilmBox = session.countBasicFilmBoxes();
pFilmBox = session.getBasicFilmBoxes(Num_BasicFilmBox - 1);
long temp = pFilmBox->countAnnotationBoxes();
PSVModelAnnotationBox *pAnnoBox = pFilmBox->getAnnotationBoxes(1);

But here the countAnnotationBoxes returns zero annotation boxes and the getAnnotationBoxes() function fails. Please let me know were i am going wrong. My configuration file is as mentioned below.


=======================================================================
; STRUCTURE OF THIS CONFIGURATION FILE
;
; The configuration file mostly consists of entries of the form "keyword = value"
; These entries are put together in groups, which are identified by group labels
; of the form [groupname]. The multitude of options which may be contained in the
; configuration file requires additional structure. One or more groups (also called
; level-1-groups) maybe put together in a level-2-group which has the form [[groupname]].
; There are also level-3-groups of the form [[[groupname]]] which combine one or more
; level-2-groups. A configuration file may contain up to six level-3-groups with the
; names DICOM, CONFIGURATION, LAYOUTS, ANNOTATIONS, FONTS and CLIENT.
; These groups are described in detail below.
;
; KEYWORDS, GROUP NAMES AND COMMENTS
;
; Keywords and group names may be written in upper or lower case letters and
; may contain letters, digits and the special characers "_" (underscore) and
; "-" (minus). Whitespace within keywords or group names is allowed and is not
; significant. So, the following examples are equivalent forms of the level-2
; group name [[PAPERSIZE]]:
; "[[Paper Size]]",
; "[ [ paper SIZE ] ]",
; "[[PaPeRsIzE ] ]".
;
; Every entry in the configuration file must begin on the first column (no
; leading whitespace allowed). Whitespace between keyword, the "=" character
; and both before and after the value is not signifiant.
;
; Empty lines are allowed. Comments may also be included and must begin with a
; ";" character in the first column. However, comments may not be appended to
; a value on the same line.

; Every value field has a value type: BOOL, DOUBLE, INT, PSCODE OR STRING.
; - BOOL: a boolean value, written as a text string. Legal values for "true"
; are: YES, TRUE, ON, 1. Legal values for "false" are: NO, FALSE, OFF, 0.
; Case is not significant.
; - DOUBLE: a real number in the usual form, e.g. -1234.56
; - INT: an integer number in the usual form, e.g. 1234
; - PSCODE: A text string containing valid PostScript code. The print server
; can be configured to support virtually any feature of any PostScript
; device. Therefore it is necessary to include PostScript code in the
; configuration file which is used by the server to switch on certain options
; of the PostScript device (e.g. select a font or a certain paper cassette).
; At least basic knowledge of the PostScript language is absolutely required
; to write such code. However, the sample configuration files delivered with
; the print manager should provide sufficient PostScript code for most
; applications.
; PostScript procedures will often require more than one line of text.
; Therefore it is possible to write muti-line values, in which case all
; additional lines (except the first) must begin with whitespace. Example:
; setup = /Helvetica findfont
; scalefont
; setfont
; The leading space characters of the continuation lines are removed when the
; configuration file is read, but the line feeds remain.
; - STRING: A text string. Case is significant. Space characters in the string
; are not removed.
;
; MANDATORY AND OPTIONAL GROUPS AND ENTRIES
;
; Two types of groups exist: mandatory groups (which must always be present if
; the superior level group is also present) and optional groups which may or
; may not be present. The same applies for entries: Mandatory entries must
; exist and have a valid value (although for some string entries an empty
; string is a valid value). Optional entries may be omitted. If an optional
; group is present in the configuration file, all mandatory entries (or
; subgroups) of the group must also be present.
; =======================================================================


; =======================================================================
; The "DICOM" configuration section is mandatory and used both by print client
; and print server. It defines how the print server behaves in terms of the
; DICOM protocol – which services, classes and attributes are supported.
; Mandatory subsections are PRINTER, DIMSE, TCPIP and SESSION.
[[[DICOM]]]
; =======================================================================

; -----------------------------------------------------------------------
; TCP/IP settings for the print client.
[[TCPIP]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
; Default settings for the Print Server to print to.
; Can be overridden by command line parameters.
[Server]
; -----------------------------------------------------------------------

; default IP address or hostname of server
;Address = caesar
; default port number of server
;Port = 3100

; default server (called) AEtitle
;ServerAETitle= DCMPRINT_SCP

; default client (calling) AEtitle
;ClientAETitle= DCMPRINT_SCU


; -----------------------------------------------------------------------
; This section is mandatory. It defines the DICOM behaviour of the print
; server. The subsection SERVICECLASSES defines which Meta SOP Classes ("print
; services") and which optional SOP classes will be supported by the print
; server. This section can be used to enable/disable certain services.
[[DIMSE]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
; DICOM SOP Classes and Meta SOP Classes that the Print Client should
; try to negotiate. In it is usually not recommendable to negotiate both
; Basic Grayscale and Basic Color in a single association since many
; print servers will have difficulties with that.
;
; At least BasicGrayscaleMetaSOPClass or BasicColorMetaSOPClass
; must be enabled. Annotation and PrintJob are optional.
[Service Classes]
; -----------------------------------------------------------------------
BasicGrayscaleMetaSOPClass = YES
BasicColorMetaSOPClass = YES
Annotation = YES
PrintJob = YES
PresentationLUT = YES


; -----------------------------------------------------------------------
; Compatibility options that might require tweaking when talking to
; very old or poorly implemented SCPs.
[Compatibility]
; -----------------------------------------------------------------------

; Only negotiate Implicit VR Little Endian transfer syntax, default: NO
ImplicitOnly = NO

; Maximum PDU (protocol data unit) size to use when negotiating
; incoming connections. Must be between 4096 and 131072.
; Default is 16384.
MaxPDU = 32768

; Print SCU: send image data with 12 bits/pixel instead of 8 bits/pixel.
; Optional setting, default: NO
Send12BitImages = YES

; Print SCU: always include the (optional) dataset when sending an
; N-CREATE message for the basic film session. Needed on some printers
; (including the Drystar 5500) which expect this dataset to be present.
; Optional setting, default: YES
SendSessionCreateDataset = YES

; Print SCU: generate SOP instance UIDs for N-CREATE messages instead of
; allowing the SCP to generate the UIDs. Needed on some printers that expect
; SOP instance UIDs to be always present.
; Optional setting, default: YES
GenerateSOPInstanceUID = YES


; =======================================================================
; The ANNOTATIONS section is optional. It is required when the print server
; should support the optional DICOM Basic Annotation Box SOP Class.
; All subsections of this section are optional, but at least one must be
; present - otherwise the server will not allow the clients to create any
; annotations.
; Since annotations are optional in DICOM, the layout of the annotations is
; specified separately from the image/page layout.
[[[ANNOTATIONS]]]
; =======================================================================

; -----------------------------------------------------------------------
[[ANNOTATION-1]]
; -----------------------------------------------------------------------

[General]
; optional: human readable description of the annotation display format
Description = Annotations for CUSTOM-1 layout

; optional: canonical DICOM name of this annotation display format.
; Unlike the section header, this attribute value is not mangled, i.e.
; there is no uppercase conversion and space characters are not removed.
; Can be used to specify DICOM terms that would be 'destroyed' by the mangling algorithm.
; Default is the mangled value of the super-section header, without the
; "ANNOTIATION-" prefix.
CanonicalName = 1

[Line-1]
; optional: default text for annotation box at position 1
defaulttext = DICOM Sample Image

[Line-2]
; optional: default text for annotation box at position 2
defaulttext = Patient: (unnamed)


; =======================================================================
; The client reads this section in order to select the options and values
; which are offered to the user.
; The subsection PAGESIZE is mandatory, everything else is optional.
[[[CONFIGURATION]]]
; =======================================================================

; -----------------------------------------------------------------------
[[PAGE SIZE]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
; Each section defines one keyword that may be sent in Film Size ID.
; The keyword sent is identical to the keyword in brackets here after
; name mangling (conversion to uppercase, removal of space characters).
[A4]
; -----------------------------------------------------------------------

; optional: human readable description of this configuration setting
Description = Page size A4

; optional: canonical DICOM name of this page size. Unlike the section
; header, this attribute value is not mangled, i.e. there is no uppercase
; conversion and space characters are not removed. Can be used to specify
; DICOM terms that would be 'destroyed' by the mangling algorithm.
; Default is the mangled value of the section header.
CanonicalName = A4

[8INX10IN]
Description = 8x10 inch

[10INX12IN]
Description = 10x12 inch

[10INX14IN]
Description = 10x14 inch

[11INX14IN]
Description = 11x14 inch

[14INX14IN]
Description = 14x14 inch

[14INX17IN]
Description = 14x17 inch

[24CMX24CM]
Description = 24x24 cm

[24CMX30CM]
Description = 24x30 cm


; -----------------------------------------------------------------------
[[CONFIGURATION INFORMATION]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
; each section defines one keyword that may be sent in Configuration Information.
; The keyword sent is identical to the keyword in brackets here after name mangling
; (conversion to uppercase, removal of space characters).
[Spot_DiagLines]
; -----------------------------------------------------------------------

; optional: human readable description of this configuration setting
Description = Use custom halftone procedure (diagonal lines)

; optional: canonical DICOM name of this configuration setting.
; Unlike the section header, this attribute value is not mangled, i.e.
; there is no uppercase conversion and space characters are not removed.
; Can be used to specify DICOM terms that would be 'destroyed' by the
; mangling algorithm.
; Default is the mangled value of the section header.
CanonicalName = SPOT_DIAGLINES

[Spot_HorzLines]
Description = Use custom halftone procedure (horizontal lines)

[Spot_Dots]
Description = Use custom halftone procedure (dot raster)


; -----------------------------------------------------------------------
[[MEDIUM TYPE]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
; each section defines one keyword that may be sent in Medium Type.
; The keyword sent is identical to the keyword in brackets here after name mangling
; (conversion to uppercase, removal of space characters).
[PAPER]
; -----------------------------------------------------------------------

; optional: human readable description of this configuration setting
Description = Create hardcopy on paper

; optional: canonical DICOM name of this medium type. Unlike the section
; header, this attribute value is not mangled, i.e. there is no uppercase
; conversion and space characters are not removed. Can be used to specify
; DICOM terms that would be 'destroyed' by the mangling algorithm.
; Default is the mangled value of the section header.
CanonicalName = PAPER

; -----------------------------------------------------------------------
; Remember that "BLUE FILM" is mangled to "BLUEFILM" in a section header
[BLUE FILM]
; -----------------------------------------------------------------------

Description = Create hardcopy on blue film
CanonicalName = BLUE FILM


; =======================================================================
; The Layout Formats section is mandatory for both client and server. It
; defines the page layouts supported by the server.
; DICOM defines the following print layouts ("Image Display Formats"):
; STANDARD, ROW, COL, SLIDE, SUPERSLIDE and CUSTOM. Some of these layouts have
; additional parameters.
[[[LAYOUTS]]]
; =======================================================================

; -----------------------------------------------------------------------
; If this section is present, we assume the SCP supports the STANDARD\x,y
; image display format. We don't define possible combinations of rows
; and columns, though.
[[STANDARD]]
; -----------------------------------------------------------------------

[General]

; optional: human readable description of this image display format
Description = DICOM standard format

; optional: canonical DICOM name of this display format. Unlike the section
; header, this attribute value is not mangled, i.e. there is no uppercase
; conversion and space characters are not removed. Can be used to specify
; DICOM terms that would be 'destroyed' by the mangling algorithm.
; Default is the mangled value of the super-section header.
CanonicalName = STANDARD

; -----------------------------------------------------------------------
; If this section is present, we assume the SCP supports the COL\x,y,z
; image display format (which is quite unusual).
[[COL]]
; -----------------------------------------------------------------------

[General]
Description = DICOM standard column format

; -----------------------------------------------------------------------
; If this section is present, we assume the SCP supports the ROW\x,y,z
; image display format (which is quite unusual).
[[ROW]]
; -----------------------------------------------------------------------

[General]
Description = DICOM standard row format

; -----------------------------------------------------------------------
; If this section is present, we assume the SCP supports the SLIDE
; image display format (which is quite unusual).
[[SLIDE]]
; -----------------------------------------------------------------------

[General]
Description = 35mm Slides

; -----------------------------------------------------------------------
; If this section is present, we assume the SCP supports the SUPERSLIDE
; image display format (which is quite unusual).
[[SUPERSLIDE]]
; -----------------------------------------------------------------------

[General]
Description = 40mm Slides

; -----------------------------------------------------------------------
; This section defines that a proprietary image display format called
; CUSTOM\1 is supported by the printer. Generally not recommended.
[[CUSTOM-1]]
; -----------------------------------------------------------------------

[General]
Description = Custom printer layout


; =======================================================================
; The Print Client Batch Mode section is optional.
; The print client, supports a "batch mode" in which the
; user only specifies a "mode" and one or more DICOM image file names at
; command line. This section contains the definitions of the different modes.
; All subsections are optional, but at least one must be present - otherwise it
; will not be possible to use batch mode with the print client.
[[[CLIENT]]]
; =======================================================================

; -----------------------------------------------------------------------
; Each section here should be named AUTO-number where <number> is passed
; to tcpprt using the --auto command line parameter.
; Each section defines one set of parameters for batch mode operation.
[[AUTO-1]]
; -----------------------------------------------------------------------

; -----------------------------------------------------------------------
[General]
; -----------------------------------------------------------------------
; optional: human readable description of this batch mode
Description = Printserver Custom Layout, 1 image/page, collated

; optional: enable or disable collation of multiple pages (i.e. N-ACTION-RQ
; on film session level except on film box level. Default is NO.
Collation = NO

; optional: number of images (files) per page. After each film box,
; the given number of image files will be marked as "done", independent
; from the image display format used. Normally this number is computed
; automatically from the number of [IMAGE-X] sections (see below).
; This setting may be useful if multiple frames of a multi-frame image
; should be printed. Default is 0 (automatic computation).
FilesPerPage = 0


; -----------------------------------------------------------------------
; This section is optional and may be used to define values for the
; Basic Film Session.
[Session]
; -----------------------------------------------------------------------

; optional: Number of Copies. Default: don't send, use SCP default
; Copies = 1

; optional: Print Priority. Default: don't send, use SCP default.
; Possible values are LOW, MED and HIGH.
; Priority = MED

; optional: Medium Type. Default: don't send, use SCP default.
; Defined terms are "PAPER", "BLUE FILM", "CLEAR FILM".
; MediumType = PAPER

; optional: Film Destination. Default: don't send, use SCP default.
; Defined terms are "MAGAZINE", "PROCESSOR", "BIN_1", "BIN_2"...
; Destination = MAGAZINE

; optional: Film Session Label. Default: don't send, use SCP default.
; Label = MY_HARDCOPY

; -----------------------------------------------------------------------
; This section is optional and may be used to define values for the
; Presentation LUT, if the Presentation LUT SOP class is negotiated.
; Default is to use an IDENTITY LUT Shape. The Presentation LUT specified
; here is used for all film boxes.
[PresentationLUT]
; -----------------------------------------------------------------------

; optional. Type of presentation LUT. Possible values are "IDENTITY",
; "LIN OD" and "FILE". While "IDENTITY" and "LIN OD" represent LUT shapes,
; FILE means that a Presentation LUT is read from the file specified
; in PresentationLUTFile. Default is IDENTITY.
PresentationLUT = IDENTITY

; optional. Complete path to Presentation LUT File to be activated.
; Only used if PresentationLUT is FILE.
PresentationLUTFile = gamma.lut


; -----------------------------------------------------------------------
; This section is mandatory. It is used to define values for each
; Basic Film Box. At least the ImageDisplayFormat must be specified.
; Everything else is optional.
[Page]
; -----------------------------------------------------------------------

; This mandatory setting determines the Image Display Format (page layout).
ImageDisplayFormat = STANDARD\1,1

; optional: Annotation Display Format ID. Default: don't send, use SCP default.
; Possible values are totally printer specific, check conformance statement.
Annotation = 2

; optional: Orientation. Default: don't send, use SCP default.
; Possible values: PORTRAIT, LANDSCAPE
; Orientation = PORTRAIT

; optional: Film Size ID. Default: don't send, use SCP default.
; Defined terms: 8INX10IN, 8_5INX11IN, 10INX12IN, 10INX14IN, 11INX14IN, 11INX17IN
; 14INX14IN, 14INX17IN, 24CMX24CM, 24CMX30CM, A4, A3
; PageSize = 14INX17IN

; optional: Magnification Type. Default: don't send, use SCP default.
; Defined terms: REPLICATE, BILINEAR, CUBIC, NONE
; Magnification = CUBIC

; optional: Smoothing Type. Default: don't send, use SCP default.
; Possible values are totally printer specific, check conformance statement.
; Smoothing = 1

; optional: Border Density. Default: don't send, use SCP default.
; Defined terms: BLACK, WHITE or hundreds of OD ("320" => 3.2 OD)
; BorderDensity = BLACK

; optional: Empty Image Density. Default: don't send, use SCP default.
; Defined terms: BLACK, WHITE or hundreds of OD ("320" => 3.2 OD)
; EmptyImageDensity = BLACK

; optional: Trim. Default: don't send, use SCP default.
; Possible values: YES, NO.
; Trim = YES

; optional: Configuration Information. Default: don't send, use SCP default.
; possible values are defined in [[CONFIGURATION INFORMATION]] above.
; ConfigurationInformation =

; optional: minimum density. Default: don't send, use SCP default.
; Defined terms: hundreds of OD ("320" => 3.2 OD)
; MinDensity = 20

; optional: maximum density. Default: don't send, use SCP default.
; Defined terms: hundreds of OD ("320" => 3.2 OD)
; MaxDensity = 320

; optional: illumination. Default: don't send, use SCP default.
; Only used when Presentation LUT is negotiated.
; Illumination = 2000

; optional: reflected ambient light. Default: don't send, use SCP default.
; Only used when Presentation LUT is negotiated.
; ReflectedAmbientLight = 10


; -----------------------------------------------------------------------
; This section is mandatory. There must be as many [Image-X] sections as
; there are image boxes on each page (film box) of the chose image display
; format. This section defines the settings for the image box with
; Image Position 1.
[Image-1]
; -----------------------------------------------------------------------

; This entry is mandatory. It defines the order in which filenames passed
; to tcpprt on the command line are mapped to the image boxes. For an image
; display format with X images, numbers 1..X can be used, referring to the
; files of the file set chosen for the current page.
File = 1

; optional: frame number of the image file to be printed. Default is 1.
; Frame = 1

; optional: this parameter can be used to adjust the window level and width
; (i.e. apply a VOI LUT transformation) if and only if the parameters of
; the VOI are encoded in the image file, either as Window Center/Width or
; as a VOI LUT Sequence.
; The parameter only specifies the number of the transformation, in the case
; that multiple transformations are contained in the image. The index starts
; at 1 and counts all Window Center/Width pairs followed by all VOI LUT Sequence
; items.
; Default is not to apply a VOI transformation before printing the image.
; VOILUT = 1

; optional: Polarity. Default: don't send, use SCP default.
; Possible values are NORMAL, REVERSE.
; Polarity = NORMAL

; optional: Magnification Type. Default: don't send, use SCP default.
; Defined terms: REPLICATE, BILINEAR, CUBIC, NONE
; Magnification = CUBIC

; optional: Smoothing Type. Default: don't send, use SCP default.
; Possible values are totally printer specific, check conformance statement.
; Smoothing = 1

; optional: Requested Image Size. Default: don't send, use SCP default.
; Value is requested width of image in mm.
; RequestedSize = 200


; -----------------------------------------------------------------------
; This section is optional. It is required if annotation boxes of the
; optional Annotation Box SOP Class are to be used. There must be as many
; [Annotation-X] sections as there are annotations in use. This section
; defines the text for the annotation box with Annotation Position 1.
[Annotation-1]
; -----------------------------------------------------------------------

; Text to be printed within the annotation. Please note that annotations
; cannot be longer than 64 characters. The text may contain certain escape
; sequences starting with '\' that receive special handling:
; - \\ is printed as a single backslash character
; - \"a, \"o, \"u, \"A, \"O, \"U, \"s, are printed as the German umlaut
; and double-s characters
; - \000 to \377: octal escape sequences are replaced by the corresponding
; character. User should take care not to specify illegal characters for
; the DICOM data type "ST" used. Don't use escape characters, CR, LF etc.
; - \[gggg,eeee,n] refers to a DICOM attribute tag (gggg,eeee) in hexadecimal
; notation. tcpprt will replace this escape sequence with content of this
; attribute from the file used to fill image box number "n".
;Text = Patient's Name: \[0010,0010,1]


;
; $Log: tcpprt.cfg,v $
; Revision 1.4 2006/06/23 10:06:34 meichel
; Converted compile time options GENERATE_SOPINSTANCEUID and INCLUDE_DATASET for
; the print client into configuration options in the [Compatibility] section.
; Both options are active by default.
;
; Revision 1.3 2004/07/22 13:43:23 meichel
; Added support for the Presentation LUT SOP Class to the Print SCU,
; including both the interactive and the batch mode views.
;
; Revision 1.2 2004/07/19 13:40:50 meichel
; Added new set of configuration file entries that allow to specify
; canonical DICOM names that are not mangled like section headers in the
; configuration facility.
;
; Revision 1.1 2004/06/14 13:30:31 meichel
; Changed default name of tcpprt configuration file to tcpprt.cfg.
; Added sample configuration file that only contains the settings
; needed by the print client.
;
;

Thanks
Santosh S.B
Santosh S B

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1435
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

This very much depends on the DICOM printer your application is "talking" to. Not all printers support DICOM annotations at all (since this is an optional SOP class), and if they do, the strings for Annotation Display Format and their meaning is totally vendor specific - you need to check the DICOM conformance statement of the DICOM printer, and in the worst case, you are simply out of luck with this approach because the printer may not support annotations, or not on the top of the page.

This is why many DICOM workstations actually create a single, large bitmap in memory, "paint" all images and annotations into this bitmap and then send it to the printer with a simple STANDARD\1,1 layout, which is more or less guaranteed to work. This is typically an enourmous waste of memory and transmission bandwidth, but in the end more reliable because it works with every printer. One has to carefully thing about artifacts due to image scaling, though, if scaling happens both in the print client and in the print server.

santosh
Posts: 61
Joined: Tue, 2007-07-31, 09:27
Location: Bangalore (India)

#3 Post by santosh »

Thanks Marco !!!
Santosh S B

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest