packages feed

dicom (empty) → 0.1.0.0

raw patch · 11 files changed

+3237/−0 lines, 11 filesdep +basedep +binarydep +bytestringsetup-changed

Dependencies added: base, binary, bytestring, old-locale, pretty, safe, time

Files

+ LICENSE view
@@ -0,0 +1,674 @@+              GNU GENERAL PUBLIC LICENSE+                Version 3, 29 June 2007++ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>+ Everyone is permitted to copy and distribute verbatim copies+ of this license document, but changing it is not allowed.++                     Preamble++  The GNU General Public License is a free, copyleft license for+software and other kinds of works.++  The licenses for most software and other practical works are designed+to take away your freedom to share and change the works.  By contrast,+the GNU General Public License is intended to guarantee your freedom to+share and change all versions of a program--to make sure it remains free+software for all its users.  We, the Free Software Foundation, use the+GNU General Public License for most of our software; it applies also to+any other work released this way by its authors.  You can apply it to+your programs, too.++  When we speak of free software, we are referring to freedom, not+price.  Our General Public Licenses are designed to make sure that you+have the freedom to distribute copies of free software (and charge for+them if you wish), that you receive source code or can get it if you+want it, that you can change the software or use pieces of it in new+free programs, and that you know you can do these things.++  To protect your rights, we need to prevent others from denying you+these rights or asking you to surrender the rights.  Therefore, you have+certain responsibilities if you distribute copies of the software, or if+you modify it: responsibilities to respect the freedom of others.++  For example, if you distribute copies of such a program, whether+gratis or for a fee, you must pass on to the recipients the same+freedoms that you received.  You must make sure that they, too, receive+or can get the source code.  And you must show them these terms so they+know their rights.++  Developers that use the GNU GPL protect your rights with two steps:+(1) assert copyright on the software, and (2) offer you this License+giving you legal permission to copy, distribute and/or modify it.++  For the developers' and authors' protection, the GPL clearly explains+that there is no warranty for this free software.  For both users' and+authors' sake, the GPL requires that modified versions be marked as+changed, so that their problems will not be attributed erroneously to+authors of previous versions.++  Some devices are designed to deny users access to install or run+modified versions of the software inside them, although the manufacturer+can do so.  This is fundamentally incompatible with the aim of+protecting users' freedom to change the software.  The systematic+pattern of such abuse occurs in the area of products for individuals to+use, which is precisely where it is most unacceptable.  Therefore, we+have designed this version of the GPL to prohibit the practice for those+products.  If such problems arise substantially in other domains, we+stand ready to extend this provision to those domains in future versions+of the GPL, as needed to protect the freedom of users.++  Finally, every program is threatened constantly by software patents.+States should not allow patents to restrict development and use of+software on general-purpose computers, but in those that do, we wish to+avoid the special danger that patents applied to a free program could+make it effectively proprietary.  To prevent this, the GPL assures that+patents cannot be used to render the program non-free.++  The precise terms and conditions for copying, distribution and+modification follow.++                TERMS AND CONDITIONS++  0. Definitions.++  "This License" refers to version 3 of the GNU General Public License.++  "Copyright" also means copyright-like laws that apply to other kinds of+works, such as semiconductor masks.++  "The Program" refers to any copyrightable work licensed under this+License.  Each licensee is addressed as "you".  "Licensees" and+"recipients" may be individuals or organizations.++  To "modify" a work means to copy from or adapt all or part of the work+in a fashion requiring copyright permission, other than the making of an+exact copy.  The resulting work is called a "modified version" of the+earlier work or a work "based on" the earlier work.++  A "covered work" means either the unmodified Program or a work based+on the Program.++  To "propagate" a work means to do anything with it that, without+permission, would make you directly or secondarily liable for+infringement under applicable copyright law, except executing it on a+computer or modifying a private copy.  Propagation includes copying,+distribution (with or without modification), making available to the+public, and in some countries other activities as well.++  To "convey" a work means any kind of propagation that enables other+parties to make or receive copies.  Mere interaction with a user through+a computer network, with no transfer of a copy, is not conveying.++  An interactive user interface displays "Appropriate Legal Notices"+to the extent that it includes a convenient and prominently visible+feature that (1) displays an appropriate copyright notice, and (2)+tells the user that there is no warranty for the work (except to the+extent that warranties are provided), that licensees may convey the+work under this License, and how to view a copy of this License.  If+the interface presents a list of user commands or options, such as a+menu, a prominent item in the list meets this criterion.++  1. Source Code.++  The "source code" for a work means the preferred form of the work+for making modifications to it.  "Object code" means any non-source+form of a work.++  A "Standard Interface" means an interface that either is an official+standard defined by a recognized standards body, or, in the case of+interfaces specified for a particular programming language, one that+is widely used among developers working in that language.++  The "System Libraries" of an executable work include anything, other+than the work as a whole, that (a) is included in the normal form of+packaging a Major Component, but which is not part of that Major+Component, and (b) serves only to enable use of the work with that+Major Component, or to implement a Standard Interface for which an+implementation is available to the public in source code form.  A+"Major Component", in this context, means a major essential component+(kernel, window system, and so on) of the specific operating system+(if any) on which the executable work runs, or a compiler used to+produce the work, or an object code interpreter used to run it.++  The "Corresponding Source" for a work in object code form means all+the source code needed to generate, install, and (for an executable+work) run the object code and to modify the work, including scripts to+control those activities.  However, it does not include the work's+System Libraries, or general-purpose tools or generally available free+programs which are used unmodified in performing those activities but+which are not part of the work.  For example, Corresponding Source+includes interface definition files associated with source files for+the work, and the source code for shared libraries and dynamically+linked subprograms that the work is specifically designed to require,+such as by intimate data communication or control flow between those+subprograms and other parts of the work.++  The Corresponding Source need not include anything that users+can regenerate automatically from other parts of the Corresponding+Source.++  The Corresponding Source for a work in source code form is that+same work.++  2. Basic Permissions.++  All rights granted under this License are granted for the term of+copyright on the Program, and are irrevocable provided the stated+conditions are met.  This License explicitly affirms your unlimited+permission to run the unmodified Program.  The output from running a+covered work is covered by this License only if the output, given its+content, constitutes a covered work.  This License acknowledges your+rights of fair use or other equivalent, as provided by copyright law.++  You may make, run and propagate covered works that you do not+convey, without conditions so long as your license otherwise remains+in force.  You may convey covered works to others for the sole purpose+of having them make modifications exclusively for you, or provide you+with facilities for running those works, provided that you comply with+the terms of this License in conveying all material for which you do+not control copyright.  Those thus making or running the covered works+for you must do so exclusively on your behalf, under your direction+and control, on terms that prohibit them from making any copies of+your copyrighted material outside their relationship with you.++  Conveying under any other circumstances is permitted solely under+the conditions stated below.  Sublicensing is not allowed; section 10+makes it unnecessary.++  3. Protecting Users' Legal Rights From Anti-Circumvention Law.++  No covered work shall be deemed part of an effective technological+measure under any applicable law fulfilling obligations under article+11 of the WIPO copyright treaty adopted on 20 December 1996, or+similar laws prohibiting or restricting circumvention of such+measures.++  When you convey a covered work, you waive any legal power to forbid+circumvention of technological measures to the extent such circumvention+is effected by exercising rights under this License with respect to+the covered work, and you disclaim any intention to limit operation or+modification of the work as a means of enforcing, against the work's+users, your or third parties' legal rights to forbid circumvention of+technological measures.++  4. Conveying Verbatim Copies.++  You may convey verbatim copies of the Program's source code as you+receive it, in any medium, provided that you conspicuously and+appropriately publish on each copy an appropriate copyright notice;+keep intact all notices stating that this License and any+non-permissive terms added in accord with section 7 apply to the code;+keep intact all notices of the absence of any warranty; and give all+recipients a copy of this License along with the Program.++  You may charge any price or no price for each copy that you convey,+and you may offer support or warranty protection for a fee.++  5. Conveying Modified Source Versions.++  You may convey a work based on the Program, or the modifications to+produce it from the Program, in the form of source code under the+terms of section 4, provided that you also meet all of these conditions:++    a) The work must carry prominent notices stating that you modified+    it, and giving a relevant date.++    b) The work must carry prominent notices stating that it is+    released under this License and any conditions added under section+    7.  This requirement modifies the requirement in section 4 to+    "keep intact all notices".++    c) You must license the entire work, as a whole, under this+    License to anyone who comes into possession of a copy.  This+    License will therefore apply, along with any applicable section 7+    additional terms, to the whole of the work, and all its parts,+    regardless of how they are packaged.  This License gives no+    permission to license the work in any other way, but it does not+    invalidate such permission if you have separately received it.++    d) If the work has interactive user interfaces, each must display+    Appropriate Legal Notices; however, if the Program has interactive+    interfaces that do not display Appropriate Legal Notices, your+    work need not make them do so.++  A compilation of a covered work with other separate and independent+works, which are not by their nature extensions of the covered work,+and which are not combined with it such as to form a larger program,+in or on a volume of a storage or distribution medium, is called an+"aggregate" if the compilation and its resulting copyright are not+used to limit the access or legal rights of the compilation's users+beyond what the individual works permit.  Inclusion of a covered work+in an aggregate does not cause this License to apply to the other+parts of the aggregate.++  6. Conveying Non-Source Forms.++  You may convey a covered work in object code form under the terms+of sections 4 and 5, provided that you also convey the+machine-readable Corresponding Source under the terms of this License,+in one of these ways:++    a) Convey the object code in, or embodied in, a physical product+    (including a physical distribution medium), accompanied by the+    Corresponding Source fixed on a durable physical medium+    customarily used for software interchange.++    b) Convey the object code in, or embodied in, a physical product+    (including a physical distribution medium), accompanied by a+    written offer, valid for at least three years and valid for as+    long as you offer spare parts or customer support for that product+    model, to give anyone who possesses the object code either (1) a+    copy of the Corresponding Source for all the software in the+    product that is covered by this License, on a durable physical+    medium customarily used for software interchange, for a price no+    more than your reasonable cost of physically performing this+    conveying of source, or (2) access to copy the+    Corresponding Source from a network server at no charge.++    c) Convey individual copies of the object code with a copy of the+    written offer to provide the Corresponding Source.  This+    alternative is allowed only occasionally and noncommercially, and+    only if you received the object code with such an offer, in accord+    with subsection 6b.++    d) Convey the object code by offering access from a designated+    place (gratis or for a charge), and offer equivalent access to the+    Corresponding Source in the same way through the same place at no+    further charge.  You need not require recipients to copy the+    Corresponding Source along with the object code.  If the place to+    copy the object code is a network server, the Corresponding Source+    may be on a different server (operated by you or a third party)+    that supports equivalent copying facilities, provided you maintain+    clear directions next to the object code saying where to find the+    Corresponding Source.  Regardless of what server hosts the+    Corresponding Source, you remain obligated to ensure that it is+    available for as long as needed to satisfy these requirements.++    e) Convey the object code using peer-to-peer transmission, provided+    you inform other peers where the object code and Corresponding+    Source of the work are being offered to the general public at no+    charge under subsection 6d.++  A separable portion of the object code, whose source code is excluded+from the Corresponding Source as a System Library, need not be+included in conveying the object code work.++  A "User Product" is either (1) a "consumer product", which means any+tangible personal property which is normally used for personal, family,+or household purposes, or (2) anything designed or sold for incorporation+into a dwelling.  In determining whether a product is a consumer product,+doubtful cases shall be resolved in favor of coverage.  For a particular+product received by a particular user, "normally used" refers to a+typical or common use of that class of product, regardless of the status+of the particular user or of the way in which the particular user+actually uses, or expects or is expected to use, the product.  A product+is a consumer product regardless of whether the product has substantial+commercial, industrial or non-consumer uses, unless such uses represent+the only significant mode of use of the product.++  "Installation Information" for a User Product means any methods,+procedures, authorization keys, or other information required to install+and execute modified versions of a covered work in that User Product from+a modified version of its Corresponding Source.  The information must+suffice to ensure that the continued functioning of the modified object+code is in no case prevented or interfered with solely because+modification has been made.++  If you convey an object code work under this section in, or with, or+specifically for use in, a User Product, and the conveying occurs as+part of a transaction in which the right of possession and use of the+User Product is transferred to the recipient in perpetuity or for a+fixed term (regardless of how the transaction is characterized), the+Corresponding Source conveyed under this section must be accompanied+by the Installation Information.  But this requirement does not apply+if neither you nor any third party retains the ability to install+modified object code on the User Product (for example, the work has+been installed in ROM).++  The requirement to provide Installation Information does not include a+requirement to continue to provide support service, warranty, or updates+for a work that has been modified or installed by the recipient, or for+the User Product in which it has been modified or installed.  Access to a+network may be denied when the modification itself materially and+adversely affects the operation of the network or violates the rules and+protocols for communication across the network.++  Corresponding Source conveyed, and Installation Information provided,+in accord with this section must be in a format that is publicly+documented (and with an implementation available to the public in+source code form), and must require no special password or key for+unpacking, reading or copying.++  7. Additional Terms.++  "Additional permissions" are terms that supplement the terms of this+License by making exceptions from one or more of its conditions.+Additional permissions that are applicable to the entire Program shall+be treated as though they were included in this License, to the extent+that they are valid under applicable law.  If additional permissions+apply only to part of the Program, that part may be used separately+under those permissions, but the entire Program remains governed by+this License without regard to the additional permissions.++  When you convey a copy of a covered work, you may at your option+remove any additional permissions from that copy, or from any part of+it.  (Additional permissions may be written to require their own+removal in certain cases when you modify the work.)  You may place+additional permissions on material, added by you to a covered work,+for which you have or can give appropriate copyright permission.++  Notwithstanding any other provision of this License, for material you+add to a covered work, you may (if authorized by the copyright holders of+that material) supplement the terms of this License with terms:++    a) Disclaiming warranty or limiting liability differently from the+    terms of sections 15 and 16 of this License; or++    b) Requiring preservation of specified reasonable legal notices or+    author attributions in that material or in the Appropriate Legal+    Notices displayed by works containing it; or++    c) Prohibiting misrepresentation of the origin of that material, or+    requiring that modified versions of such material be marked in+    reasonable ways as different from the original version; or++    d) Limiting the use for publicity purposes of names of licensors or+    authors of the material; or++    e) Declining to grant rights under trademark law for use of some+    trade names, trademarks, or service marks; or++    f) Requiring indemnification of licensors and authors of that+    material by anyone who conveys the material (or modified versions of+    it) with contractual assumptions of liability to the recipient, for+    any liability that these contractual assumptions directly impose on+    those licensors and authors.++  All other non-permissive additional terms are considered "further+restrictions" within the meaning of section 10.  If the Program as you+received it, or any part of it, contains a notice stating that it is+governed by this License along with a term that is a further+restriction, you may remove that term.  If a license document contains+a further restriction but permits relicensing or conveying under this+License, you may add to a covered work material governed by the terms+of that license document, provided that the further restriction does+not survive such relicensing or conveying.++  If you add terms to a covered work in accord with this section, you+must place, in the relevant source files, a statement of the+additional terms that apply to those files, or a notice indicating+where to find the applicable terms.++  Additional terms, permissive or non-permissive, may be stated in the+form of a separately written license, or stated as exceptions;+the above requirements apply either way.++  8. Termination.++  You may not propagate or modify a covered work except as expressly+provided under this License.  Any attempt otherwise to propagate or+modify it is void, and will automatically terminate your rights under+this License (including any patent licenses granted under the third+paragraph of section 11).++  However, if you cease all violation of this License, then your+license from a particular copyright holder is reinstated (a)+provisionally, unless and until the copyright holder explicitly and+finally terminates your license, and (b) permanently, if the copyright+holder fails to notify you of the violation by some reasonable means+prior to 60 days after the cessation.++  Moreover, your license from a particular copyright holder is+reinstated permanently if the copyright holder notifies you of the+violation by some reasonable means, this is the first time you have+received notice of violation of this License (for any work) from that+copyright holder, and you cure the violation prior to 30 days after+your receipt of the notice.++  Termination of your rights under this section does not terminate the+licenses of parties who have received copies or rights from you under+this License.  If your rights have been terminated and not permanently+reinstated, you do not qualify to receive new licenses for the same+material under section 10.++  9. Acceptance Not Required for Having Copies.++  You are not required to accept this License in order to receive or+run a copy of the Program.  Ancillary propagation of a covered work+occurring solely as a consequence of using peer-to-peer transmission+to receive a copy likewise does not require acceptance.  However,+nothing other than this License grants you permission to propagate or+modify any covered work.  These actions infringe copyright if you do+not accept this License.  Therefore, by modifying or propagating a+covered work, you indicate your acceptance of this License to do so.++  10. Automatic Licensing of Downstream Recipients.++  Each time you convey a covered work, the recipient automatically+receives a license from the original licensors, to run, modify and+propagate that work, subject to this License.  You are not responsible+for enforcing compliance by third parties with this License.++  An "entity transaction" is a transaction transferring control of an+organization, or substantially all assets of one, or subdividing an+organization, or merging organizations.  If propagation of a covered+work results from an entity transaction, each party to that+transaction who receives a copy of the work also receives whatever+licenses to the work the party's predecessor in interest had or could+give under the previous paragraph, plus a right to possession of the+Corresponding Source of the work from the predecessor in interest, if+the predecessor has it or can get it with reasonable efforts.++  You may not impose any further restrictions on the exercise of the+rights granted or affirmed under this License.  For example, you may+not impose a license fee, royalty, or other charge for exercise of+rights granted under this License, and you may not initiate litigation+(including a cross-claim or counterclaim in a lawsuit) alleging that+any patent claim is infringed by making, using, selling, offering for+sale, or importing the Program or any portion of it.++  11. Patents.++  A "contributor" is a copyright holder who authorizes use under this+License of the Program or a work on which the Program is based.  The+work thus licensed is called the contributor's "contributor version".++  A contributor's "essential patent claims" are all patent claims+owned or controlled by the contributor, whether already acquired or+hereafter acquired, that would be infringed by some manner, permitted+by this License, of making, using, or selling its contributor version,+but do not include claims that would be infringed only as a+consequence of further modification of the contributor version.  For+purposes of this definition, "control" includes the right to grant+patent sublicenses in a manner consistent with the requirements of+this License.++  Each contributor grants you a non-exclusive, worldwide, royalty-free+patent license under the contributor's essential patent claims, to+make, use, sell, offer for sale, import and otherwise run, modify and+propagate the contents of its contributor version.++  In the following three paragraphs, a "patent license" is any express+agreement or commitment, however denominated, not to enforce a patent+(such as an express permission to practice a patent or covenant not to+sue for patent infringement).  To "grant" such a patent license to a+party means to make such an agreement or commitment not to enforce a+patent against the party.++  If you convey a covered work, knowingly relying on a patent license,+and the Corresponding Source of the work is not available for anyone+to copy, free of charge and under the terms of this License, through a+publicly available network server or other readily accessible means,+then you must either (1) cause the Corresponding Source to be so+available, or (2) arrange to deprive yourself of the benefit of the+patent license for this particular work, or (3) arrange, in a manner+consistent with the requirements of this License, to extend the patent+license to downstream recipients.  "Knowingly relying" means you have+actual knowledge that, but for the patent license, your conveying the+covered work in a country, or your recipient's use of the covered work+in a country, would infringe one or more identifiable patents in that+country that you have reason to believe are valid.++  If, pursuant to or in connection with a single transaction or+arrangement, you convey, or propagate by procuring conveyance of, a+covered work, and grant a patent license to some of the parties+receiving the covered work authorizing them to use, propagate, modify+or convey a specific copy of the covered work, then the patent license+you grant is automatically extended to all recipients of the covered+work and works based on it.++  A patent license is "discriminatory" if it does not include within+the scope of its coverage, prohibits the exercise of, or is+conditioned on the non-exercise of one or more of the rights that are+specifically granted under this License.  You may not convey a covered+work if you are a party to an arrangement with a third party that is+in the business of distributing software, under which you make payment+to the third party based on the extent of your activity of conveying+the work, and under which the third party grants, to any of the+parties who would receive the covered work from you, a discriminatory+patent license (a) in connection with copies of the covered work+conveyed by you (or copies made from those copies), or (b) primarily+for and in connection with specific products or compilations that+contain the covered work, unless you entered into that arrangement,+or that patent license was granted, prior to 28 March 2007.++  Nothing in this License shall be construed as excluding or limiting+any implied license or other defenses to infringement that may+otherwise be available to you under applicable patent law.++  12. No Surrender of Others' Freedom.++  If conditions are imposed on you (whether by court order, agreement or+otherwise) that contradict the conditions of this License, they do not+excuse you from the conditions of this License.  If you cannot convey a+covered work so as to satisfy simultaneously your obligations under this+License and any other pertinent obligations, then as a consequence you may+not convey it at all.  For example, if you agree to terms that obligate you+to collect a royalty for further conveying from those to whom you convey+the Program, the only way you could satisfy both those terms and this+License would be to refrain entirely from conveying the Program.++  13. Use with the GNU Affero General Public License.++  Notwithstanding any other provision of this License, you have+permission to link or combine any covered work with a work licensed+under version 3 of the GNU Affero General Public License into a single+combined work, and to convey the resulting work.  The terms of this+License will continue to apply to the part which is the covered work,+but the special requirements of the GNU Affero General Public License,+section 13, concerning interaction through a network will apply to the+combination as such.++  14. Revised Versions of this License.++  The Free Software Foundation may publish revised and/or new versions of+the GNU General Public License from time to time.  Such new versions will+be similar in spirit to the present version, but may differ in detail to+address new problems or concerns.++  Each version is given a distinguishing version number.  If the+Program specifies that a certain numbered version of the GNU General+Public License "or any later version" applies to it, you have the+option of following the terms and conditions either of that numbered+version or of any later version published by the Free Software+Foundation.  If the Program does not specify a version number of the+GNU General Public License, you may choose any version ever published+by the Free Software Foundation.++  If the Program specifies that a proxy can decide which future+versions of the GNU General Public License can be used, that proxy's+public statement of acceptance of a version permanently authorizes you+to choose that version for the Program.++  Later license versions may give you additional or different+permissions.  However, no additional obligations are imposed on any+author or copyright holder as a result of your choosing to follow a+later version.++  15. Disclaimer of Warranty.++  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.++  16. Limitation of Liability.++  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF+SUCH DAMAGES.++  17. Interpretation of Sections 15 and 16.++  If the disclaimer of warranty and limitation of liability provided+above cannot be given local legal effect according to their terms,+reviewing courts shall apply local law that most closely approximates+an absolute waiver of all civil liability in connection with the+Program, unless a warranty or assumption of liability accompanies a+copy of the Program in return for a fee.++              END OF TERMS AND CONDITIONS++     How to Apply These Terms to Your New Programs++  If you develop a new program, and you want it to be of the greatest+possible use to the public, the best way to achieve this is to make it+free software which everyone can redistribute and change under these terms.++  To do so, attach the following notices to the program.  It is safest+to attach them to the start of each source file to most effectively+state the exclusion of warranty; and each file should have at least+the "copyright" line and a pointer to where the full notice is found.++    <one line to give the program's name and a brief idea of what it does.>+    Copyright (C) <year>  <name of author>++    This program is free software: you can redistribute it and/or modify+    it under the terms of the GNU General Public License as published by+    the Free Software Foundation, either version 3 of the License, or+    (at your option) any later version.++    This program is distributed in the hope that it will be useful,+    but WITHOUT ANY WARRANTY; without even the implied warranty of+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+    GNU General Public License for more details.++    You should have received a copy of the GNU General Public License+    along with this program.  If not, see <http://www.gnu.org/licenses/>.++Also add information on how to contact you by electronic and paper mail.++  If the program does terminal interaction, make it output a short+notice like this when it starts in an interactive mode:++    <program>  Copyright (C) <year>  <name of author>+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.+    This is free software, and you are welcome to redistribute it+    under certain conditions; type `show c' for details.++The hypothetical commands `show w' and `show c' should show the appropriate+parts of the General Public License.  Of course, your program's commands+might be different; for a GUI interface, you would use an "about box".++  You should also get your employer (if you work as a programmer) or school,+if any, to sign a "copyright disclaimer" for the program, if necessary.+For more information on this, and how to apply and follow the GNU GPL, see+<http://www.gnu.org/licenses/>.++  The GNU General Public License does not permit incorporating your program+into proprietary programs.  If your program is a subroutine library, you+may consider it more useful to permit linking proprietary applications with+the library.  If this is what you want to do, use the GNU Lesser General+Public License instead of this License.  But first, please read+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ dicom.cabal view
@@ -0,0 +1,30 @@+name:                dicom+version:             0.1.0.0+synopsis:            A library for reading and writing DICOM files in the Explicit VR Little Endian transfer syntax.+license:             GPL-3+license-file:        LICENSE+author:              Phil Freeman+maintainer:          paf31@cantab.net+copyright:           (c) DICOM Grid Inc. 2015 +category:            Data, Medical+build-type:          Simple+cabal-version:       >=1.10++library+  exposed-modules:     Data.DICOM, +                       Data.DICOM.Dictionary, +                       Data.DICOM.FileMetaInformation, +                       Data.DICOM.Object, +                       Data.DICOM.Pretty,+                       Data.DICOM.Tag, +                       Data.DICOM.VL, +                       Data.DICOM.VR+  build-depends:       base >=4.7 && <4.8, +                       time >=1.4 && <1.5, +                       bytestring >=0.10 && <0.11, +                       binary >=0.7 && <0.8, +                       old-locale >=1.0 && <1.1, +                       pretty >=1.1 && <1.2, +                       safe >=0.3 && <0.4+  hs-source-dirs:      src+  default-language:    Haskell98
+ src/Data/DICOM.hs view
@@ -0,0 +1,22 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-- | A library for reading and writing DICOM files in the explicit-VR+-- | little-endian transfer syntax.+--+-----------------------------------------------------------------------------++module Data.DICOM (module D) where++import Data.DICOM.VL     as D+import Data.DICOM.VR     as D+import Data.DICOM.Tag    as D+import Data.DICOM.Object as D+import Data.DICOM.Pretty as D
+ src/Data/DICOM/Dictionary.hs view
@@ -0,0 +1,1865 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.Dictionary+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-- | A dictionary of DICOM tags+--+-----------------------------------------------------------------------------++module Data.DICOM.Dictionary where++import Data.DICOM.Tag+import Data.DICOM.Object++import Data.Time.Clock (UTCTime)++import qualified Data.ByteString as B++group0002length :: B.ByteString -> Element+group0002length = ul $ tag (TagGroup 0x0002) (TagElement 0x0000)++filemetainformationversion :: B.ByteString -> Element+filemetainformationversion = ob $ tag (TagGroup 0x0002) (TagElement 0x0001)++mediastoredsopclassuid :: String -> Element+mediastoredsopclassuid = ui $ tag (TagGroup 0x0002) (TagElement 0x0002)++mediastoredsopinstanceuid :: String -> Element+mediastoredsopinstanceuid = ui $ tag (TagGroup 0x0002) (TagElement 0x0003)++transfersyntaxuid :: String -> Element+transfersyntaxuid = ui $ tag (TagGroup 0x0002) (TagElement 0x0010)++implementationclassuid :: String -> Element+implementationclassuid = ui $ tag (TagGroup 0x0002) (TagElement 0x0012)++implementationversionname :: String -> Element+implementationversionname = sh $ tag (TagGroup 0x0002) (TagElement 0x0013)++sourceapplicationentitytitle :: String -> Element+sourceapplicationentitytitle = ae $ tag (TagGroup 0x0002) (TagElement 0x0016)++privateinformationcreatoruid :: String -> Element+privateinformationcreatoruid = ui $ tag (TagGroup 0x0002) (TagElement 0x0100)++privateinformation :: B.ByteString -> Element+privateinformation = ob $ tag (TagGroup 0x0002) (TagElement 0x0102)++group0004length :: B.ByteString -> Element+group0004length = ul $ tag (TagGroup 0x0004) (TagElement 0x0000)++filesetid :: String -> Element+filesetid = cs $ tag (TagGroup 0x0004) (TagElement 0x1130)++filesetdescriptorfilefileid :: String -> Element+filesetdescriptorfilefileid = cs $ tag (TagGroup 0x0004) (TagElement 0x1141)++filesetdescriptorfileformat :: String -> Element+filesetdescriptorfileformat = cs $ tag (TagGroup 0x0004) (TagElement 0x1142)++rootdirectoryentitysfirstdirectoryrecordoffset :: B.ByteString -> Element+rootdirectoryentitysfirstdirectoryrecordoffset = ul $ tag (TagGroup 0x0004) (TagElement 0x1200)++rootdirectoryentityslastdirectoryrecordoffset :: B.ByteString -> Element+rootdirectoryentityslastdirectoryrecordoffset = ul $ tag (TagGroup 0x0004) (TagElement 0x1202)++filesetconsistenceflag :: B.ByteString -> Element+filesetconsistenceflag = us $ tag (TagGroup 0x0004) (TagElement 0x1212)++directoryrecordsequence :: [SequenceItem] -> Element+directoryrecordsequence = sq $ tag (TagGroup 0x0004) (TagElement 0x1220)++nextdirectoryrecordoffset :: B.ByteString -> Element+nextdirectoryrecordoffset = ul $ tag (TagGroup 0x0004) (TagElement 0x1400)++recordinuseflag :: B.ByteString -> Element+recordinuseflag = us $ tag (TagGroup 0x0004) (TagElement 0x1410)++referencedlowerleveldirectoryentityoffset :: B.ByteString -> Element+referencedlowerleveldirectoryentityoffset = ul $ tag (TagGroup 0x0004) (TagElement 0x1420)++directoryrecordtype :: String -> Element+directoryrecordtype = cs $ tag (TagGroup 0x0004) (TagElement 0x1430)++privaterecorduid :: String -> Element+privaterecorduid = ui $ tag (TagGroup 0x0004) (TagElement 0x1432)++referencedfileid :: String -> Element+referencedfileid = cs $ tag (TagGroup 0x0004) (TagElement 0x1500)++referencedsopclassuidinfile :: String -> Element+referencedsopclassuidinfile = ui $ tag (TagGroup 0x0004) (TagElement 0x1510)++referencedsopinstanceuidinfile :: String -> Element+referencedsopinstanceuidinfile = ui $ tag (TagGroup 0x0004) (TagElement 0x1511)++numberofreferences :: B.ByteString -> Element+numberofreferences = ul $ tag (TagGroup 0x0004) (TagElement 0x1600)++group0008length :: B.ByteString -> Element+group0008length = ul $ tag (TagGroup 0x0008) (TagElement 0x0000)++group0008lengthtoendret :: B.ByteString -> Element+group0008lengthtoendret = ul $ tag (TagGroup 0x0008) (TagElement 0x0001)++specificcharacterset :: String -> Element+specificcharacterset = cs $ tag (TagGroup 0x0008) (TagElement 0x0005)++imagetype :: String -> Element+imagetype = cs $ tag (TagGroup 0x0008) (TagElement 0x0008)++recognitioncoderet :: String -> Element+recognitioncoderet = sh $ tag (TagGroup 0x0008) (TagElement 0x0010)++instancecreationdate :: UTCTime -> Element+instancecreationdate = da $ tag (TagGroup 0x0008) (TagElement 0x0012)++instancecreationtime :: UTCTime -> Element+instancecreationtime = tm $ tag (TagGroup 0x0008) (TagElement 0x0013)++instancecreatoruid :: String -> Element+instancecreatoruid = ui $ tag (TagGroup 0x0008) (TagElement 0x0014)++sopclassuid :: String -> Element+sopclassuid = ui $ tag (TagGroup 0x0008) (TagElement 0x0016)++sopinstanceuid :: String -> Element+sopinstanceuid = ui $ tag (TagGroup 0x0008) (TagElement 0x0018)++studydate :: UTCTime -> Element+studydate = da $ tag (TagGroup 0x0008) (TagElement 0x0020)++seriesdate :: UTCTime -> Element+seriesdate = da $ tag (TagGroup 0x0008) (TagElement 0x0021)++acquisitiondate :: UTCTime -> Element+acquisitiondate = da $ tag (TagGroup 0x0008) (TagElement 0x0022)++imagedate :: UTCTime -> Element+imagedate = da $ tag (TagGroup 0x0008) (TagElement 0x0023)++overlaydate :: UTCTime -> Element+overlaydate = da $ tag (TagGroup 0x0008) (TagElement 0x0024)++curvedate :: UTCTime -> Element+curvedate = da $ tag (TagGroup 0x0008) (TagElement 0x0025)++studytime :: UTCTime -> Element+studytime = tm $ tag (TagGroup 0x0008) (TagElement 0x0030)++seriestime :: UTCTime -> Element+seriestime = tm $ tag (TagGroup 0x0008) (TagElement 0x0031)++acquisitiontime :: UTCTime -> Element+acquisitiontime = tm $ tag (TagGroup 0x0008) (TagElement 0x0032)++imagetime :: UTCTime -> Element+imagetime = tm $ tag (TagGroup 0x0008) (TagElement 0x0033)++overlaytime :: UTCTime -> Element+overlaytime = tm $ tag (TagGroup 0x0008) (TagElement 0x0034)++curvetime :: UTCTime -> Element+curvetime = tm $ tag (TagGroup 0x0008) (TagElement 0x0035)++datasettyperet :: B.ByteString -> Element+datasettyperet = us $ tag (TagGroup 0x0008) (TagElement 0x0040)++datasetsubtyperet :: String -> Element+datasetsubtyperet = sh $ tag (TagGroup 0x0008) (TagElement 0x0041)++nuclearmedicineseriestype :: String -> Element+nuclearmedicineseriestype = cs $ tag (TagGroup 0x0008) (TagElement 0x0042)++accessionnumber :: String -> Element+accessionnumber = sh $ tag (TagGroup 0x0008) (TagElement 0x0050)++queryretrievelevel :: String -> Element+queryretrievelevel = cs $ tag (TagGroup 0x0008) (TagElement 0x0052)++retrieveaetitle :: String -> Element+retrieveaetitle = ae $ tag (TagGroup 0x0008) (TagElement 0x0054)++failedsopinstanceuidlist :: String -> Element+failedsopinstanceuidlist = ae $ tag (TagGroup 0x0008) (TagElement 0x0058)++modality :: String -> Element+modality = cs $ tag (TagGroup 0x0008) (TagElement 0x0060)++conversiontype :: String -> Element+conversiontype = cs $ tag (TagGroup 0x0008) (TagElement 0x0064)++manufacturer :: String -> Element+manufacturer = lo $ tag (TagGroup 0x0008) (TagElement 0x0070)++institutionname :: String -> Element+institutionname = lo $ tag (TagGroup 0x0008) (TagElement 0x0080)++institutionaddress :: B.ByteString -> Element+institutionaddress = st $ tag (TagGroup 0x0008) (TagElement 0x0081)++institutioncodesequence :: [SequenceItem] -> Element+institutioncodesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x0082)++referringphysiciansname :: String -> Element+referringphysiciansname = pn $ tag (TagGroup 0x0008) (TagElement 0x0090)++referringphysiciansaddress :: B.ByteString -> Element+referringphysiciansaddress = st $ tag (TagGroup 0x0008) (TagElement 0x0092)++referringphysicianstelephonenumbers :: String -> Element+referringphysicianstelephonenumbers = sh $ tag (TagGroup 0x0008) (TagElement 0x0094)++codevalue :: String -> Element+codevalue = sh $ tag (TagGroup 0x0008) (TagElement 0x0100)++codingschemedesignator :: String -> Element+codingschemedesignator = sh $ tag (TagGroup 0x0008) (TagElement 0x0102)++codemeaning :: String -> Element+codemeaning = lo $ tag (TagGroup 0x0008) (TagElement 0x0104)++networkidret :: String -> Element+networkidret = sh $ tag (TagGroup 0x0008) (TagElement 0x1000)++stationname :: String -> Element+stationname = sh $ tag (TagGroup 0x0008) (TagElement 0x1010)++studydescription :: String -> Element+studydescription = lo $ tag (TagGroup 0x0008) (TagElement 0x1030)++procedurecodesequence :: [SequenceItem] -> Element+procedurecodesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1032)++seriesdescription :: String -> Element+seriesdescription = lo $ tag (TagGroup 0x0008) (TagElement 0x103E)++institutionaldepartmentname :: String -> Element+institutionaldepartmentname = lo $ tag (TagGroup 0x0008) (TagElement 0x1040)++attendingphysiciansname :: String -> Element+attendingphysiciansname = pn $ tag (TagGroup 0x0008) (TagElement 0x1050)++nameofphysiciansreadingstudy :: String -> Element+nameofphysiciansreadingstudy = pn $ tag (TagGroup 0x0008) (TagElement 0x1060)++operatorsname :: String -> Element+operatorsname = pn $ tag (TagGroup 0x0008) (TagElement 0x1070)++admittingdiagnosesdescription :: String -> Element+admittingdiagnosesdescription = lo $ tag (TagGroup 0x0008) (TagElement 0x1080)++admittingdiagnosiscodesequence :: [SequenceItem] -> Element+admittingdiagnosiscodesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1084)++manufacturersmodelname :: String -> Element+manufacturersmodelname = lo $ tag (TagGroup 0x0008) (TagElement 0x1090)++referencedresultssequence :: [SequenceItem] -> Element+referencedresultssequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1100)++referencedstudysequence :: [SequenceItem] -> Element+referencedstudysequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1110)++referencedstudycomponentsequence :: [SequenceItem] -> Element+referencedstudycomponentsequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1111)++referencedseriessequence :: [SequenceItem] -> Element+referencedseriessequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1115)++referencedpatientsequence :: [SequenceItem] -> Element+referencedpatientsequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1120)++referencedvisitsequence :: [SequenceItem] -> Element+referencedvisitsequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1125)++referencedoverlaysequence :: [SequenceItem] -> Element+referencedoverlaysequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1130)++referencedimagesequence :: [SequenceItem] -> Element+referencedimagesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1140)++referencedcurvesequence :: [SequenceItem] -> Element+referencedcurvesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1145)++referencedsopclassuid :: String -> Element+referencedsopclassuid = ui $ tag (TagGroup 0x0008) (TagElement 0x1150)++referencedsopinstanceuid :: String -> Element+referencedsopinstanceuid = ui $ tag (TagGroup 0x0008) (TagElement 0x1155)++referencedsopsequence :: [SequenceItem] -> Element+referencedsopsequence = sq $ tag (TagGroup 0x0008) (TagElement 0x1199)++derivationdescription :: B.ByteString -> Element+derivationdescription = st $ tag (TagGroup 0x0008) (TagElement 0x2111)++sourceimagesequence :: [SequenceItem] -> Element+sourceimagesequence = sq $ tag (TagGroup 0x0008) (TagElement 0x2112)++stagename :: String -> Element+stagename = sh $ tag (TagGroup 0x0008) (TagElement 0x2120)++stagenumber :: Int -> Element+stagenumber = is $ tag (TagGroup 0x0008) (TagElement 0x2122)++numberofstages :: Int -> Element+numberofstages = is $ tag (TagGroup 0x0008) (TagElement 0x2124)++numberofeventtimers :: Int -> Element+numberofeventtimers = is $ tag (TagGroup 0x0008) (TagElement 0x2129)++viewnumber :: Int -> Element+viewnumber = is $ tag (TagGroup 0x0008) (TagElement 0x2128)++numberofviewsinstage :: Int -> Element+numberofviewsinstage = is $ tag (TagGroup 0x0008) (TagElement 0x212A)++eventelapsedtimes :: B.ByteString -> Element+eventelapsedtimes = ds $ tag (TagGroup 0x0008) (TagElement 0x2130)++eventtimernames :: String -> Element+eventtimernames = lo $ tag (TagGroup 0x0008) (TagElement 0x2132)++starttrim :: Int -> Element+starttrim = is $ tag (TagGroup 0x0008) (TagElement 0x2142)++stoptrim :: Int -> Element+stoptrim = is $ tag (TagGroup 0x0008) (TagElement 0x2143)++recommendeddisplayframerate :: Int -> Element+recommendeddisplayframerate = is $ tag (TagGroup 0x0008) (TagElement 0x2144)++transducerposition :: String -> Element+transducerposition = cs $ tag (TagGroup 0x0008) (TagElement 0x2200)++transducerorientation :: String -> Element+transducerorientation = cs $ tag (TagGroup 0x0008) (TagElement 0x2204)++anatomicstructure :: String -> Element+anatomicstructure = cs $ tag (TagGroup 0x0008) (TagElement 0x2208)++group0008commentsret :: String -> Element+group0008commentsret = sh $ tag (TagGroup 0x0008) (TagElement 0x4000)++group0010length :: B.ByteString -> Element+group0010length = ul $ tag (TagGroup 0x0010) (TagElement 0x0000)++patientsname :: String -> Element+patientsname = pn $ tag (TagGroup 0x0010) (TagElement 0x0010)++patientid :: String -> Element+patientid = lo $ tag (TagGroup 0x0010) (TagElement 0x0020)++issuerofpatientid :: String -> Element+issuerofpatientid = lo $ tag (TagGroup 0x0010) (TagElement 0x0021)++patientsbirthdate :: UTCTime -> Element+patientsbirthdate = da $ tag (TagGroup 0x0010) (TagElement 0x0030)++patientsbirthtime :: UTCTime -> Element+patientsbirthtime = tm $ tag (TagGroup 0x0010) (TagElement 0x0032)++patientssex :: String -> Element+patientssex = cs $ tag (TagGroup 0x0010) (TagElement 0x0040)++patientssocialsecuritynumber :: String -> Element+patientssocialsecuritynumber = sh $ tag (TagGroup 0x0010) (TagElement 0x0042)++patientsinsuranceplancodesequence :: [SequenceItem] -> Element+patientsinsuranceplancodesequence = sq $ tag (TagGroup 0x0010) (TagElement 0x0050)++otherpatientids :: String -> Element+otherpatientids = lo $ tag (TagGroup 0x0010) (TagElement 0x1000)++otherpatientnames :: String -> Element+otherpatientnames = pn $ tag (TagGroup 0x0010) (TagElement 0x1001)++patientsmaidenname :: String -> Element+patientsmaidenname = pn $ tag (TagGroup 0x0010) (TagElement 0x1005)++patientsage :: String -> Element+patientsage = as $ tag (TagGroup 0x0010) (TagElement 0x1010)++patientssize :: B.ByteString -> Element+patientssize = ds $ tag (TagGroup 0x0010) (TagElement 0x1020)++patientsweight :: B.ByteString -> Element+patientsweight = ds $ tag (TagGroup 0x0010) (TagElement 0x1030)++patientsaddress :: String -> Element+patientsaddress = lo $ tag (TagGroup 0x0010) (TagElement 0x1040)++insuranceplanidentificationret :: String -> Element+insuranceplanidentificationret = sh $ tag (TagGroup 0x0010) (TagElement 0x1050)++patientsmothersmaidenname :: String -> Element+patientsmothersmaidenname = pn $ tag (TagGroup 0x0010) (TagElement 0x1060)++militaryrank :: String -> Element+militaryrank = lo $ tag (TagGroup 0x0010) (TagElement 0x1080)++branchofservice :: String -> Element+branchofservice = lo $ tag (TagGroup 0x0010) (TagElement 0x1081)++medicalrecordlocator :: String -> Element+medicalrecordlocator = lo $ tag (TagGroup 0x0010) (TagElement 0x1090)++medicalalerts :: String -> Element+medicalalerts = lo $ tag (TagGroup 0x0010) (TagElement 0x2000)++contrastallergies :: String -> Element+contrastallergies = lo $ tag (TagGroup 0x0010) (TagElement 0x2110)++countryofresidence :: String -> Element+countryofresidence = lo $ tag (TagGroup 0x0010) (TagElement 0x2150)++regionofresidence :: String -> Element+regionofresidence = lo $ tag (TagGroup 0x0010) (TagElement 0x2152)++patientstelephonenumbers :: String -> Element+patientstelephonenumbers = sh $ tag (TagGroup 0x0010) (TagElement 0x2154)++ethnicgroup :: String -> Element+ethnicgroup = sh $ tag (TagGroup 0x0010) (TagElement 0x2160)++occupation :: String -> Element+occupation = sh $ tag (TagGroup 0x0010) (TagElement 0x2180)++smokingstatus :: String -> Element+smokingstatus = cs $ tag (TagGroup 0x0010) (TagElement 0x21A0)++additionalpatienthistory :: String -> Element+additionalpatienthistory = lt $ tag (TagGroup 0x0010) (TagElement 0x21B0)++pregnancystatus :: B.ByteString -> Element+pregnancystatus = us $ tag (TagGroup 0x0010) (TagElement 0x21C0)++lastmenstrualdate :: UTCTime -> Element+lastmenstrualdate = da $ tag (TagGroup 0x0010) (TagElement 0x21D0)++patientsreligiouspreference :: String -> Element+patientsreligiouspreference = lo $ tag (TagGroup 0x0010) (TagElement 0x21F0)++patientcomments :: String -> Element+patientcomments = lt $ tag (TagGroup 0x0010) (TagElement 0x4000)++group0018length :: B.ByteString -> Element+group0018length = ul $ tag (TagGroup 0x0018) (TagElement 0x0000)++contrastbolusagent :: String -> Element+contrastbolusagent = lo $ tag (TagGroup 0x0018) (TagElement 0x0010)++bodypartexamined :: String -> Element+bodypartexamined = cs $ tag (TagGroup 0x0018) (TagElement 0x0015)++scanningsequence :: String -> Element+scanningsequence = cs $ tag (TagGroup 0x0018) (TagElement 0x0020)++sequencevariant :: String -> Element+sequencevariant = cs $ tag (TagGroup 0x0018) (TagElement 0x0021)++scanoptions :: String -> Element+scanoptions = cs $ tag (TagGroup 0x0018) (TagElement 0x0022)++mracquisitiontype :: String -> Element+mracquisitiontype = cs $ tag (TagGroup 0x0018) (TagElement 0x0023)++sequencename :: String -> Element+sequencename = sh $ tag (TagGroup 0x0018) (TagElement 0x0024)++angioflag :: String -> Element+angioflag = cs $ tag (TagGroup 0x0018) (TagElement 0x0025)++radionuclide :: String -> Element+radionuclide = lo $ tag (TagGroup 0x0018) (TagElement 0x0030)++radiopharmaceutical :: String -> Element+radiopharmaceutical = lo $ tag (TagGroup 0x0018) (TagElement 0x0031)++energywindowcenterline :: B.ByteString -> Element+energywindowcenterline = ds $ tag (TagGroup 0x0018) (TagElement 0x0032)++energywindowtotalwidth :: B.ByteString -> Element+energywindowtotalwidth = ds $ tag (TagGroup 0x0018) (TagElement 0x0033)++interventiondrugname :: String -> Element+interventiondrugname = lo $ tag (TagGroup 0x0018) (TagElement 0x0034)++interventiondrugstarttime :: UTCTime -> Element+interventiondrugstarttime = tm $ tag (TagGroup 0x0018) (TagElement 0x0035)++cinerate :: Int -> Element+cinerate = is $ tag (TagGroup 0x0018) (TagElement 0x0040)++slicethickness :: B.ByteString -> Element+slicethickness = ds $ tag (TagGroup 0x0018) (TagElement 0x0050)++kvp :: B.ByteString -> Element+kvp = ds $ tag (TagGroup 0x0018) (TagElement 0x0060)++countsaccumulated :: Int -> Element+countsaccumulated = is $ tag (TagGroup 0x0018) (TagElement 0x0070)++acquisitionterminationcondition :: String -> Element+acquisitionterminationcondition = cs $ tag (TagGroup 0x0018) (TagElement 0x0071)++effectiveseriesduration :: B.ByteString -> Element+effectiveseriesduration = ds $ tag (TagGroup 0x0018) (TagElement 0x0072)++repetitiontime :: B.ByteString -> Element+repetitiontime = ds $ tag (TagGroup 0x0018) (TagElement 0x0080)++echotime :: B.ByteString -> Element+echotime = ds $ tag (TagGroup 0x0018) (TagElement 0x0081)++inversiontime :: B.ByteString -> Element+inversiontime = ds $ tag (TagGroup 0x0018) (TagElement 0x0082)++numberofaverages :: B.ByteString -> Element+numberofaverages = ds $ tag (TagGroup 0x0018) (TagElement 0x0083)++imagingfrequency :: B.ByteString -> Element+imagingfrequency = ds $ tag (TagGroup 0x0018) (TagElement 0x0084)++imagednucleus :: String -> Element+imagednucleus = sh $ tag (TagGroup 0x0018) (TagElement 0x0085)++echonumberss :: Int -> Element+echonumberss = is $ tag (TagGroup 0x0018) (TagElement 0x0086)++magneticfieldstrength :: B.ByteString -> Element+magneticfieldstrength = ds $ tag (TagGroup 0x0018) (TagElement 0x0087)++spacingbetweenslices :: B.ByteString -> Element+spacingbetweenslices = ds $ tag (TagGroup 0x0018) (TagElement 0x0088)++numberofphaseencodingsteps :: Int -> Element+numberofphaseencodingsteps = is $ tag (TagGroup 0x0018) (TagElement 0x0089)++datacollectiondiameter :: B.ByteString -> Element+datacollectiondiameter = ds $ tag (TagGroup 0x0018) (TagElement 0x0090)++echotrainlength :: Int -> Element+echotrainlength = is $ tag (TagGroup 0x0018) (TagElement 0x0091)++percentsampling :: B.ByteString -> Element+percentsampling = ds $ tag (TagGroup 0x0018) (TagElement 0x0093)++percentphasefieldofview :: B.ByteString -> Element+percentphasefieldofview = ds $ tag (TagGroup 0x0018) (TagElement 0x0094)++pixelbandwidth :: B.ByteString -> Element+pixelbandwidth = ds $ tag (TagGroup 0x0018) (TagElement 0x0095)++deviceserialnumber :: String -> Element+deviceserialnumber = lo $ tag (TagGroup 0x0018) (TagElement 0x1000)++plateid :: String -> Element+plateid = lo $ tag (TagGroup 0x0018) (TagElement 0x1004)++secondarycapturedeviceid :: String -> Element+secondarycapturedeviceid = lo $ tag (TagGroup 0x0018) (TagElement 0x1010)++dateofsecondarycapture :: UTCTime -> Element+dateofsecondarycapture = da $ tag (TagGroup 0x0018) (TagElement 0x1012)++timeofsecondarycapture :: UTCTime -> Element+timeofsecondarycapture = tm $ tag (TagGroup 0x0018) (TagElement 0x1014)++secondarycapturedevicemanufacturer :: String -> Element+secondarycapturedevicemanufacturer = lo $ tag (TagGroup 0x0018) (TagElement 0x1016)++secondarycapturedevicemanufacturersmodelname :: String -> Element+secondarycapturedevicemanufacturersmodelname = lo $ tag (TagGroup 0x0018) (TagElement 0x1018)++secondarycapturedevicesoftwareversions :: String -> Element+secondarycapturedevicesoftwareversions = lo $ tag (TagGroup 0x0018) (TagElement 0x1019)++softwareversionss :: String -> Element+softwareversionss = lo $ tag (TagGroup 0x0018) (TagElement 0x1020)++videoimageformatacquired :: String -> Element+videoimageformatacquired = sh $ tag (TagGroup 0x0018) (TagElement 0x1022)++digitalimageformatacquired :: String -> Element+digitalimageformatacquired = lo $ tag (TagGroup 0x0018) (TagElement 0x1023)++protocolname :: String -> Element+protocolname = lo $ tag (TagGroup 0x0018) (TagElement 0x1030)++contrastbolusroute :: String -> Element+contrastbolusroute = lo $ tag (TagGroup 0x0018) (TagElement 0x1040)++contrastbolusvolume :: B.ByteString -> Element+contrastbolusvolume = ds $ tag (TagGroup 0x0018) (TagElement 0x1041)++contrastbolusstarttime :: UTCTime -> Element+contrastbolusstarttime = tm $ tag (TagGroup 0x0018) (TagElement 0x1042)++contrastbolusstoptime :: UTCTime -> Element+contrastbolusstoptime = tm $ tag (TagGroup 0x0018) (TagElement 0x1043)++contrastbolustotaldose :: B.ByteString -> Element+contrastbolustotaldose = ds $ tag (TagGroup 0x0018) (TagElement 0x1044)++syringecounts :: Int -> Element+syringecounts = is $ tag (TagGroup 0x0018) (TagElement 0x1045)++spatialresolution :: B.ByteString -> Element+spatialresolution = ds $ tag (TagGroup 0x0018) (TagElement 0x1050)++triggertime :: B.ByteString -> Element+triggertime = ds $ tag (TagGroup 0x0018) (TagElement 0x1060)++triggersourceortype :: String -> Element+triggersourceortype = lo $ tag (TagGroup 0x0018) (TagElement 0x1061)++nominalinterval :: Int -> Element+nominalinterval = is $ tag (TagGroup 0x0018) (TagElement 0x1062)++frametime :: B.ByteString -> Element+frametime = ds $ tag (TagGroup 0x0018) (TagElement 0x1063)++framingtype :: String -> Element+framingtype = lo $ tag (TagGroup 0x0018) (TagElement 0x1064)++frametimevector :: B.ByteString -> Element+frametimevector = ds $ tag (TagGroup 0x0018) (TagElement 0x1065)++framedelay :: B.ByteString -> Element+framedelay = ds $ tag (TagGroup 0x0018) (TagElement 0x1066)++radionuclideroute :: String -> Element+radionuclideroute = lo $ tag (TagGroup 0x0018) (TagElement 0x1070)++radionuclidevolume :: B.ByteString -> Element+radionuclidevolume = ds $ tag (TagGroup 0x0018) (TagElement 0x1071)++radionuclidestarttime :: UTCTime -> Element+radionuclidestarttime = tm $ tag (TagGroup 0x0018) (TagElement 0x1072)++radionuclidestoptime :: UTCTime -> Element+radionuclidestoptime = tm $ tag (TagGroup 0x0018) (TagElement 0x1073)++radionuclidetotaldose :: B.ByteString -> Element+radionuclidetotaldose = ds $ tag (TagGroup 0x0018) (TagElement 0x1074)++beatrejectionflag :: String -> Element+beatrejectionflag = cs $ tag (TagGroup 0x0018) (TagElement 0x1080)++lowrrvalue :: Int -> Element+lowrrvalue = is $ tag (TagGroup 0x0018) (TagElement 0x1081)++highrrvalue :: Int -> Element+highrrvalue = is $ tag (TagGroup 0x0018) (TagElement 0x1082)++intervalsacquired :: Int -> Element+intervalsacquired = is $ tag (TagGroup 0x0018) (TagElement 0x1083)++intervalsrejected :: Int -> Element+intervalsrejected = is $ tag (TagGroup 0x0018) (TagElement 0x1084)++pvcrejection :: String -> Element+pvcrejection = lo $ tag (TagGroup 0x0018) (TagElement 0x1085)++skipbeats :: Int -> Element+skipbeats = is $ tag (TagGroup 0x0018) (TagElement 0x1086)++heartrate :: Int -> Element+heartrate = is $ tag (TagGroup 0x0018) (TagElement 0x1088)++cardiacnumberofimages :: Int -> Element+cardiacnumberofimages = is $ tag (TagGroup 0x0018) (TagElement 0x1090)++triggerwindow :: Int -> Element+triggerwindow = is $ tag (TagGroup 0x0018) (TagElement 0x1094)++reconstructiondiameter :: B.ByteString -> Element+reconstructiondiameter = ds $ tag (TagGroup 0x0018) (TagElement 0x1100)++distancesourcetodetector :: B.ByteString -> Element+distancesourcetodetector = ds $ tag (TagGroup 0x0018) (TagElement 0x1110)++distancesourcetopatient :: B.ByteString -> Element+distancesourcetopatient = ds $ tag (TagGroup 0x0018) (TagElement 0x1111)++gantrydetectortilt :: B.ByteString -> Element+gantrydetectortilt = ds $ tag (TagGroup 0x0018) (TagElement 0x1120)++tableheight :: B.ByteString -> Element+tableheight = ds $ tag (TagGroup 0x0018) (TagElement 0x1030)++tabletraverse :: B.ByteString -> Element+tabletraverse = ds $ tag (TagGroup 0x0018) (TagElement 0x1131)++rotationdirection :: String -> Element+rotationdirection = cs $ tag (TagGroup 0x0018) (TagElement 0x1140)++angularposition :: B.ByteString -> Element+angularposition = ds $ tag (TagGroup 0x0018) (TagElement 0x1141)++radialposition :: B.ByteString -> Element+radialposition = ds $ tag (TagGroup 0x0018) (TagElement 0x1142)++scanarc :: B.ByteString -> Element+scanarc = ds $ tag (TagGroup 0x0018) (TagElement 0x1143)++angularstep :: B.ByteString -> Element+angularstep = ds $ tag (TagGroup 0x0018) (TagElement 0x1144)++centerofrotationoffset :: B.ByteString -> Element+centerofrotationoffset = ds $ tag (TagGroup 0x0018) (TagElement 0x1145)++rotationoffset :: B.ByteString -> Element+rotationoffset = ds $ tag (TagGroup 0x0018) (TagElement 0x1146)++fieldofviewshape :: String -> Element+fieldofviewshape = cs $ tag (TagGroup 0x0018) (TagElement 0x1147)++fieldofviewdimensionss :: Int -> Element+fieldofviewdimensionss = is $ tag (TagGroup 0x0018) (TagElement 0x1149)++exposuretime :: Int -> Element+exposuretime = is $ tag (TagGroup 0x0018) (TagElement 0x1150)++xraytubecurrent :: Int -> Element+xraytubecurrent = is $ tag (TagGroup 0x0018) (TagElement 0x1151)++exposure :: Int -> Element+exposure = is $ tag (TagGroup 0x0018) (TagElement 0x1152)++filtertype :: String -> Element+filtertype = sh $ tag (TagGroup 0x0018) (TagElement 0x1160)++generatorpower :: Int -> Element+generatorpower = is $ tag (TagGroup 0x0018) (TagElement 0x1170)++collimatorgridname :: String -> Element+collimatorgridname = sh $ tag (TagGroup 0x0018) (TagElement 0x1180)++collimatortype :: String -> Element+collimatortype = cs $ tag (TagGroup 0x0018) (TagElement 0x1181)++focaldistance :: Int -> Element+focaldistance = is $ tag (TagGroup 0x0018) (TagElement 0x1182)++xfocuscenter :: B.ByteString -> Element+xfocuscenter = ds $ tag (TagGroup 0x0018) (TagElement 0x1183)++yfocuscenter :: B.ByteString -> Element+yfocuscenter = ds $ tag (TagGroup 0x0018) (TagElement 0x1184)++focalspots :: B.ByteString -> Element+focalspots = ds $ tag (TagGroup 0x0018) (TagElement 0x1190)++dateoflastcalibration :: UTCTime -> Element+dateoflastcalibration = da $ tag (TagGroup 0x0018) (TagElement 0x1200)++timeoflastcalibration :: UTCTime -> Element+timeoflastcalibration = tm $ tag (TagGroup 0x0018) (TagElement 0x1201)++convolutionkernel :: String -> Element+convolutionkernel = sh $ tag (TagGroup 0x0018) (TagElement 0x1210)++upperlowerpixelvaluesret :: B.ByteString -> Element+upperlowerpixelvaluesret = ds $ tag (TagGroup 0x0018) (TagElement 0x1240)++actualframeduration :: Int -> Element+actualframeduration = is $ tag (TagGroup 0x0018) (TagElement 0x1242)++countrate :: Int -> Element+countrate = is $ tag (TagGroup 0x0018) (TagElement 0x1243)++receivingcoil :: String -> Element+receivingcoil = sh $ tag (TagGroup 0x0018) (TagElement 0x1250)++transmittingcoil :: String -> Element+transmittingcoil = sh $ tag (TagGroup 0x0018) (TagElement 0x1151)++screentype :: String -> Element+screentype = sh $ tag (TagGroup 0x0018) (TagElement 0x1160)++phosphortype :: String -> Element+phosphortype = lo $ tag (TagGroup 0x0018) (TagElement 0x1261)++scanvelocity :: Int -> Element+scanvelocity = is $ tag (TagGroup 0x0018) (TagElement 0x1300)++wholebodytechnique :: String -> Element+wholebodytechnique = cs $ tag (TagGroup 0x0018) (TagElement 0x1301)++scanlength :: Int -> Element+scanlength = is $ tag (TagGroup 0x0018) (TagElement 0x1302)++acquisitionmatrix :: B.ByteString -> Element+acquisitionmatrix = us $ tag (TagGroup 0x0018) (TagElement 0x1310)++phaseencodingdirection :: String -> Element+phaseencodingdirection = cs $ tag (TagGroup 0x0018) (TagElement 0x1312)++flipangle :: B.ByteString -> Element+flipangle = ds $ tag (TagGroup 0x0018) (TagElement 0x1314)++variableflipangleflag :: String -> Element+variableflipangleflag = cs $ tag (TagGroup 0x0018) (TagElement 0x1315)++sar :: B.ByteString -> Element+sar = ds $ tag (TagGroup 0x0018) (TagElement 0x1316)++dbdt :: B.ByteString -> Element+dbdt = ds $ tag (TagGroup 0x0018) (TagElement 0x1318)++acquisitiondeviceprocessingdescription :: String -> Element+acquisitiondeviceprocessingdescription = lo $ tag (TagGroup 0x0018) (TagElement 0x1400)++acquisitiondeviceprocessingcode :: String -> Element+acquisitiondeviceprocessingcode = lo $ tag (TagGroup 0x0018) (TagElement 0x1401)++cassetteorientation :: String -> Element+cassetteorientation = cs $ tag (TagGroup 0x0018) (TagElement 0x1402)++cassettesize :: String -> Element+cassettesize = cs $ tag (TagGroup 0x0018) (TagElement 0x1403)++exposuresonplate :: B.ByteString -> Element+exposuresonplate = us $ tag (TagGroup 0x0018) (TagElement 0x1404)++relativexrayexposure :: Int -> Element+relativexrayexposure = is $ tag (TagGroup 0x0018) (TagElement 0x1405)++group0018commentsret :: String -> Element+group0018commentsret = sh $ tag (TagGroup 0x0018) (TagElement 0x4000)++outputpower :: String -> Element+outputpower = sh $ tag (TagGroup 0x0018) (TagElement 0x5000)++transducerdata :: String -> Element+transducerdata = lo $ tag (TagGroup 0x0018) (TagElement 0x5010)++focusdepth :: B.ByteString -> Element+focusdepth = ds $ tag (TagGroup 0x0018) (TagElement 0x5012)++preprocessingfunction :: String -> Element+preprocessingfunction = lo $ tag (TagGroup 0x0018) (TagElement 0x5020)++postprocessingfunction :: String -> Element+postprocessingfunction = lo $ tag (TagGroup 0x0018) (TagElement 0x5021)++mechanicalindex :: B.ByteString -> Element+mechanicalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5022)++thermalindex :: B.ByteString -> Element+thermalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5024)++cranialthermalindex :: B.ByteString -> Element+cranialthermalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5026)++softtissuethermalindex :: B.ByteString -> Element+softtissuethermalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5027)++softtissuefocusthermalindex :: B.ByteString -> Element+softtissuefocusthermalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5028)++softtissuesurfacethermalindex :: B.ByteString -> Element+softtissuesurfacethermalindex = ds $ tag (TagGroup 0x0018) (TagElement 0x5029)++dynamicrangeret :: Int -> Element+dynamicrangeret = is $ tag (TagGroup 0x0018) (TagElement 0x5030)++totalgainret :: Int -> Element+totalgainret = is $ tag (TagGroup 0x0018) (TagElement 0x5040)++depthofscanfield :: Int -> Element+depthofscanfield = is $ tag (TagGroup 0x0018) (TagElement 0x5050)++patientposition :: String -> Element+patientposition = cs $ tag (TagGroup 0x0018) (TagElement 0x5100)++viewposition :: String -> Element+viewposition = cs $ tag (TagGroup 0x0018) (TagElement 0x5101)++imagetransformationmatrix :: B.ByteString -> Element+imagetransformationmatrix = ds $ tag (TagGroup 0x0018) (TagElement 0x5210)++imagetranslationvector :: B.ByteString -> Element+imagetranslationvector = ds $ tag (TagGroup 0x0018) (TagElement 0x5212)++sensitivity :: B.ByteString -> Element+sensitivity = ds $ tag (TagGroup 0x0018) (TagElement 0x6000)++sequenceofultrasoundregions :: [SequenceItem] -> Element+sequenceofultrasoundregions = sq $ tag (TagGroup 0x0018) (TagElement 0x6011)++regionspatialformat :: B.ByteString -> Element+regionspatialformat = us $ tag (TagGroup 0x0018) (TagElement 0x6012)++regiondatatype :: B.ByteString -> Element+regiondatatype = us $ tag (TagGroup 0x0018) (TagElement 0x6014)++regionflags :: B.ByteString -> Element+regionflags = ul $ tag (TagGroup 0x0018) (TagElement 0x6016)++regionlocationminx0 :: B.ByteString -> Element+regionlocationminx0 = ul $ tag (TagGroup 0x0018) (TagElement 0x6018)++regionlocationminy0 :: B.ByteString -> Element+regionlocationminy0 = ul $ tag (TagGroup 0x0018) (TagElement 0x601A)++regionlocationmaxx1 :: B.ByteString -> Element+regionlocationmaxx1 = ul $ tag (TagGroup 0x0018) (TagElement 0x601C)++regionlocationmaxy1 :: B.ByteString -> Element+regionlocationmaxy1 = ul $ tag (TagGroup 0x0018) (TagElement 0x601E)++referencepixelx0 :: B.ByteString -> Element+referencepixelx0 = sl $ tag (TagGroup 0x0018) (TagElement 0x6020)++referencepixely0 :: B.ByteString -> Element+referencepixely0 = sl $ tag (TagGroup 0x0018) (TagElement 0x6022)++physicalunitsxdirection :: B.ByteString -> Element+physicalunitsxdirection = us $ tag (TagGroup 0x0018) (TagElement 0x6024)++physicalunitsydirection :: B.ByteString -> Element+physicalunitsydirection = us $ tag (TagGroup 0x0018) (TagElement 0x6026)++referencepixelphysicalvaluex :: B.ByteString -> Element+referencepixelphysicalvaluex = fd $ tag (TagGroup 0x0018) (TagElement 0x1628)++referencepixelphysicalvaluey :: B.ByteString -> Element+referencepixelphysicalvaluey = fd $ tag (TagGroup 0x0018) (TagElement 0x602A)++physicaldeltax :: B.ByteString -> Element+physicaldeltax = fd $ tag (TagGroup 0x0018) (TagElement 0x602C)++physicaldeltay :: B.ByteString -> Element+physicaldeltay = fd $ tag (TagGroup 0x0018) (TagElement 0x602E)++transducerfrequency :: B.ByteString -> Element+transducerfrequency = ul $ tag (TagGroup 0x0018) (TagElement 0x6030)++transducertype :: String -> Element+transducertype = cs $ tag (TagGroup 0x0018) (TagElement 0x6031)++pulserepetitionfrequency :: B.ByteString -> Element+pulserepetitionfrequency = ul $ tag (TagGroup 0x0018) (TagElement 0x6032)++dopplercorrectionangle :: B.ByteString -> Element+dopplercorrectionangle = fd $ tag (TagGroup 0x0018) (TagElement 0x6034)++sterringangle :: B.ByteString -> Element+sterringangle = fd $ tag (TagGroup 0x0018) (TagElement 0x6036)++dopplersamplevolumexposition :: B.ByteString -> Element+dopplersamplevolumexposition = ul $ tag (TagGroup 0x0018) (TagElement 0x6038)++dopplersamplevolumeyposition :: B.ByteString -> Element+dopplersamplevolumeyposition = ul $ tag (TagGroup 0x0018) (TagElement 0x603A)++tmlinepositionx0 :: B.ByteString -> Element+tmlinepositionx0 = ul $ tag (TagGroup 0x0018) (TagElement 0x603C)++tmlinepositiony0 :: B.ByteString -> Element+tmlinepositiony0 = ul $ tag (TagGroup 0x0018) (TagElement 0x603E)++tmlinepositionx1 :: B.ByteString -> Element+tmlinepositionx1 = ul $ tag (TagGroup 0x0018) (TagElement 0x6040)++tmlinepositiony1 :: B.ByteString -> Element+tmlinepositiony1 = ul $ tag (TagGroup 0x0018) (TagElement 0x6042)++pixelcomponentorganization :: B.ByteString -> Element+pixelcomponentorganization = us $ tag (TagGroup 0x0018) (TagElement 0x6044)++pixelcomponentrangestart :: B.ByteString -> Element+pixelcomponentrangestart = ul $ tag (TagGroup 0x0018) (TagElement 0x6048)++pixelcomponentrangestop :: B.ByteString -> Element+pixelcomponentrangestop = ul $ tag (TagGroup 0x0018) (TagElement 0x604A)++pixelcomponentphysicalunits :: B.ByteString -> Element+pixelcomponentphysicalunits = us $ tag (TagGroup 0x0018) (TagElement 0x604C)++pixelcomponentdatatype :: B.ByteString -> Element+pixelcomponentdatatype = us $ tag (TagGroup 0x0018) (TagElement 0x604E)++numberoftablebreakpoints :: B.ByteString -> Element+numberoftablebreakpoints = ul $ tag (TagGroup 0x0018) (TagElement 0x6050)++tableofxbreakpoints :: B.ByteString -> Element+tableofxbreakpoints = ul $ tag (TagGroup 0x0018) (TagElement 0x6052)++tableofybreakpoints :: B.ByteString -> Element+tableofybreakpoints = fd $ tag (TagGroup 0x0018) (TagElement 0x6054)++group0020length :: B.ByteString -> Element+group0020length = ul $ tag (TagGroup 0x0020) (TagElement 0x0000)++studyinstanceuid :: String -> Element+studyinstanceuid = ui $ tag (TagGroup 0x0020) (TagElement 0x000D)++seriesinstanceuid :: String -> Element+seriesinstanceuid = ui $ tag (TagGroup 0x0020) (TagElement 0x000E)++studyid :: String -> Element+studyid = sh $ tag (TagGroup 0x0020) (TagElement 0x0010)++seriesnumber :: Int -> Element+seriesnumber = is $ tag (TagGroup 0x0020) (TagElement 0x0011)++acquisitionnumber :: Int -> Element+acquisitionnumber = is $ tag (TagGroup 0x0020) (TagElement 0x0012)++imagenumber :: Int -> Element+imagenumber = is $ tag (TagGroup 0x0020) (TagElement 0x0013)++isotopenumber :: Int -> Element+isotopenumber = is $ tag (TagGroup 0x0020) (TagElement 0x0014)++phasenumber :: Int -> Element+phasenumber = is $ tag (TagGroup 0x0020) (TagElement 0x0015)++intervalnumber :: Int -> Element+intervalnumber = is $ tag (TagGroup 0x0020) (TagElement 0x0016)++timeslotnumber :: Int -> Element+timeslotnumber = is $ tag (TagGroup 0x0020) (TagElement 0x0017)++anglenumber :: Int -> Element+anglenumber = is $ tag (TagGroup 0x0020) (TagElement 0x0018)++patientorientation :: String -> Element+patientorientation = cs $ tag (TagGroup 0x0020) (TagElement 0x0020)++overlaynumber :: B.ByteString -> Element+overlaynumber = us $ tag (TagGroup 0x0020) (TagElement 0x0022)++curvenumber :: B.ByteString -> Element+curvenumber = us $ tag (TagGroup 0x0020) (TagElement 0x0024)++imagepositionret :: B.ByteString -> Element+imagepositionret = ds $ tag (TagGroup 0x0020) (TagElement 0x0030)++imagepositionpatient :: B.ByteString -> Element+imagepositionpatient = ds $ tag (TagGroup 0x0020) (TagElement 0x0032)++imageorientationret :: B.ByteString -> Element+imageorientationret = ds $ tag (TagGroup 0x0020) (TagElement 0x0035)++imageorientationpatient :: B.ByteString -> Element+imageorientationpatient = ds $ tag (TagGroup 0x0020) (TagElement 0x0037)++locationret :: B.ByteString -> Element+locationret = ds $ tag (TagGroup 0x0020) (TagElement 0x0050)++frameofreferenceuid :: String -> Element+frameofreferenceuid = ui $ tag (TagGroup 0x0020) (TagElement 0x0052)++laterality :: String -> Element+laterality = cs $ tag (TagGroup 0x0020) (TagElement 0x0060)++imagegeometrytyperet :: String -> Element+imagegeometrytyperet = sh $ tag (TagGroup 0x0020) (TagElement 0x0070)++maskingimageuid :: String -> Element+maskingimageuid = ui $ tag (TagGroup 0x0020) (TagElement 0x0080)++temporalpositionidentifier :: Int -> Element+temporalpositionidentifier = is $ tag (TagGroup 0x0020) (TagElement 0x0100)++numberoftemporalpositions :: Int -> Element+numberoftemporalpositions = is $ tag (TagGroup 0x0020) (TagElement 0x0105)++temporalresolution :: B.ByteString -> Element+temporalresolution = ds $ tag (TagGroup 0x0020) (TagElement 0x0110)++seriesinstudy :: Int -> Element+seriesinstudy = is $ tag (TagGroup 0x0020) (TagElement 0x1000)++acquisitionsinseriesret :: Int -> Element+acquisitionsinseriesret = is $ tag (TagGroup 0x0020) (TagElement 0x1001)++imagesinacquisition :: Int -> Element+imagesinacquisition = is $ tag (TagGroup 0x0020) (TagElement 0x1002)++acquisitioninstudy :: Int -> Element+acquisitioninstudy = is $ tag (TagGroup 0x0020) (TagElement 0x1004)++referenceret :: String -> Element+referenceret = sh $ tag (TagGroup 0x0020) (TagElement 0x1020)++positionreferenceindicator :: String -> Element+positionreferenceindicator = lo $ tag (TagGroup 0x0020) (TagElement 0x1040)++slicelocation :: B.ByteString -> Element+slicelocation = ds $ tag (TagGroup 0x0020) (TagElement 0x1041)++otherstudynumbers :: Int -> Element+otherstudynumbers = is $ tag (TagGroup 0x0020) (TagElement 0x1070)++numberofpatientrelatedstudies :: Int -> Element+numberofpatientrelatedstudies = is $ tag (TagGroup 0x0020) (TagElement 0x1200)++numberofpatientrelatedseries :: Int -> Element+numberofpatientrelatedseries = is $ tag (TagGroup 0x0020) (TagElement 0x1202)++numberofpatientrelatedimages :: Int -> Element+numberofpatientrelatedimages = is $ tag (TagGroup 0x0020) (TagElement 0x1204)++numberofstudyrelatedseries :: Int -> Element+numberofstudyrelatedseries = is $ tag (TagGroup 0x0020) (TagElement 0x1206)++numberofstudyrelatedimages :: Int -> Element+numberofstudyrelatedimages = is $ tag (TagGroup 0x0020) (TagElement 0x1208)++sourceimageidrets :: String -> Element+sourceimageidrets = sh $ tag (TagGroup 0x0020) (TagElement 0x3100)++modifyingdeviceidret :: String -> Element+modifyingdeviceidret = sh $ tag (TagGroup 0x0020) (TagElement 0x3401)++modifiedimageidret :: String -> Element+modifiedimageidret = sh $ tag (TagGroup 0x0020) (TagElement 0x3402)++modifiedimagedateret :: String -> Element+modifiedimagedateret = sh $ tag (TagGroup 0x0020) (TagElement 0x3403)++modifyingdevicemanufacturerret :: String -> Element+modifyingdevicemanufacturerret = sh $ tag (TagGroup 0x0020) (TagElement 0x3404)++modifiedimagetimeret :: String -> Element+modifiedimagetimeret = sh $ tag (TagGroup 0x0020) (TagElement 0x3405)++modifiedimagedescriptionret :: String -> Element+modifiedimagedescriptionret = sh $ tag (TagGroup 0x0020) (TagElement 0x3406)++imagecomments :: String -> Element+imagecomments = lt $ tag (TagGroup 0x0020) (TagElement 0x4000)++originalimageidentificationret :: B.ByteString -> Element+originalimageidentificationret = us $ tag (TagGroup 0x0020) (TagElement 0x5000)++originalimageidentificationnomenclatureret :: String -> Element+originalimageidentificationnomenclatureret = sh $ tag (TagGroup 0x0020) (TagElement 0x5002)++group0028length :: B.ByteString -> Element+group0028length = ul $ tag (TagGroup 0x0028) (TagElement 0x0000)++samplesperpixel :: B.ByteString -> Element+samplesperpixel = us $ tag (TagGroup 0x0028) (TagElement 0x0002)++photometricinterpretation :: String -> Element+photometricinterpretation = cs $ tag (TagGroup 0x0028) (TagElement 0x0004)++imagedimensionsret :: B.ByteString -> Element+imagedimensionsret = us $ tag (TagGroup 0x0028) (TagElement 0x0005)++planarconfiguration :: B.ByteString -> Element+planarconfiguration = us $ tag (TagGroup 0x0028) (TagElement 0x0006)++numberofframes :: Int -> Element+numberofframes = is $ tag (TagGroup 0x0028) (TagElement 0x0008)++rows :: B.ByteString -> Element+rows = us $ tag (TagGroup 0x0028) (TagElement 0x0010)++columns :: B.ByteString -> Element+columns = us $ tag (TagGroup 0x0028) (TagElement 0x0011)++pixelspacing :: B.ByteString -> Element+pixelspacing = ds $ tag (TagGroup 0x0028) (TagElement 0x0030)++zoomfactor :: B.ByteString -> Element+zoomfactor = ds $ tag (TagGroup 0x0028) (TagElement 0x0031)++zoomcenter :: B.ByteString -> Element+zoomcenter = ds $ tag (TagGroup 0x0028) (TagElement 0x0032)++pixelaspectratio :: Int -> Element+pixelaspectratio = is $ tag (TagGroup 0x0028) (TagElement 0x0034)++imageformatret :: String -> Element+imageformatret = sh $ tag (TagGroup 0x0028) (TagElement 0x0040)++manipulatedimageret :: String -> Element+manipulatedimageret = sh $ tag (TagGroup 0x0028) (TagElement 0x0050)++correctedimage :: String -> Element+correctedimage = cs $ tag (TagGroup 0x0028) (TagElement 0x0051)++compressioncoderet :: String -> Element+compressioncoderet = sh $ tag (TagGroup 0x0028) (TagElement 0x0060)++bitsallocated :: B.ByteString -> Element+bitsallocated = us $ tag (TagGroup 0x0028) (TagElement 0x0100)++bitsstored :: B.ByteString -> Element+bitsstored = us $ tag (TagGroup 0x0028) (TagElement 0x0101)++highbit :: B.ByteString -> Element+highbit = us $ tag (TagGroup 0x0028) (TagElement 0x0102)++pixelrepresentation :: B.ByteString -> Element+pixelrepresentation = us $ tag (TagGroup 0x0028) (TagElement 0x0103)++smallestvalidpixelvalueret :: B.ByteString -> Element+smallestvalidpixelvalueret = us $ tag (TagGroup 0x0028) (TagElement 0x0104)++largestvalidpixelvalueret :: B.ByteString -> Element+largestvalidpixelvalueret = us $ tag (TagGroup 0x0028) (TagElement 0x0105)++smallestimagepixelvalue :: B.ByteString -> Element+smallestimagepixelvalue = us $ tag (TagGroup 0x0028) (TagElement 0x0106)++largestimagepixelvalue :: B.ByteString -> Element+largestimagepixelvalue = us $ tag (TagGroup 0x0028) (TagElement 0x0107)++smallestpixelvalueinseries :: B.ByteString -> Element+smallestpixelvalueinseries = us $ tag (TagGroup 0x0028) (TagElement 0x0108)++largestpixelvalueinseries :: B.ByteString -> Element+largestpixelvalueinseries = us $ tag (TagGroup 0x0028) (TagElement 0x0109)++pixelpaddingvalue :: B.ByteString -> Element+pixelpaddingvalue = us $ tag (TagGroup 0x0028) (TagElement 0x0120)++imagelocationret :: B.ByteString -> Element+imagelocationret = us $ tag (TagGroup 0x0028) (TagElement 0x0200)++windowcenter :: B.ByteString -> Element+windowcenter = ds $ tag (TagGroup 0x0028) (TagElement 0x1050)++windowwidth :: B.ByteString -> Element+windowwidth = ds $ tag (TagGroup 0x0028) (TagElement 0x1051)++rescaleintercept :: B.ByteString -> Element+rescaleintercept = ds $ tag (TagGroup 0x0028) (TagElement 0x1052)++rescaleslope :: B.ByteString -> Element+rescaleslope = ds $ tag (TagGroup 0x0028) (TagElement 0x1053)++rescaletype :: String -> Element+rescaletype = lo $ tag (TagGroup 0x0028) (TagElement 0x1054)++windowcenterwidthexplanation :: String -> Element+windowcenterwidthexplanation = lo $ tag (TagGroup 0x0028) (TagElement 0x1055)++grayscaleret :: String -> Element+grayscaleret = sh $ tag (TagGroup 0x0028) (TagElement 0x1080)++graylookuptabledescriptorret :: B.ByteString -> Element+graylookuptabledescriptorret = us $ tag (TagGroup 0x0028) (TagElement 0x1100)++redpalettecolorlookuptabledescriptor :: B.ByteString -> Element+redpalettecolorlookuptabledescriptor = us $ tag (TagGroup 0x0028) (TagElement 0x1101)++greenpalettecolorlookuptabledescriptor :: B.ByteString -> Element+greenpalettecolorlookuptabledescriptor = us $ tag (TagGroup 0x0028) (TagElement 0x1102)++bluepalettecolorlookuptabledescriptor :: B.ByteString -> Element+bluepalettecolorlookuptabledescriptor = us $ tag (TagGroup 0x0028) (TagElement 0x1103)++graylookuptabledataret :: B.ByteString -> Element+graylookuptabledataret = us $ tag (TagGroup 0x0028) (TagElement 0x1200)++redpalettecolorlookuptabledata :: B.ByteString -> Element+redpalettecolorlookuptabledata = us $ tag (TagGroup 0x0028) (TagElement 0x1201)++greenpalettecolorlookuptabledata :: B.ByteString -> Element+greenpalettecolorlookuptabledata = us $ tag (TagGroup 0x0028) (TagElement 0x1202)++bluepalettecolorlookuptabledata :: B.ByteString -> Element+bluepalettecolorlookuptabledata = us $ tag (TagGroup 0x0028) (TagElement 0x1203)++modalitylutsequence :: [SequenceItem] -> Element+modalitylutsequence = sq $ tag (TagGroup 0x0028) (TagElement 0x3000)++lutdescriptor :: B.ByteString -> Element+lutdescriptor = us $ tag (TagGroup 0x0028) (TagElement 0x3002)++lutexplanation :: String -> Element+lutexplanation = lo $ tag (TagGroup 0x0028) (TagElement 0x3003)++madalityluttype :: String -> Element+madalityluttype = lo $ tag (TagGroup 0x0028) (TagElement 0x3004)++lutdata :: B.ByteString -> Element+lutdata = us $ tag (TagGroup 0x0028) (TagElement 0x3006)++voilutsequence :: [SequenceItem] -> Element+voilutsequence = sq $ tag (TagGroup 0x0028) (TagElement 0x3010)++group0028commentsret :: String -> Element+group0028commentsret = sh $ tag (TagGroup 0x0028) (TagElement 0x4000)++group0032length :: B.ByteString -> Element+group0032length = ul $ tag (TagGroup 0x0032) (TagElement 0x0000)++studystatusid :: String -> Element+studystatusid = cs $ tag (TagGroup 0x0032) (TagElement 0x000A)++studypriorityid :: String -> Element+studypriorityid = cs $ tag (TagGroup 0x0032) (TagElement 0x000C)++studyidissuer :: String -> Element+studyidissuer = lo $ tag (TagGroup 0x0032) (TagElement 0x0012)++studyverifieddate :: UTCTime -> Element+studyverifieddate = da $ tag (TagGroup 0x0032) (TagElement 0x0032)++studyverifiedtime :: UTCTime -> Element+studyverifiedtime = tm $ tag (TagGroup 0x0032) (TagElement 0x0033)++studyreaddate :: UTCTime -> Element+studyreaddate = da $ tag (TagGroup 0x0032) (TagElement 0x0034)++studyreadtime :: UTCTime -> Element+studyreadtime = tm $ tag (TagGroup 0x0032) (TagElement 0x0035)++scheduledstudystartdate :: UTCTime -> Element+scheduledstudystartdate = da $ tag (TagGroup 0x0032) (TagElement 0x1000)++scheduledstudystarttime :: UTCTime -> Element+scheduledstudystarttime = tm $ tag (TagGroup 0x0032) (TagElement 0x1001)++scheduledstudystopdate :: UTCTime -> Element+scheduledstudystopdate = da $ tag (TagGroup 0x0032) (TagElement 0x1010)++scheduledstudystoptime :: UTCTime -> Element+scheduledstudystoptime = tm $ tag (TagGroup 0x0032) (TagElement 0x1011)++scheduledstudylocation :: String -> Element+scheduledstudylocation = lo $ tag (TagGroup 0x0032) (TagElement 0x1020)++scheduledstudylocationaetitles :: String -> Element+scheduledstudylocationaetitles = ae $ tag (TagGroup 0x0032) (TagElement 0x1021)++reasonforstudy :: String -> Element+reasonforstudy = lo $ tag (TagGroup 0x0032) (TagElement 0x1030)++requestingphysician :: String -> Element+requestingphysician = pn $ tag (TagGroup 0x0032) (TagElement 0x1032)++requestingservice :: String -> Element+requestingservice = lo $ tag (TagGroup 0x0032) (TagElement 0x1033)++studyarrivaldate :: UTCTime -> Element+studyarrivaldate = da $ tag (TagGroup 0x0032) (TagElement 0x1040)++studyarrivaltime :: UTCTime -> Element+studyarrivaltime = tm $ tag (TagGroup 0x0032) (TagElement 0x1041)++studycompletiondate :: UTCTime -> Element+studycompletiondate = da $ tag (TagGroup 0x0032) (TagElement 0x1050)++studycompletiontime :: UTCTime -> Element+studycompletiontime = tm $ tag (TagGroup 0x0032) (TagElement 0x1051)++studycomponentstatusid :: String -> Element+studycomponentstatusid = cs $ tag (TagGroup 0x0032) (TagElement 0x1055)++requestedproceduredescription :: String -> Element+requestedproceduredescription = lo $ tag (TagGroup 0x0032) (TagElement 0x1060)++requestedprocedurecodesequence :: [SequenceItem] -> Element+requestedprocedurecodesequence = sq $ tag (TagGroup 0x0032) (TagElement 0x1064)++requestedcontrastagent :: String -> Element+requestedcontrastagent = lo $ tag (TagGroup 0x0032) (TagElement 0x1070)++studycomments :: String -> Element+studycomments = lt $ tag (TagGroup 0x0032) (TagElement 0x4000)++group0038length :: B.ByteString -> Element+group0038length = ul $ tag (TagGroup 0x0038) (TagElement 0x0000)++referencedpatientaliassequence :: [SequenceItem] -> Element+referencedpatientaliassequence = sq $ tag (TagGroup 0x0038) (TagElement 0x0004)++visitstatusid :: String -> Element+visitstatusid = cs $ tag (TagGroup 0x0038) (TagElement 0x0008)++admissinid :: String -> Element+admissinid = lo $ tag (TagGroup 0x0038) (TagElement 0x0010)++issuerofadmissionid :: String -> Element+issuerofadmissionid = lo $ tag (TagGroup 0x0038) (TagElement 0x0011)++routeofadmissions :: String -> Element+routeofadmissions = lo $ tag (TagGroup 0x0038) (TagElement 0x0016)++scheduledadmissindate :: UTCTime -> Element+scheduledadmissindate = da $ tag (TagGroup 0x0038) (TagElement 0x001A)++scheduledadissiontime :: UTCTime -> Element+scheduledadissiontime = tm $ tag (TagGroup 0x0038) (TagElement 0x001B)++scheduleddischargedate :: UTCTime -> Element+scheduleddischargedate = da $ tag (TagGroup 0x0038) (TagElement 0x001C)++scheduleddischargetime :: UTCTime -> Element+scheduleddischargetime = tm $ tag (TagGroup 0x0038) (TagElement 0x001D)++scheduledpatientinstitutionresidence :: String -> Element+scheduledpatientinstitutionresidence = lo $ tag (TagGroup 0x0038) (TagElement 0x001E)++admittingdate :: UTCTime -> Element+admittingdate = da $ tag (TagGroup 0x0038) (TagElement 0x0020)++admittingtime :: UTCTime -> Element+admittingtime = tm $ tag (TagGroup 0x0038) (TagElement 0x0021)++dischargedate :: UTCTime -> Element+dischargedate = da $ tag (TagGroup 0x0038) (TagElement 0x0030)++dischargetime :: UTCTime -> Element+dischargetime = tm $ tag (TagGroup 0x0038) (TagElement 0x0032)++dischargediagnosisdescription :: String -> Element+dischargediagnosisdescription = lo $ tag (TagGroup 0x0038) (TagElement 0x0040)++dischargediagnosiscodesequence :: [SequenceItem] -> Element+dischargediagnosiscodesequence = sq $ tag (TagGroup 0x0038) (TagElement 0x0044)++specialneeds :: String -> Element+specialneeds = lo $ tag (TagGroup 0x0038) (TagElement 0x0050)++currentpatientlocation :: String -> Element+currentpatientlocation = lo $ tag (TagGroup 0x0038) (TagElement 0x0300)++patientsinstitutionresidence :: String -> Element+patientsinstitutionresidence = lo $ tag (TagGroup 0x0038) (TagElement 0x0400)++patientstate :: String -> Element+patientstate = lo $ tag (TagGroup 0x0038) (TagElement 0x0500)++visitcomments :: String -> Element+visitcomments = lt $ tag (TagGroup 0x0038) (TagElement 0x4000)++relationshiptype :: String -> Element+relationshiptype = cs $ tag (TagGroup 0x0040) (TagElement 0xA010)++conceptcodesequence :: [SequenceItem] -> Element+conceptcodesequence = sq $ tag (TagGroup 0x0040) (TagElement 0xA168)++currentrequestedprocedureevidencesequence :: [SequenceItem] -> Element+currentrequestedprocedureevidencesequence = sq $ tag (TagGroup 0x0040) (TagElement 0xA375)++valuetype :: String -> Element+valuetype = cs $ tag (TagGroup 0x0040) (TagElement 0xA040)++conceptnamecodesequence :: [SequenceItem] -> Element+conceptnamecodesequence = sq $ tag (TagGroup 0x0040) (TagElement 0xA043)++continuityofcontent :: String -> Element+continuityofcontent = cs $ tag (TagGroup 0x0040) (TagElement 0xA050)++contentsequence :: [SequenceItem] -> Element+contentsequence = sq $ tag (TagGroup 0x0040) (TagElement 0xA730)++group0088length :: B.ByteString -> Element+group0088length = ul $ tag (TagGroup 0x0088) (TagElement 0x0000)++storagemediafilesetid :: String -> Element+storagemediafilesetid = sh $ tag (TagGroup 0x0088) (TagElement 0x0130)++storagemediafilesetuid :: String -> Element+storagemediafilesetuid = ui $ tag (TagGroup 0x0088) (TagElement 0x0140)++group2000length :: B.ByteString -> Element+group2000length = ul $ tag (TagGroup 0x2000) (TagElement 0x0000)++numberofcopies :: Int -> Element+numberofcopies = is $ tag (TagGroup 0x2000) (TagElement 0x0010)++printpriority :: String -> Element+printpriority = cs $ tag (TagGroup 0x2000) (TagElement 0x0020)++mediumtype :: String -> Element+mediumtype = cs $ tag (TagGroup 0x2000) (TagElement 0x0030)++filmdestination :: String -> Element+filmdestination = cs $ tag (TagGroup 0x2000) (TagElement 0x0040)++filmsessionlabel :: String -> Element+filmsessionlabel = lo $ tag (TagGroup 0x2000) (TagElement 0x0050)++memoryallocation :: Int -> Element+memoryallocation = is $ tag (TagGroup 0x2000) (TagElement 0x0060)++referencedfilmboxsequence :: [SequenceItem] -> Element+referencedfilmboxsequence = sq $ tag (TagGroup 0x2000) (TagElement 0x0500)++group2010length :: B.ByteString -> Element+group2010length = ul $ tag (TagGroup 0x2010) (TagElement 0x0000)++imagedisplayformat :: B.ByteString -> Element+imagedisplayformat = st $ tag (TagGroup 0x2010) (TagElement 0x0010)++annotationdisplayformatid :: String -> Element+annotationdisplayformatid = cs $ tag (TagGroup 0x2010) (TagElement 0x0030)++filmorientation :: String -> Element+filmorientation = cs $ tag (TagGroup 0x2010) (TagElement 0x0040)++filmsizeid :: String -> Element+filmsizeid = cs $ tag (TagGroup 0x2010) (TagElement 0x0050)++magnificationtype :: String -> Element+magnificationtype = cs $ tag (TagGroup 0x2010) (TagElement 0x0060)++smoothingtype :: String -> Element+smoothingtype = cs $ tag (TagGroup 0x2010) (TagElement 0x0080)++borderdensity :: String -> Element+borderdensity = cs $ tag (TagGroup 0x2010) (TagElement 0x0100)++emptyimagedensity :: String -> Element+emptyimagedensity = cs $ tag (TagGroup 0x2010) (TagElement 0x0110)++mindensity :: B.ByteString -> Element+mindensity = us $ tag (TagGroup 0x2010) (TagElement 0x0120)++maxdensity :: B.ByteString -> Element+maxdensity = us $ tag (TagGroup 0x2010) (TagElement 0x0130)++trim :: String -> Element+trim = cs $ tag (TagGroup 0x2010) (TagElement 0x0140)++configurationinformation :: B.ByteString -> Element+configurationinformation = st $ tag (TagGroup 0x2010) (TagElement 0x0150)++referencedfilmsessionsequence :: [SequenceItem] -> Element+referencedfilmsessionsequence = sq $ tag (TagGroup 0x2010) (TagElement 0x0500)++referencedbasicimageboxsequence :: [SequenceItem] -> Element+referencedbasicimageboxsequence = sq $ tag (TagGroup 0x2010) (TagElement 0x0510)++referencedbasicannotationboxsequence :: [SequenceItem] -> Element+referencedbasicannotationboxsequence = sq $ tag (TagGroup 0x2010) (TagElement 0x0520)++group2020length :: B.ByteString -> Element+group2020length = ul $ tag (TagGroup 0x2020) (TagElement 0x0000)++imageposition :: B.ByteString -> Element+imageposition = us $ tag (TagGroup 0x2020) (TagElement 0x0010)++polarity :: String -> Element+polarity = cs $ tag (TagGroup 0x2020) (TagElement 0x0020)++requestedimagesize :: B.ByteString -> Element+requestedimagesize = ds $ tag (TagGroup 0x2020) (TagElement 0x0030)++preformattedgreyscaleimagesequence :: [SequenceItem] -> Element+preformattedgreyscaleimagesequence = sq $ tag (TagGroup 0x2020) (TagElement 0x0110)++preformattedcolorimagesequence :: [SequenceItem] -> Element+preformattedcolorimagesequence = sq $ tag (TagGroup 0x2020) (TagElement 0x0111)++referencedimageoverlayboxsequence :: [SequenceItem] -> Element+referencedimageoverlayboxsequence = sq $ tag (TagGroup 0x2020) (TagElement 0x0130)++referencedvoilutsequence :: [SequenceItem] -> Element+referencedvoilutsequence = sq $ tag (TagGroup 0x2020) (TagElement 0x0140)++group2030length :: B.ByteString -> Element+group2030length = ul $ tag (TagGroup 0x2030) (TagElement 0x0000)++annotationposition :: B.ByteString -> Element+annotationposition = us $ tag (TagGroup 0x2030) (TagElement 0x0010)++textstring :: String -> Element+textstring = lo $ tag (TagGroup 0x2030) (TagElement 0x0020)++group2040length :: B.ByteString -> Element+group2040length = ul $ tag (TagGroup 0x2040) (TagElement 0x0000)++referencedoverlayplanesequence :: [SequenceItem] -> Element+referencedoverlayplanesequence = sq $ tag (TagGroup 0x2040) (TagElement 0x0010)++refencedoverlayplanegroups :: B.ByteString -> Element+refencedoverlayplanegroups = us $ tag (TagGroup 0x2040) (TagElement 0x0011)++overlaymagnificationtype :: String -> Element+overlaymagnificationtype = cs $ tag (TagGroup 0x2040) (TagElement 0x0060)++overlaysmoothingtype :: String -> Element+overlaysmoothingtype = cs $ tag (TagGroup 0x2040) (TagElement 0x0070)++overlayforegrounddensity :: String -> Element+overlayforegrounddensity = cs $ tag (TagGroup 0x2040) (TagElement 0x0080)++overlaymode :: String -> Element+overlaymode = cs $ tag (TagGroup 0x2040) (TagElement 0x0090)++thresholddensity :: String -> Element+thresholddensity = cs $ tag (TagGroup 0x2040) (TagElement 0x0100)++referencedimageboxsequence :: [SequenceItem] -> Element+referencedimageboxsequence = sq $ tag (TagGroup 0x2040) (TagElement 0x0500)++group2100length :: B.ByteString -> Element+group2100length = ul $ tag (TagGroup 0x2100) (TagElement 0x0000)++executionstatus :: String -> Element+executionstatus = cs $ tag (TagGroup 0x2100) (TagElement 0x0020)++executionstatusinfo :: String -> Element+executionstatusinfo = cs $ tag (TagGroup 0x2100) (TagElement 0x0030)++creationdate :: UTCTime -> Element+creationdate = da $ tag (TagGroup 0x2100) (TagElement 0x0040)++creationtime :: UTCTime -> Element+creationtime = tm $ tag (TagGroup 0x2100) (TagElement 0x0050)++originator :: String -> Element+originator = ae $ tag (TagGroup 0x2100) (TagElement 0x0070)++referencedprintjobsequence :: [SequenceItem] -> Element+referencedprintjobsequence = sq $ tag (TagGroup 0x2100) (TagElement 0x0500)++group2110length :: B.ByteString -> Element+group2110length = ul $ tag (TagGroup 0x2110) (TagElement 0x0000)++printerstatus :: String -> Element+printerstatus = cs $ tag (TagGroup 0x2110) (TagElement 0x0010)++printerstatusinfo :: String -> Element+printerstatusinfo = cs $ tag (TagGroup 0x2110) (TagElement 0x0020)++printername :: B.ByteString -> Element+printername = st $ tag (TagGroup 0x2110) (TagElement 0x0030)++group4000lengthret :: B.ByteString -> Element+group4000lengthret = ul $ tag (TagGroup 0x4000) (TagElement 0x0000)++arbitrayret :: String -> Element+arbitrayret = sh $ tag (TagGroup 0x4000) (TagElement 0x0010)++group4000commentsret :: String -> Element+group4000commentsret = lt $ tag (TagGroup 0x4000) (TagElement 0x4000)++group4008length :: B.ByteString -> Element+group4008length = ul $ tag (TagGroup 0x4008) (TagElement 0x0000)++resultsid :: String -> Element+resultsid = sh $ tag (TagGroup 0x4008) (TagElement 0x0040)++resultsidissuer :: String -> Element+resultsidissuer = lo $ tag (TagGroup 0x4008) (TagElement 0x0042)++referencedinterpretationsequence :: [SequenceItem] -> Element+referencedinterpretationsequence = sq $ tag (TagGroup 0x4008) (TagElement 0x0050)++interpretationrecordeddate :: UTCTime -> Element+interpretationrecordeddate = da $ tag (TagGroup 0x4008) (TagElement 0x0100)++interpretationrecordedtime :: UTCTime -> Element+interpretationrecordedtime = tm $ tag (TagGroup 0x4008) (TagElement 0x0101)++interpretationrecorder :: String -> Element+interpretationrecorder = pn $ tag (TagGroup 0x4008) (TagElement 0x0102)++referencetorecordedsound :: String -> Element+referencetorecordedsound = lo $ tag (TagGroup 0x4008) (TagElement 0x0103)++interpretationtranscriptiontime :: UTCTime -> Element+interpretationtranscriptiontime = da $ tag (TagGroup 0x4008) (TagElement 0x0108)++interpretationtranscriber :: String -> Element+interpretationtranscriber = pn $ tag (TagGroup 0x4008) (TagElement 0x010A)++interpretationtext :: B.ByteString -> Element+interpretationtext = st $ tag (TagGroup 0x4008) (TagElement 0x010B)++interpretationauthor :: String -> Element+interpretationauthor = pn $ tag (TagGroup 0x4008) (TagElement 0x010C)++interpretationapproversequence :: [SequenceItem] -> Element+interpretationapproversequence = sq $ tag (TagGroup 0x4008) (TagElement 0x0111)++interpretationapprovaldate :: UTCTime -> Element+interpretationapprovaldate = da $ tag (TagGroup 0x4008) (TagElement 0x0112)++interpretationapprovaltime :: UTCTime -> Element+interpretationapprovaltime = tm $ tag (TagGroup 0x4008) (TagElement 0x0113)++physicianapprovinginterpretation :: String -> Element+physicianapprovinginterpretation = pn $ tag (TagGroup 0x4008) (TagElement 0x0114)++interpretationdiagnosisdescription :: String -> Element+interpretationdiagnosisdescription = lt $ tag (TagGroup 0x4008) (TagElement 0x0115)++diagnosiscodesequence :: [SequenceItem] -> Element+diagnosiscodesequence = sq $ tag (TagGroup 0x4008) (TagElement 0x0117)++resultsdistributionlistsequence :: [SequenceItem] -> Element+resultsdistributionlistsequence = sq $ tag (TagGroup 0x4008) (TagElement 0x0118)++distributionname :: String -> Element+distributionname = pn $ tag (TagGroup 0x4008) (TagElement 0x0119)++distributionaddress :: String -> Element+distributionaddress = lo $ tag (TagGroup 0x4008) (TagElement 0x011A)++interpretationid :: String -> Element+interpretationid = sh $ tag (TagGroup 0x4008) (TagElement 0x0200)++interpretationidissuer :: String -> Element+interpretationidissuer = lo $ tag (TagGroup 0x4008) (TagElement 0x0202)++interpretationtypeid :: String -> Element+interpretationtypeid = cs $ tag (TagGroup 0x4008) (TagElement 0x0210)++interpretationstatusid :: String -> Element+interpretationstatusid = cs $ tag (TagGroup 0x4008) (TagElement 0x0212)++impression :: B.ByteString -> Element+impression = st $ tag (TagGroup 0x4008) (TagElement 0x0300)++group4008comments :: String -> Element+group4008comments = sh $ tag (TagGroup 0x4008) (TagElement 0x4000)++group5000length :: B.ByteString -> Element+group5000length = ul $ tag (TagGroup 0x5000) (TagElement 0x0000)++curvedimensions :: B.ByteString -> Element+curvedimensions = us $ tag (TagGroup 0x5000) (TagElement 0x0005)++numberofpoints :: B.ByteString -> Element+numberofpoints = us $ tag (TagGroup 0x5000) (TagElement 0x0010)++typeofdata :: String -> Element+typeofdata = cs $ tag (TagGroup 0x5000) (TagElement 0x0020)++curvedescription :: String -> Element+curvedescription = lo $ tag (TagGroup 0x5000) (TagElement 0x0022)++axisunits :: String -> Element+axisunits = sh $ tag (TagGroup 0x5000) (TagElement 0x0030)++axislabels :: String -> Element+axislabels = sh $ tag (TagGroup 0x5000) (TagElement 0x0040)++datavaluerepresentation :: B.ByteString -> Element+datavaluerepresentation = us $ tag (TagGroup 0x5000) (TagElement 0x0103)++minimumcoordinatevalue :: B.ByteString -> Element+minimumcoordinatevalue = us $ tag (TagGroup 0x5000) (TagElement 0x0104)++maximumcoordinatevalue :: B.ByteString -> Element+maximumcoordinatevalue = us $ tag (TagGroup 0x5000) (TagElement 0x0105)++curverange :: String -> Element+curverange = sh $ tag (TagGroup 0x5000) (TagElement 0x0106)++curvedatadescriptor :: B.ByteString -> Element+curvedatadescriptor = us $ tag (TagGroup 0x5000) (TagElement 0x0110)++coordinatestartvalue :: B.ByteString -> Element+coordinatestartvalue = us $ tag (TagGroup 0x5000) (TagElement 0x0112)++coordinatestepvalue :: B.ByteString -> Element+coordinatestepvalue = us $ tag (TagGroup 0x5000) (TagElement 0x0114)++audiotype :: B.ByteString -> Element+audiotype = us $ tag (TagGroup 0x5000) (TagElement 0x2000)++audiosampleformat :: B.ByteString -> Element+audiosampleformat = us $ tag (TagGroup 0x5000) (TagElement 0x2002)++numberofchannels :: B.ByteString -> Element+numberofchannels = us $ tag (TagGroup 0x5000) (TagElement 0x2004)++numberofsamples :: B.ByteString -> Element+numberofsamples = ul $ tag (TagGroup 0x5000) (TagElement 0x2006)++samplerate :: B.ByteString -> Element+samplerate = ul $ tag (TagGroup 0x5000) (TagElement 0x2008)++totaltime :: B.ByteString -> Element+totaltime = ul $ tag (TagGroup 0x5000) (TagElement 0x200A)++audiosampledata :: B.ByteString -> Element+audiosampledata = ob $ tag (TagGroup 0x5000) (TagElement 0x200C)++audiocomments :: String -> Element+audiocomments = lt $ tag (TagGroup 0x5000) (TagElement 0x200E)++curvedata :: B.ByteString -> Element+curvedata = ob $ tag (TagGroup 0x5000) (TagElement 0x3000)++group6000length :: B.ByteString -> Element+group6000length = ul $ tag (TagGroup 0x6000) (TagElement 0x0000)++numberofframesinoverlay :: Int -> Element+numberofframesinoverlay = is $ tag (TagGroup 0x6000) (TagElement 0x0015)++overlaytype :: String -> Element+overlaytype = cs $ tag (TagGroup 0x6000) (TagElement 0x0040)++origin :: B.ByteString -> Element+origin = ss $ tag (TagGroup 0x6000) (TagElement 0x0050)++bitposition :: B.ByteString -> Element+bitposition = us $ tag (TagGroup 0x6000) (TagElement 0x0102)++overlayformatret :: String -> Element+overlayformatret = sh $ tag (TagGroup 0x6000) (TagElement 0x0110)++overlaylocationret :: B.ByteString -> Element+overlaylocationret = us $ tag (TagGroup 0x6000) (TagElement 0x0200)++overlaydescriptorgray :: B.ByteString -> Element+overlaydescriptorgray = us $ tag (TagGroup 0x6000) (TagElement 0x1100)++overlaydescriptorred :: B.ByteString -> Element+overlaydescriptorred = us $ tag (TagGroup 0x6000) (TagElement 0x1101)++overlaydescriptorgreen :: B.ByteString -> Element+overlaydescriptorgreen = us $ tag (TagGroup 0x6000) (TagElement 0x1102)++overlaydescriptorblue :: B.ByteString -> Element+overlaydescriptorblue = us $ tag (TagGroup 0x6000) (TagElement 0x1103)++overlaysgray :: B.ByteString -> Element+overlaysgray = us $ tag (TagGroup 0x6000) (TagElement 0x1200)++overlaysred :: B.ByteString -> Element+overlaysred = us $ tag (TagGroup 0x6000) (TagElement 0x1201)++overlaysgreen :: B.ByteString -> Element+overlaysgreen = us $ tag (TagGroup 0x6000) (TagElement 0x1202)++overlaysblue :: B.ByteString -> Element+overlaysblue = us $ tag (TagGroup 0x6000) (TagElement 0x1203)++roiarea :: Int -> Element+roiarea = is $ tag (TagGroup 0x6000) (TagElement 0x1301)++roimean :: B.ByteString -> Element+roimean = ds $ tag (TagGroup 0x6000) (TagElement 0x1302)++roistandarddeviation :: B.ByteString -> Element+roistandarddeviation = ds $ tag (TagGroup 0x6000) (TagElement 0x1303)++overlaydata :: B.ByteString -> Element+overlaydata = ow $ tag (TagGroup 0x6000) (TagElement 0x3000)++group6000commentsret :: String -> Element+group6000commentsret = sh $ tag (TagGroup 0x6000) (TagElement 0x4000)++group7fe0length :: B.ByteString -> Element+group7fe0length = ul $ tag (TagGroup 0x7FE0) (TagElement 0x0000)++pixeldata :: B.ByteString -> Element+pixeldata = ob $ tag (TagGroup 0x7FE0) (TagElement 0x0010)+
+ src/Data/DICOM/FileMetaInformation.hs view
@@ -0,0 +1,40 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.FileMetaInformation+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-- | Functions for dealing with the file meta info header.+--+-----------------------------------------------------------------------------++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}++module Data.DICOM.FileMetaInformation ( fileMetaInformation ) where++import Data.DICOM.Object+import Data.DICOM.Dictionary++import Data.String++data FileMetaInformation = FileMetaInformation+  { fmiSOPClassUID :: String+  , fmiSOPInstanceUID :: String+  , fmiTransferSyntaxUID :: String+  , fmiSOPImplementationClassUID :: String+  } deriving (Show, Eq, Ord)++fileMetaInformation :: FileMetaInformation -> Object+fileMetaInformation FileMetaInformation{..} = object+  [ filemetainformationversion  "\0\1"+  , mediastoredsopclassuid      $ fromString fmiSOPClassUID+  , mediastoredsopinstanceuid   $ fromString fmiSOPInstanceUID+  , transfersyntaxuid           $ fromString fmiTransferSyntaxUID+  , implementationclassuid      $ fromString fmiSOPImplementationClassUID+  ]+
+ src/Data/DICOM/Object.hs view
@@ -0,0 +1,359 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.Object+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-- | Types and smart constructors for DICOM objects and elements.+--+-----------------------------------------------------------------------------++{-# LANGUAGE PatternSynonyms #-}++module Data.DICOM.Object+  ( ElementContent(..)+  , Element(..)+  , SequenceItem(..)+  , Sequence(..)+  , Object(..)++  , readObject+  , readObjectFromFile+  , writeObject+  , writeObjectToFile++  , element+  , sq+  , item+  , object++  , ae+  , as+  , cs+  , da+  , ds+  , dt+  , fl+  , fd+  , is+  , lo+  , lt+  , ob+  , ow+  , pn+  , sh+  , sl+  , ss+  , st+  , tm+  , ui+  , ul+  , un+  , us+  , ut+  ) where++import Prelude hiding (LT)++import Data.Binary+import Data.Binary.Get+import Data.Binary.Put++import Data.Bool (bool)+import Data.Int (Int64)+import Data.Monoid (Monoid(..), (<>))+import Data.Foldable (traverse_)+import Data.List (sortBy)+import Data.Function (on)++import Data.Time.Clock (UTCTime)+import Data.Time.Format (formatTime)+import System.Locale (defaultTimeLocale)++import Data.DICOM.VL+import Data.DICOM.VR+import Data.DICOM.Tag++import Control.Monad (unless)+import Control.Applicative++import Text.Printf (printf)++import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as BC+import qualified Data.ByteString.Lazy as BL++-- Magic constants++dicm :: B.ByteString+dicm = BC.pack "DICM"++-- Data types++data ElementContent+  = BytesContent B.ByteString+  | SequenceContent Sequence deriving (Show, Eq)++data Element = Element+  { elementTag     :: Tag+  , elementVL      :: VL+  , elementVR      :: VR+  , elementContent :: ElementContent+  } deriving (Show, Eq)++data SequenceItem = SequenceItem+  { sequenceItemLength :: Word32+  , sequenceItemElements :: [Element]+  } deriving (Show, Eq)++newtype Sequence = Sequence { runSequence :: [SequenceItem] } deriving (Show, Eq)++newtype Object = Object { runObject :: [Element] } deriving (Show, Eq)++-- Serialization++instance Binary Element where+  get = do+    _tag <- get+    _vr <- get+    _vl <- if isVLReserved _vr then+             (do skip 2+                 vl . fromIntegral <$> getWord32le)+            else vl . fromIntegral <$> getWord16le+    content <- case _vr of+      SQ -> SequenceContent <$> readSequence _vl+      _  -> case _vl of+              UndefinedValueLength -> failWithOffset "Undefined VL not implemented"+              _ -> do+                bytes <- getByteString $ fromIntegral $ runVL _vl+                return $ BytesContent bytes+    return $ Element _tag _vl _vr content+  put el = do+    put $ elementTag el+    put $ elementVR el+    if isVLReserved (elementVR el) then+        (do putWord16le 0+            putWord32le . fromIntegral . runVL $ elementVL el)+       else putWord16le . fromIntegral . runVL $ elementVL el+    case elementContent el of+      SequenceContent s -> writeSequence (elementVL el) s+      BytesContent bs -> putByteString bs++readSequence :: VL -> Get Sequence+readSequence UndefinedValueLength = do+  els <- untilG (isSequenceDelimitationItem <$> get) get+  SequenceDelimitationItem <- get+  skip 4+  return $ Sequence els+readSequence _vl = Sequence <$> untilByteCount (fromIntegral $ runVL _vl) get++writeSequence :: VL -> Sequence -> Put+writeSequence _vl s = do+  traverse_ put (runSequence s)+  case _vl of+    UndefinedValueLength -> do+      put SequenceDelimitationItem+      putWord32le 0+    _ -> return ()++instance Binary SequenceItem where+  get = do+    t <- get+    case t of+      Item -> do+        itemLength <- getWord32le+        case vl (fromIntegral itemLength) of+          UndefinedValueLength -> do+            els <- untilG (isItemDelimitationItem <$> get) get+            ItemDelimitationItem <- get+            skip 4+            return $ SequenceItem itemLength els+          _ -> do+            els <- untilByteCount (fromIntegral itemLength) get+            return $ SequenceItem itemLength els+      _ -> failWithOffset "Unexpected tag"+  put si = do+    put Item+    putWord32le $ sequenceItemLength si+    traverse_ put $ sequenceItemElements si+    case vl (fromIntegral (sequenceItemLength si)) of+      UndefinedValueLength -> do+        put ItemDelimitationItem+        putWord32le 0+      _ -> return ()++isItemDelimitationItem :: Tag -> Bool+isItemDelimitationItem ItemDelimitationItem = True+isItemDelimitationItem _ = False++isSequenceDelimitationItem :: Tag -> Bool+isSequenceDelimitationItem SequenceDelimitationItem = True+isSequenceDelimitationItem _ = False++untilG :: Get Bool -> Get a -> Get [a]+untilG more a = lookAhead more >>= bool ((:) <$> a <*> untilG more a) (pure [])++untilByteCount :: Int64 -> Get a -> Get [a]+untilByteCount count a = do+  start <- bytesRead+  flip untilG a $ do+    end <- bytesRead+    return (end - start < count)++isVLReserved :: VR -> Bool+isVLReserved OB = True+isVLReserved OW = True+isVLReserved OF = True+isVLReserved SQ = True+isVLReserved UT = True+isVLReserved UN = True+isVLReserved _  = False++instance Binary Object where+  get = do+    skip 128+    header <- getByteString 4+    unless (header == dicm) $ failWithOffset "Invalid DICOM header"+    Object <$> untilG isEmpty get+  put obj = do+    putByteString $ B.replicate 128 0+    putByteString dicm++    let fileMetaInfo = takeWhile ((== TagGroup 0x0002) . tagGroup . elementTag) $ runObject obj+        groupLength = sum $ map (BL.length . encode) fileMetaInfo+    put $ tag (TagGroup 0x0002) (TagElement 0x0000)+    put UL+    putWord16le 4+    putWord32le $ fromIntegral groupLength++    traverse_ put (runObject obj)++failWithOffset :: String -> Get a+failWithOffset msg = do+  offset <- bytesRead+  fail $ "Error at offset " ++ printf "%08x" offset ++ ": " ++ msg++readObject :: BL.ByteString -> Either String Object+readObject bs = case decodeOrFail bs of+  Left  (_   , _, e)                      -> Left e+  Right (rest, _, _) | not (BL.null rest) -> Left "Unconsumed input"+  Right (_   , _, a)                      -> Right a++writeObject :: Object -> BL.ByteString+writeObject = encode++-- File IO++readObjectFromFile :: FilePath -> IO (Either String Object)+readObjectFromFile path = readObject <$> BL.readFile path++writeObjectToFile :: FilePath -> Object -> IO ()+writeObjectToFile path = BL.writeFile path . writeObject++-- Smart constructors for DICOM objects+-- TODO: some of these constructors could benefit from better types++instance Monoid Object where+  mempty = Object []+  mappend (Object es1) (Object es2) = Object (sortBy (compare `on` elementTag) $ es1 ++ es2)++element :: VR -> Tag -> B.ByteString -> Element+element vr tg content = Element tg (vl $ fromIntegral count) vr (BytesContent padded)+  where+  (count, padded) = case B.length content of+                     len | len `mod` 2 == 0 -> (len, content)+                         | otherwise -> (len + 1, content <> BC.pack [padChar])+  padChar | isStringVR vr = ' '+          | otherwise = '\0'++-- String value representations++ae :: Tag -> String -> Element+ae t = element AE t . BC.pack++as :: Tag -> String -> Element+as t = element AS t . BC.pack++cs :: Tag -> String -> Element+cs t = element CS t . BC.pack++ds :: Tag -> B.ByteString -> Element+ds = element DS++fl :: Tag -> B.ByteString -> Element+fl = element FL++fd :: Tag -> B.ByteString -> Element+fd = element FD++is :: Tag -> Int -> Element+is t = element IS t . BC.pack . show++lo :: Tag -> String -> Element+lo t = element LO t . BC.pack++lt :: Tag -> String -> Element+lt t = element LT t . BC.pack++pn :: Tag -> String -> Element+pn t = element PN t . BC.pack++sh :: Tag -> String -> Element+sh t = element SH t . BC.pack++sl :: Tag -> B.ByteString -> Element+sl = element SL++ss :: Tag -> B.ByteString -> Element+ss = element SS++st :: Tag -> B.ByteString -> Element+st = element ST++ui :: Tag -> String -> Element+ui t = element UI t . BC.pack++ul :: Tag -> B.ByteString -> Element+ul = element UL++un :: Tag -> B.ByteString -> Element+un = element UN++us :: Tag -> B.ByteString -> Element+us = element US++ut :: Tag -> B.ByteString -> Element+ut = element UT++-- Binary value representations++ob :: Tag -> B.ByteString -> Element+ob = element OB++ow :: Tag -> B.ByteString -> Element+ow = element OW++-- Date/time value representations++da :: Tag -> UTCTime -> Element+da t = element DA t . BC.pack . formatTime defaultTimeLocale "%Y%m%d"++dt :: Tag -> UTCTime -> Element+dt t = element DT t . BC.pack . formatTime defaultTimeLocale "%Y%m%d%H%M%S.000000&0000"++tm :: Tag -> UTCTime -> Element+tm t = element TM t . BC.pack . formatTime defaultTimeLocale "%H%M%S.000000"++sq :: Tag -> [SequenceItem] -> Element+sq tg items = Element tg UndefinedValueLength SQ (SequenceContent (Sequence items))++item :: [Element] -> SequenceItem+item = SequenceItem (fromIntegral . runVL $ UndefinedValueLength) . sortBy (compare `on` elementTag)++object :: [Element] -> Object+object = Object . sortBy (compare `on` elementTag)+
+ src/Data/DICOM/Pretty.hs view
@@ -0,0 +1,66 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.Pretty+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-----------------------------------------------------------------------------++module Data.DICOM.Pretty (+  ppObject+) where++import Text.Printf+import Text.PrettyPrint ((<>), (<+>))+import qualified Text.PrettyPrint as P++import Data.DICOM.Object+import Data.DICOM.Tag+import Data.DICOM.VL+import Data.DICOM.VR++import qualified Data.ByteString.Char8 as BC++ppElementContent :: P.Doc -> ElementContent -> P.Doc+ppElementContent d (BytesContent bs) = P.hsep [d, P.sizedText 40 $ BC.unpack bs]+ppElementContent d (SequenceContent s) = P.vcat [d, P.nest 4 . P.vcat . map ppSequenceItem . runSequence $ s]++ppSequenceItem :: SequenceItem -> P.Doc+ppSequenceItem si = P.vcat+  [ P.text "Item"+    <+> P.parens ((P.text . show . sequenceItemLength $ si) <> P.text "b")+  , P.vcat (map ppElement $ sequenceItemElements si)+  ]++ppTagGroup :: TagGroup -> P.Doc+ppTagGroup tg = P.text (printf "%04x" $ runTagGroup tg)++ppTagElement :: TagElement -> P.Doc+ppTagElement te = P.text (printf "%04x" $ runTagElement te)++ppTag :: Tag -> P.Doc+ppTag _tag = P.parens $+  ppTagGroup (tagGroup _tag)+  <> P.comma+  <> P.space+  <> ppTagElement (tagElement _tag)++ppVL :: VL -> P.Doc+ppVL = P.sizedText 4 . printf "%4d" . runVL++ppVR :: VR -> P.Doc+ppVR = P.sizedText 2 . show++ppElement :: Element -> P.Doc+ppElement e =+  ppTag (elementTag e)+  <+> ppVL (elementVL e)+  <+> ppVR (elementVR e)+  `ppElementContent` elementContent e++ppObject :: Object -> P.Doc+ppObject (Object els) = P.vcat (map ppElement els)
+ src/Data/DICOM/Tag.hs view
@@ -0,0 +1,73 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.Tag+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-----------------------------------------------------------------------------++{-# LANGUAGE PatternSynonyms #-}++module Data.DICOM.Tag+  ( TagGroup (TagGroup, runTagGroup)+  , TagElement (TagElement, runTagElement)++  , Tag (tagGroup, tagElement)++  , pattern SequenceGroup++  , pattern Item+  , pattern ItemDelimitationItem+  , pattern SequenceDelimitationItem++  , tag+  ) where++import Data.Word+import Data.Binary+import Data.Binary.Get+import Data.Binary.Put++import Control.Applicative++newtype TagGroup = TagGroup { runTagGroup :: Word16 } deriving (Show, Eq, Ord)++newtype TagElement = TagElement { runTagElement :: Word16 } deriving (Show, Eq, Ord)++data Tag = Tag+  { tagGroup   :: TagGroup+  , tagElement :: TagElement+  } deriving (Show, Eq, Ord)++-- Serialization++instance Binary TagGroup where+  get = TagGroup <$> getWord16le+  put = putWord16le . runTagGroup++instance Binary TagElement where+  get = TagElement <$> getWord16le+  put = putWord16le . runTagElement++instance Binary Tag where+  get = Tag <$> get <*> get+  put t = do+    put (tagGroup t)+    put (tagElement t)++-- Special tags++pattern SequenceGroup                = TagGroup 0xFFFE++pattern Item                         = Tag SequenceGroup (TagElement 0xE000)+pattern ItemDelimitationItem         = Tag SequenceGroup (TagElement 0xE00D)+pattern SequenceDelimitationItem     = Tag SequenceGroup (TagElement 0xE0DD)++-- Smart constructors++tag :: TagGroup -> TagElement -> Tag+tag = Tag
+ src/Data/DICOM/VL.hs view
@@ -0,0 +1,36 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.VL+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-----------------------------------------------------------------------------++{-# LANGUAGE PatternSynonyms #-}++module Data.DICOM.VL+  ( VL()++  , runVL++  , pattern UndefinedValueLength++  , vl+  ) where++import Data.Int (Int64)++newtype VL = VL { runVL :: Int64 } deriving (Show, Eq, Ord)++-- Pattern synonyms for matching DICOM magic constants++pattern UndefinedValueLength         = VL 0xFFFFFFFF++-- Smart constructors++vl :: Int64 -> VL+vl = VL
+ src/Data/DICOM/VR.hs view
@@ -0,0 +1,70 @@+-----------------------------------------------------------------------------+--+-- Module      :  Data.DICOM.VR+-- Copyright   :  Copyright (c) DICOM Grid 2015+-- License     :  GPL-3+--+-- Maintainer  :  paf31@cantab.net+-- Stability   :  experimental+-- Portability :+--+-----------------------------------------------------------------------------++module Data.DICOM.VR+  ( VR(..)++  , isStringVR+  ) where++import Prelude hiding (LT)++import Safe++import Data.Binary++data VR+  = AE+  | AS+  | AT+  | CS+  | DA+  | DS+  | DT+  | FL+  | FD+  | IS+  | LO+  | LT+  | OB+  | OF+  | OW+  | PN+  | SH+  | SL+  | SQ+  | SS+  | ST+  | TM+  | UI+  | UL+  | UN+  | US+  | UT deriving (Show, Read, Eq, Ord)++instance Binary VR where+  get = do+    c1 <- get+    c2 <- get+    let code = [c1, c2]+    case readMay code of+      Just res -> return res+      Nothing -> fail $ "Unknown VR: " ++ code+  put vr = do+    let [c1, c2] = show vr+    put c1+    put c2++isStringVR :: VR -> Bool+isStringVR OB = False+isStringVR OW = False+isStringVR _  = True