# HG changeset patch # User Sebastien Jodogne # Date 1433144852 -7200 # Node ID ebc1e38ef615f06c798539798502b7f5a6b105fe initial commit diff -r 000000000000 -r ebc1e38ef615 AUTHORS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AUTHORS Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,33 @@ +Orthanc - A Lightweight, RESTful DICOM Server +============================================= + + +Authors of Orthanc +------------------ + +* Sebastien Jodogne + Department of Medical Physics + University Hospital of Liege + Belgium + + Overall design and lead developer. + + +Client library +-------------- + +The client library of Orthanc is automatically wrapped from the C++ +code using the LAAW software. LAAW is the Lightweight, Automated API +Wrapper from the Jomago team, that comes from the following authors: + +* Sebastien Jodogne +* Alain Mazy +* Benjamin Golinvaux + +LAAW should be soon released as a separate open-source project. + + +Contributors +------------ + +See the file "THANKS" for the occasional contributors. diff -r 000000000000 -r ebc1e38ef615 COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/COPYING Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Instance.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Instance.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,286 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include "../Core/PrecompiledHeaders.h" +#include "Instance.h" + +#include "OrthancConnection.h" + +#include + +namespace OrthancClient +{ + void Instance::DownloadImage() + { + if (reader_.get() == NULL) + { + const char* suffix; + switch (mode_) + { + case Orthanc::ImageExtractionMode_Preview: + suffix = "preview"; + break; + + case Orthanc::ImageExtractionMode_UInt8: + suffix = "image-uint8"; + break; + + case Orthanc::ImageExtractionMode_UInt16: + suffix = "image-uint16"; + break; + + case Orthanc::ImageExtractionMode_Int16: + suffix = "image-int16"; + break; + + default: + throw OrthancClientException(Orthanc::ErrorCode_NotImplemented); + } + + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/instances/" + id_ + "/" + suffix); + std::string png; + + if (!client.Apply(png)) + { + throw OrthancClientException(Orthanc::ErrorCode_NotImplemented); + } + + reader_.reset(new Orthanc::PngReader); + reader_->ReadFromMemory(png); + } + } + + void Instance::DownloadDicom() + { + if (dicom_.get() == NULL) + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/instances/" + id_ + "/file"); + + dicom_.reset(new std::string); + + if (!client.Apply(*dicom_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + } + + Instance::Instance(const OrthancConnection& connection, + const char* id) : + connection_(connection), + id_(id), + mode_(Orthanc::ImageExtractionMode_Int16) + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/instances/" + id_ + "/simplified-tags"); + Json::Value v; + if (!client.Apply(tags_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + + const char* Instance::GetTagAsString(const char* tag) const + { + if (tags_.isMember(tag)) + { + return tags_[tag].asCString(); + } + else + { + throw OrthancClientException(Orthanc::ErrorCode_InexistentItem); + } + } + + float Instance::GetTagAsFloat(const char* tag) const + { + std::string value = GetTagAsString(tag); + + try + { + return boost::lexical_cast(value); + } + catch (boost::bad_lexical_cast) + { + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + } + + int Instance::GetTagAsInt(const char* tag) const + { + std::string value = GetTagAsString(tag); + + try + { + return boost::lexical_cast(value); + } + catch (boost::bad_lexical_cast) + { + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + } + + unsigned int Instance::GetWidth() + { + DownloadImage(); + return reader_->GetWidth(); + } + + unsigned int Instance::GetHeight() + { + DownloadImage(); + return reader_->GetHeight(); + } + + unsigned int Instance::GetPitch() + { + DownloadImage(); + return reader_->GetPitch(); + } + + Orthanc::PixelFormat Instance::GetPixelFormat() + { + DownloadImage(); + return reader_->GetFormat(); + } + + const void* Instance::GetBuffer() + { + DownloadImage(); + return reader_->GetConstBuffer(); + } + + const void* Instance::GetBuffer(unsigned int y) + { + DownloadImage(); + return reader_->GetConstRow(y); + } + + void Instance::DiscardImage() + { + reader_.reset(); + } + + void Instance::DiscardDicom() + { + dicom_.reset(); + } + + + void Instance::SetImageExtractionMode(Orthanc::ImageExtractionMode mode) + { + if (mode_ == mode) + { + return; + } + + DiscardImage(); + mode_ = mode; + } + + + void Instance::SplitVectorOfFloats(std::vector& target, + const char* tag) + { + const std::string value = GetTagAsString(tag); + + target.clear(); + + try + { + std::string tmp; + for (size_t i = 0; i < value.size(); i++) + { + if (value[i] == '\\') + { + target.push_back(boost::lexical_cast(tmp)); + tmp.clear(); + } + else + { + tmp.push_back(value[i]); + } + } + + target.push_back(boost::lexical_cast(tmp)); + } + catch (boost::bad_lexical_cast) + { + // Unable to parse the Image Orientation Patient. + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + } + + + const uint64_t Instance::GetDicomSize() + { + DownloadDicom(); + assert(dicom_.get() != NULL); + return dicom_->size(); + } + + const void* Instance::GetDicom() + { + DownloadDicom(); + assert(dicom_.get() != NULL); + + if (dicom_->size() == 0) + { + return NULL; + } + else + { + return &((*dicom_) [0]); + } + } + + + void Instance::LoadTagContent(const char* path) + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/instances/" + id_ + "/content/" + path); + + if (!client.Apply(content_)) + { + throw OrthancClientException(Orthanc::ErrorCode_UnknownResource); + } + } + + + const char* Instance::GetLoadedTagContent() const + { + return content_.c_str(); + } +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Instance.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Instance.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,202 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include +#include + +#include "OrthancClientException.h" +#include "../Core/IDynamicObject.h" +#include "../Core/ImageFormats/PngReader.h" + +namespace OrthancClient +{ + class OrthancConnection; + + /** + * {summary}{Connection to an instance stored in %Orthanc.} + * {description}{This class encapsulates a connection to an image instance + * from a remote instance of %Orthanc.} + **/ + class LAAW_API Instance : public Orthanc::IDynamicObject + { + private: + const OrthancConnection& connection_; + std::string id_; + Json::Value tags_; + std::auto_ptr reader_; + Orthanc::ImageExtractionMode mode_; + std::auto_ptr dicom_; + std::string content_; + + void DownloadImage(); + + void DownloadDicom(); + + public: + /** + * {summary}{Create a connection to some image instance.} + * {param}{connection The remote instance of %Orthanc.} + * {param}{id The %Orthanc identifier of the image instance.} + **/ + Instance(const OrthancConnection& connection, + const char* id); + + + /** + * {summary}{Get the %Orthanc identifier of this identifier.} + * {returns}{The identifier.} + **/ + const char* GetId() const + { + return id_.c_str(); + } + + + /** + * {summary}{Set the extraction mode for the 2D image corresponding to this instance.} + * {param}{mode The extraction mode.} + **/ + void SetImageExtractionMode(Orthanc::ImageExtractionMode mode); + + /** + * {summary}{Get the extraction mode for the 2D image corresponding to this instance.} + * {returns}{The extraction mode.} + **/ + Orthanc::ImageExtractionMode GetImageExtractionMode() const + { + return mode_; + } + + + /** + * {summary}{Get the string value of some DICOM tag of this instance.} + * {param}{tag The name of the tag of interest.} + * {returns}{The value of the tag.} + **/ + const char* GetTagAsString(const char* tag) const; + + /** + * {summary}{Get the floating point value that is stored in some DICOM tag of this instance.} + * {param}{tag The name of the tag of interest.} + * {returns}{The value of the tag.} + **/ + float GetTagAsFloat(const char* tag) const; + + /** + * {summary}{Get the integer value that is stored in some DICOM tag of this instance.} + * {param}{tag The name of the tag of interest.} + * {returns}{The value of the tag.} + **/ + int32_t GetTagAsInt(const char* tag) const; + + + /** + * {summary}{Get the width of the 2D image.} + * {description}{Get the width of the 2D image that is encoded by this DICOM instance.} + * {returns}{The width.} + **/ + uint32_t GetWidth(); + + /** + * {summary}{Get the height of the 2D image.} + * {description}{Get the height of the 2D image that is encoded by this DICOM instance.} + * {returns}{The height.} + **/ + uint32_t GetHeight(); + + /** + * {summary}{Get the number of bytes between two lines of the image (pitch).} + * {description}{Get the number of bytes between two lines of the image in the memory buffer returned by GetBuffer(). This value depends on the extraction mode for the image.} + * {returns}{The pitch.} + **/ + uint32_t GetPitch(); + + /** + * {summary}{Get the format of the pixels of the 2D image.} + * {description}{Return the memory layout that is used for the 2D image that is encoded by this DICOM instance. This value depends on the extraction mode for the image.} + * {returns}{The pixel format.} + **/ + Orthanc::PixelFormat GetPixelFormat(); + + /** + * {summary}{Access the memory buffer in which the raw pixels of the 2D image are stored.} + * {returns}{A pointer to the memory buffer.} + **/ + const void* GetBuffer(); + + /** + * {summary}{Access the memory buffer in which the raw pixels of some line of the 2D image are stored.} + * {param}{y The line of interest.} + * {returns}{A pointer to the memory buffer.} + **/ + const void* GetBuffer(uint32_t y); + + /** + * {summary}{Get the size of the DICOM file corresponding to this instance.} + * {returns}{The file size.} + **/ + const uint64_t GetDicomSize(); + + /** + * {summary}{Get a pointer to the content of the DICOM file corresponding to this instance.} + * {returns}{The DICOM file.} + **/ + const void* GetDicom(); + + /** + * {summary}{Discard the downloaded 2D image, so as to make room in memory.} + **/ + void DiscardImage(); + + /** + * {summary}{Discard the downloaded DICOM file, so as to make room in memory.} + **/ + void DiscardDicom(); + + LAAW_API_INTERNAL void SplitVectorOfFloats(std::vector& target, + const char* tag); + + /** + * {summary}{Load a raw tag from the DICOM file.} + * {param}{path The path to the tag of interest (e.g. "0020-000d").} + **/ + void LoadTagContent(const char* path); + + /** + * {summary}{Return the value of the raw tag that was loaded by LoadContent.} + * {returns}{The tag value.} + **/ + const char* GetLoadedTagContent() const; + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/OrthancClientException.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/OrthancClientException.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,58 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "../Core/OrthancException.h" +#include + +namespace OrthancClient +{ + class OrthancClientException : public ::Laaw::LaawException + { + public: + OrthancClientException(Orthanc::ErrorCode code) : + LaawException(Orthanc::OrthancException::GetDescription(code)) + { + } + + OrthancClientException(const char* message) : + LaawException(message) + { + } + + OrthancClientException(const std::string& message) : + LaawException(message) + { + } + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/OrthancConnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/OrthancConnection.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,115 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include "../Core/PrecompiledHeaders.h" +#include "OrthancConnection.h" + +#include "../Core/Toolbox.h" + +namespace OrthancClient +{ + void OrthancConnection::ReadPatients() + { + client_.SetMethod(Orthanc::HttpMethod_Get); + client_.SetUrl(orthancUrl_ + "/patients"); + + Json::Value v; + if (!client_.Apply(content_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + + Orthanc::IDynamicObject* OrthancConnection::GetFillerItem(size_t index) + { + Json::Value::ArrayIndex tmp = static_cast(index); + std::string id = content_[tmp].asString(); + return new Patient(*this, id.c_str()); + } + + Patient& OrthancConnection::GetPatient(unsigned int index) + { + return dynamic_cast(patients_.GetItem(index)); + } + + OrthancConnection::OrthancConnection(const char* orthancUrl) : + orthancUrl_(orthancUrl), patients_(*this) + { + ReadPatients(); + } + + OrthancConnection::OrthancConnection(const char* orthancUrl, + const char* username, + const char* password) : + orthancUrl_(orthancUrl), patients_(*this) + { + client_.SetCredentials(username, password); + ReadPatients(); + } + + + void OrthancConnection::Store(const void* dicom, uint64_t size) + { + if (size == 0) + { + return; + } + + client_.SetMethod(Orthanc::HttpMethod_Post); + client_.SetUrl(orthancUrl_ + "/instances"); + + // Copy the DICOM file in the POST body. TODO - Avoid memory copy + client_.AccessPostData().resize(static_cast(size)); + memcpy(&client_.AccessPostData()[0], dicom, static_cast(size)); + + Json::Value v; + if (!client_.Apply(v)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + + Reload(); + } + + + void OrthancConnection::StoreFile(const char* filename) + { + std::string content; + Orthanc::Toolbox::ReadFile(content, filename); + + if (content.size() != 0) + { + Store(&content[0], content.size()); + } + } + +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/OrthancConnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/OrthancConnection.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,180 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "../Core/HttpClient.h" + +#include "Patient.h" + +namespace OrthancClient +{ + /** + * {summary}{Connection to an instance of %Orthanc.} + * {description}{This class encapsulates a connection to a remote instance + * of %Orthanc through its REST API.} + **/ + class LAAW_API OrthancConnection : + public boost::noncopyable, + private Orthanc::ArrayFilledByThreads::IFiller + { + private: + Orthanc::HttpClient client_; + std::string orthancUrl_; + Orthanc::ArrayFilledByThreads patients_; + Json::Value content_; + + void ReadPatients(); + + virtual size_t GetFillerSize() + { + return content_.size(); + } + + virtual Orthanc::IDynamicObject* GetFillerItem(size_t index); + + public: + /** + * {summary}{Create a connection to an instance of %Orthanc.} + * {param}{orthancUrl URL to which the REST API of %Orthanc is listening.} + **/ + OrthancConnection(const char* orthancUrl); + + /** + * {summary}{Create a connection to an instance of %Orthanc, with authentication.} + * {param}{orthancUrl URL to which the REST API of %Orthanc is listening.} + * {param}{username The username.} + * {param}{password The password.} + **/ + OrthancConnection(const char* orthancUrl, + const char* username, + const char* password); + + virtual ~OrthancConnection() + { + } + + /** + * {summary}{Returns the number of threads for this connection.} + * {description}{Returns the number of simultaneous connections + * that are used when downloading information from this instance + * of %Orthanc.} + * {returns}{The number of threads.} + **/ + uint32_t GetThreadCount() const + { + return patients_.GetThreadCount(); + } + + /** + * {summary}{Sets the number of threads for this connection.} + * {description}{Sets the number of simultaneous connections + * that are used when downloading information from this instance + * of %Orthanc.} + * {param}{threadCount The number of threads.} + **/ + void SetThreadCount(uint32_t threadCount) + { + patients_.SetThreadCount(threadCount); + } + + /** + * {summary}{Reload the list of the patients.} + * {description}{This method will reload the list of the patients from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.} + **/ + void Reload() + { + ReadPatients(); + patients_.Invalidate(); + } + + LAAW_API_INTERNAL const Orthanc::HttpClient& GetHttpClient() const + { + return client_; + } + + /** + * {summary}{Returns the URL of this instance of %Orthanc.} + * {description}{Returns the URL of the remote %Orthanc instance to which this object is connected.} + * {returns}{The URL.} + **/ + const char* GetOrthancUrl() const + { + return orthancUrl_.c_str(); + } + + /** + * {summary}{Returns the number of patients.} + * {description}{Returns the number of patients that are stored in the remote instance of %Orthanc.} + * {returns}{The number of patients.} + **/ + uint32_t GetPatientCount() + { + return patients_.GetSize(); + } + + /** + * {summary}{Get some patient.} + * {description}{This method will return an object that contains information about some patient. The patients are indexed by a number between 0 (inclusive) and the result of GetPatientCount() (exclusive).} + * {param}{index The index of the patient of interest.} + * {returns}{The patient.} + **/ + Patient& GetPatient(uint32_t index); + + /** + * {summary}{Delete some patient.} + * {description}{Delete some patient from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.} + * {param}{index The index of the patient of interest.} + * {returns}{The patient.} + **/ + void DeletePatient(uint32_t index) + { + GetPatient(index).Delete(); + Reload(); + } + + /** + * {summary}{Send a DICOM file.} + * {description}{This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.} + * {param}{filename Path to the DICOM file} + **/ + void StoreFile(const char* filename); + + /** + * {summary}{Send a DICOM file that is contained inside a memory buffer.} + * {description}{This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated.} + * {param}{dicom The memory buffer containing the DICOM file.} + * {param}{size The size of the DICOM file.} + **/ + void Store(const void* dicom, uint64_t size); + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/OrthancCppClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/OrthancCppClient.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,53 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +/** + * The sources of the C++ client library must be put in this file to + * avoid problems with precompiled headers. + **/ + +#include "../Core/ChunkedBuffer.cpp" +#include "../Core/Enumerations.cpp" +#include "../Core/HttpClient.cpp" +#include "../Core/ImageFormats/ImageAccessor.cpp" +#include "../Core/ImageFormats/ImageBuffer.cpp" +#include "../Core/ImageFormats/PngReader.cpp" +#include "../Core/MultiThreading/ArrayFilledByThreads.cpp" +#include "../Core/MultiThreading/SharedMessageQueue.cpp" +#include "../Core/MultiThreading/ThreadedCommandProcessor.cpp" +#include "../Core/OrthancException.cpp" +#include "../Core/Toolbox.cpp" +#include "../OrthancCppClient/Instance.cpp" +#include "../OrthancCppClient/OrthancConnection.cpp" +#include "../OrthancCppClient/Patient.cpp" +#include "../OrthancCppClient/Series.cpp" +#include "../OrthancCppClient/Study.cpp" diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Patient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Patient.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,93 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include "../Core/PrecompiledHeaders.h" +#include "Patient.h" + +#include "OrthancConnection.h" + +namespace OrthancClient +{ + void Patient::ReadPatient() + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/patients/" + id_); + + Json::Value v; + if (!client.Apply(patient_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + + Orthanc::IDynamicObject* Patient::GetFillerItem(size_t index) + { + Json::Value::ArrayIndex tmp = static_cast(index); + std::string id = patient_["Studies"][tmp].asString(); + return new Study(connection_, id.c_str()); + } + + Patient::Patient(const OrthancConnection& connection, + const char* id) : + connection_(connection), + id_(id), + studies_(*this) + { + studies_.SetThreadCount(connection.GetThreadCount()); + ReadPatient(); + } + + const char* Patient::GetMainDicomTag(const char* tag, const char* defaultValue) const + { + if (patient_["MainDicomTags"].isMember(tag)) + { + return patient_["MainDicomTags"][tag].asCString(); + } + else + { + return defaultValue; + } + } + + void Patient::Delete() + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetMethod(Orthanc::HttpMethod_Delete); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/patients/" + id_); + + std::string s; + if (!client.Apply(s)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Patient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Patient.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,121 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "Study.h" + +namespace OrthancClient +{ + /** + * {summary}{Connection to a patient stored in %Orthanc.} + * {description}{This class encapsulates a connection to a patient + * from a remote instance of %Orthanc.} + **/ + class LAAW_API Patient : + public Orthanc::IDynamicObject, + private Orthanc::ArrayFilledByThreads::IFiller + { + private: + const OrthancConnection& connection_; + std::string id_; + Json::Value patient_; + Orthanc::ArrayFilledByThreads studies_; + + void ReadPatient(); + + virtual size_t GetFillerSize() + { + return patient_["Studies"].size(); + } + + virtual Orthanc::IDynamicObject* GetFillerItem(size_t index); + + public: + /** + * {summary}{Create a connection to some patient.} + * {param}{connection The remote instance of %Orthanc.} + * {param}{id The %Orthanc identifier of the patient.} + **/ + Patient(const OrthancConnection& connection, + const char* id); + + /** + * {summary}{Reload the studies of this patient.} + * {description}{This method will reload the list of the studies of this patient. Pay attention to the fact that the studies that have been previously returned by GetStudy() will be invalidated.} + **/ + void Reload() + { + studies_.Reload(); + } + + /** + * {summary}{Return the number of studies for this patient.} + * {returns}{The number of studies.} + **/ + uint32_t GetStudyCount() + { + return studies_.GetSize(); + } + + /** + * {summary}{Get some study of this patient.} + * {description}{This method will return an object that contains information about some study. The studies are indexed by a number between 0 (inclusive) and the result of GetStudyCount() (exclusive).} + * {param}{index The index of the study of interest.} + * {returns}{The study.} + **/ + Study& GetStudy(uint32_t index) + { + return dynamic_cast(studies_.GetItem(index)); + } + + /** + * {summary}{Get the %Orthanc identifier of this patient.} + * {returns}{The identifier.} + **/ + const char* GetId() const + { + return id_.c_str(); + } + + /** + * {summary}{Get the value of one of the main DICOM tags for this patient.} + * {param}{tag The name of the tag of interest ("PatientName", "PatientID", "PatientSex" or "PatientBirthDate").} + * {param}{defaultValue The default value to be returned if this tag does not exist.} + * {returns}{The value of the tag.} + **/ + const char* GetMainDicomTag(const char* tag, + const char* defaultValue) const; + + LAAW_API_INTERNAL void Delete(); + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Series.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Series.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,527 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include "../Core/PrecompiledHeaders.h" +#include "Series.h" + +#include "OrthancConnection.h" + +#include +#include + +namespace OrthancClient +{ + namespace + { + class SliceLocator + { + private: + float normal_[3]; + + public: + SliceLocator(Instance& someSlice) + { + /** + * Compute the slice normal from Image Orientation Patient. + * http://nipy.sourceforge.net/nibabel/dicom/dicom_orientation.html#dicom-z-from-slice + * http://dicomiseasy.blogspot.be/2013/06/getting-oriented-using-image-plane.html + * http://www.itk.org/pipermail/insight-users/2003-September/004762.html + **/ + + std::vector cosines; + someSlice.SplitVectorOfFloats(cosines, "ImageOrientationPatient"); // 0020-0037 + + if (cosines.size() != 6) + { + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + + normal_[0] = cosines[1] * cosines[5] - cosines[2] * cosines[4]; + normal_[1] = cosines[2] * cosines[3] - cosines[0] * cosines[5]; + normal_[2] = cosines[0] * cosines[4] - cosines[1] * cosines[3]; + } + + + /** + * Compute the distance of some slice along the slice normal. + **/ + float ComputeSliceLocation(Instance& instance) const + { + std::vector ipp; + instance.SplitVectorOfFloats(ipp, "ImagePositionPatient"); // 0020-0032 + if (ipp.size() != 3) + { + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + + float dist = 0; + + for (int i = 0; i < 3; i++) + { + dist += normal_[i] * ipp[i]; + } + + return dist; + } + }; + + class ImageDownloadCommand : public Orthanc::ICommand + { + private: + Orthanc::PixelFormat format_; + Orthanc::ImageExtractionMode mode_; + Instance& instance_; + void* target_; + size_t lineStride_; + + public: + ImageDownloadCommand(Instance& instance, + Orthanc::PixelFormat format, + Orthanc::ImageExtractionMode mode, + void* target, + size_t lineStride) : + format_(format), + mode_(mode), + instance_(instance), + target_(target), + lineStride_(lineStride) + { + instance_.SetImageExtractionMode(mode); + } + + virtual bool Execute() + { + using namespace Orthanc; + + unsigned int width = instance_.GetHeight(); + + for (unsigned int y = 0; y < instance_.GetHeight(); y++) + { + uint8_t* p = reinterpret_cast(target_) + y * lineStride_; + + if (instance_.GetPixelFormat() == format_) + { + memcpy(p, instance_.GetBuffer(y), GetBytesPerPixel(instance_.GetPixelFormat()) * instance_.GetWidth()); + } + else if (instance_.GetPixelFormat() == PixelFormat_Grayscale8 && + format_ == PixelFormat_RGB24) + { + const uint8_t* s = reinterpret_cast(instance_.GetBuffer(y)); + for (unsigned int x = 0; x < width; x++, s++, p += 3) + { + p[0] = *s; + p[1] = *s; + p[2] = *s; + } + } + else + { + throw OrthancClientException(ErrorCode_NotImplemented); + } + } + + // Do not keep the image in memory, as we are loading 3D images + instance_.DiscardImage(); + + return true; + } + }; + + + class ProgressToFloatListener : public Orthanc::ThreadedCommandProcessor::IListener + { + private: + float* target_; + + public: + ProgressToFloatListener(float* target) : target_(target) + { + } + + virtual void SignalProgress(unsigned int current, + unsigned int total) + { + if (total == 0) + { + *target_ = 0; + } + else + { + *target_ = static_cast(current) / static_cast(total); + } + } + + virtual void SignalSuccess(unsigned int total) + { + *target_ = 1; + } + + virtual void SignalFailure() + { + *target_ = 0; + } + + virtual void SignalCancel() + { + *target_ = 0; + } + }; + + } + + + void Series::Check3DImage() + { + if (!Is3DImage()) + { + throw OrthancClientException(Orthanc::ErrorCode_NotImplemented); + } + } + + bool Series::Is3DImageInternal() + { + try + { + if (GetInstanceCount() == 0) + { + // Empty image, use some default value (should never happen) + voxelSizeX_ = 1; + voxelSizeY_ = 1; + voxelSizeZ_ = 1; + sliceThickness_ = 1; + + return true; + } + + // Choose a reference slice + Instance& reference = GetInstance(0); + + // Check that all the child instances share the same 3D parameters + for (unsigned int i = 0; i < GetInstanceCount(); i++) + { + Instance& i2 = GetInstance(i); + + if (std::string(reference.GetTagAsString("Columns")) != std::string(i2.GetTagAsString("Columns")) || + std::string(reference.GetTagAsString("Rows")) != std::string(i2.GetTagAsString("Rows")) || + std::string(reference.GetTagAsString("ImageOrientationPatient")) != std::string(i2.GetTagAsString("ImageOrientationPatient")) || + std::string(reference.GetTagAsString("SliceThickness")) != std::string(i2.GetTagAsString("SliceThickness")) || + std::string(reference.GetTagAsString("PixelSpacing")) != std::string(i2.GetTagAsString("PixelSpacing"))) + { + return false; + } + } + + + // Extract X/Y voxel size and slice thickness + std::string s = GetInstance(0).GetTagAsString("PixelSpacing"); // 0028-0030 + size_t pos = s.find('\\'); + assert(pos != std::string::npos); + std::string sy = s.substr(0, pos); + std::string sx = s.substr(pos + 1); + + try + { + voxelSizeX_ = boost::lexical_cast(sx); + voxelSizeY_ = boost::lexical_cast(sy); + } + catch (boost::bad_lexical_cast) + { + throw OrthancClientException(Orthanc::ErrorCode_BadFileFormat); + } + + sliceThickness_ = GetInstance(0).GetTagAsFloat("SliceThickness"); // 0018-0050 + + + // Compute the location of each slice to extract the voxel size along Z + voxelSizeZ_ = std::numeric_limits::infinity(); + + SliceLocator locator(reference); + float referenceSliceLocation = locator.ComputeSliceLocation(reference); + + std::set l; + for (unsigned int i = 0; i < GetInstanceCount(); i++) + { + float location = locator.ComputeSliceLocation(GetInstance(i)); + float distanceToReferenceSlice = fabs(location - referenceSliceLocation); + + l.insert(location); + + if (distanceToReferenceSlice > std::numeric_limits::epsilon() && + distanceToReferenceSlice < voxelSizeZ_) + { + voxelSizeZ_ = distanceToReferenceSlice; + } + } + + + // Make sure that 2 slices do not share the same Z location + return l.size() == GetInstanceCount(); + } + catch (OrthancClientException) + { + return false; + } + } + + void Series::ReadSeries() + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/series/" + id_); + Json::Value v; + if (!client.Apply(series_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + + Orthanc::IDynamicObject* Series::GetFillerItem(size_t index) + { + Json::Value::ArrayIndex tmp = static_cast(index); + std::string id = series_["Instances"][tmp].asString(); + return new Instance(connection_, id.c_str()); + } + + Series::Series(const OrthancConnection& connection, + const char* id) : + connection_(connection), + id_(id), + instances_(*this) + { + ReadSeries(); + status_ = Status3DImage_NotTested; + url_ = std::string(connection_.GetOrthancUrl()) + "/series/" + id_; + + voxelSizeX_ = 0; + voxelSizeY_ = 0; + voxelSizeZ_ = 0; + sliceThickness_ = 0; + + instances_.SetThreadCount(connection.GetThreadCount()); + } + + + bool Series::Is3DImage() + { + if (status_ == Status3DImage_NotTested) + { + status_ = Is3DImageInternal() ? Status3DImage_True : Status3DImage_False; + } + + return status_ == Status3DImage_True; + } + + unsigned int Series::GetInstanceCount() + { + return instances_.GetSize(); + } + + Instance& Series::GetInstance(unsigned int index) + { + return dynamic_cast(instances_.GetItem(index)); + } + + unsigned int Series::GetWidth() + { + Check3DImage(); + + if (GetInstanceCount() == 0) + return 0; + else + return GetInstance(0).GetTagAsInt("Columns"); + } + + unsigned int Series::GetHeight() + { + Check3DImage(); + + if (GetInstanceCount() == 0) + return 0; + else + return GetInstance(0).GetTagAsInt("Rows"); + } + + const char* Series::GetMainDicomTag(const char* tag, const char* defaultValue) const + { + if (series_["MainDicomTags"].isMember(tag)) + { + return series_["MainDicomTags"][tag].asCString(); + } + else + { + return defaultValue; + } + } + + + + void Series::Load3DImageInternal(void* target, + Orthanc::PixelFormat format, + size_t lineStride, + size_t stackStride, + Orthanc::ThreadedCommandProcessor::IListener* listener) + { + using namespace Orthanc; + + // Choose the extraction mode, depending on the format of the + // target image. + + uint8_t bytesPerPixel; + ImageExtractionMode mode; + + switch (format) + { + case PixelFormat_RGB24: + bytesPerPixel = 3; + mode = ImageExtractionMode_Preview; + break; + + case PixelFormat_Grayscale8: + bytesPerPixel = 1; + mode = ImageExtractionMode_UInt8; // Preview ??? + break; + + case PixelFormat_Grayscale16: + bytesPerPixel = 2; + mode = ImageExtractionMode_UInt16; + break; + + case PixelFormat_SignedGrayscale16: + bytesPerPixel = 2; + mode = ImageExtractionMode_UInt16; + format = PixelFormat_Grayscale16; + break; + + default: + throw OrthancClientException(ErrorCode_NotImplemented); + } + + + // Check that the target image is properly sized + unsigned int sx = GetWidth(); + unsigned int sy = GetHeight(); + + if (lineStride < sx * bytesPerPixel || + stackStride < sx * sy * bytesPerPixel) + { + throw OrthancClientException(ErrorCode_BadRequest); + } + + if (sx == 0 || sy == 0 || GetInstanceCount() == 0) + { + // Empty image, nothing to do + if (listener) + listener->SignalSuccess(0); + return; + } + + + /** + * Order the stacks according to their distance along the slice + * normal (using the "Image Position Patient" tag). This works + * even if the "SliceLocation" tag is absent. + **/ + SliceLocator locator(GetInstance(0)); + + typedef std::map Instances; + Instances instances; + for (unsigned int i = 0; i < GetInstanceCount(); i++) + { + float dist = locator.ComputeSliceLocation(GetInstance(i)); + instances[dist] = &GetInstance(i); + } + + if (instances.size() != GetInstanceCount()) + { + // Several instances have the same Z coordinate + throw OrthancClientException(ErrorCode_NotImplemented); + } + + + // Submit the download of each stack as a set of commands + ThreadedCommandProcessor processor(connection_.GetThreadCount()); + + if (listener != NULL) + { + processor.SetListener(*listener); + } + + uint8_t* stackTarget = reinterpret_cast(target); + for (Instances::iterator it = instances.begin(); it != instances.end(); ++it) + { + processor.Post(new ImageDownloadCommand(*it->second, format, mode, stackTarget, lineStride)); + stackTarget += stackStride; + } + + + // Wait for all the stacks to be downloaded + if (!processor.Join()) + { + throw OrthancClientException(ErrorCode_NetworkProtocol); + } + } + + float Series::GetVoxelSizeX() + { + Check3DImage(); // Is3DImageInternal() will compute the voxel sizes + return voxelSizeX_; + } + + float Series::GetVoxelSizeY() + { + Check3DImage(); // Is3DImageInternal() will compute the voxel sizes + return voxelSizeY_; + } + + float Series::GetVoxelSizeZ() + { + Check3DImage(); // Is3DImageInternal() will compute the voxel sizes + return voxelSizeZ_; + } + + float Series::GetSliceThickness() + { + Check3DImage(); // Is3DImageInternal() will compute the voxel sizes + return sliceThickness_; + } + + void Series::Load3DImage(void* target, + Orthanc::PixelFormat format, + int64_t lineStride, + int64_t stackStride, + float* progress) + { + ProgressToFloatListener listener(progress); + Load3DImageInternal(target, format, static_cast(lineStride), + static_cast(stackStride), &listener); + } +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Series.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Series.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,239 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "Instance.h" + +#include "../Core/MultiThreading/ArrayFilledByThreads.h" +#include "../Core/MultiThreading/ThreadedCommandProcessor.h" + +namespace OrthancClient +{ + /** + * {summary}{Connection to a series stored in %Orthanc.} + * {description}{This class encapsulates a connection to a series + * from a remote instance of %Orthanc.} + **/ + class LAAW_API Series : + public Orthanc::IDynamicObject, + private Orthanc::ArrayFilledByThreads::IFiller + { + private: + enum Status3DImage + { + Status3DImage_NotTested, + Status3DImage_True, + Status3DImage_False + }; + + const OrthancConnection& connection_; + std::string id_, url_; + Json::Value series_; + Orthanc::ArrayFilledByThreads instances_; + Status3DImage status_; + + float voxelSizeX_; + float voxelSizeY_; + float voxelSizeZ_; + float sliceThickness_; + + void Check3DImage(); + + bool Is3DImageInternal(); + + void ReadSeries(); + + virtual size_t GetFillerSize() + { + return series_["Instances"].size(); + } + + virtual Orthanc::IDynamicObject* GetFillerItem(size_t index); + + void Load3DImageInternal(void* target, + Orthanc::PixelFormat format, + size_t lineStride, + size_t stackStride, + Orthanc::ThreadedCommandProcessor::IListener* listener); + + public: + /** + * {summary}{Create a connection to some series.} + * {param}{connection The remote instance of %Orthanc.} + * {param}{id The %Orthanc identifier of the series.} + **/ + Series(const OrthancConnection& connection, + const char* id); + + /** + * {summary}{Reload the instances of this series.} + * {description}{This method will reload the list of the instances of this series. Pay attention to the fact that the instances that have been previously returned by GetInstance() will be invalidated.} + **/ + void Reload() + { + instances_.Reload(); + } + + /** + * {summary}{Return the number of instances for this series.} + * {returns}{The number of instances.} + **/ + uint32_t GetInstanceCount(); + + /** + * {summary}{Get some instance of this series.} + * {description}{This method will return an object that contains information about some instance. The instances are indexed by a number between 0 (inclusive) and the result of GetInstanceCount() (exclusive).} + * {param}{index The index of the instance of interest.} + * {returns}{The instance.} + **/ + Instance& GetInstance(uint32_t index); + + /** + * {summary}{Get the %Orthanc identifier of this series.} + * {returns}{The identifier.} + **/ + const char* GetId() const + { + return id_.c_str(); + } + + /** + * {summary}{Returns the URL to this series.} + * {returns}{The URL.} + **/ + const char* GetUrl() const + { + return url_.c_str(); + } + + + /** + * {summary}{Get the value of one of the main DICOM tags for this series.} + * {param}{tag The name of the tag of interest ("Modality", "Manufacturer", "SeriesDate", "SeriesDescription", "SeriesInstanceUID"...).} + * {param}{defaultValue The default value to be returned if this tag does not exist.} + * {returns}{The value of the tag.} + **/ + const char* GetMainDicomTag(const char* tag, + const char* defaultValue) const; + + /** + * {summary}{Test whether this series encodes a 3D image that can be downloaded from %Orthanc.} + * {returns}{"true" if and only if this is a 3D image.} + **/ + bool Is3DImage(); + + /** + * {summary}{Get the width of the 3D image.} + * {description}{Get the width of the 3D image (i.e. along the X-axis). This call is only valid if this series corresponds to a 3D image.} + * {returns}{The width.} + **/ + uint32_t GetWidth(); + + /** + * {summary}{Get the height of the 3D image.} + * {description}{Get the height of the 3D image (i.e. along the Y-axis). This call is only valid if this series corresponds to a 3D image.} + * {returns}{The height.} + **/ + uint32_t GetHeight(); + + /** + * {summary}{Get the physical size of a voxel along the X-axis.} + * {description}{Get the physical size of a voxel along the X-axis. This call is only valid if this series corresponds to a 3D image.} + * {returns}{The voxel size.} + **/ + float GetVoxelSizeX(); + + /** + * {summary}{Get the physical size of a voxel along the Y-axis.} + * {description}{Get the physical size of a voxel along the Y-axis. This call is only valid if this series corresponds to a 3D image.} + * {returns}{The voxel size.} + **/ + float GetVoxelSizeY(); + + /** + * {summary}{Get the physical size of a voxel along the Z-axis.} + * {description}{Get the physical size of a voxel along the Z-axis. This call is only valid if this series corresponds to a 3D image.} + * {returns}{The voxel size.} + **/ + float GetVoxelSizeZ(); + + /** + * {summary}{Get the slice thickness.} + * {description}{Get the slice thickness. This call is only valid if this series corresponds to a 3D image.} + * {returns}{The slice thickness.} + **/ + float GetSliceThickness(); + + LAAW_API_INTERNAL void Load3DImage(void* target, + Orthanc::PixelFormat format, + int64_t lineStride, + int64_t stackStride, + Orthanc::ThreadedCommandProcessor::IListener& listener) + { + Load3DImageInternal(target, format, static_cast(lineStride), + static_cast(stackStride), &listener); + } + + /** + * {summary}{Load the 3D image into a memory buffer.} + * {description}{Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image.} + * {param}{target The target memory buffer.} + * {param}{format The memory layout of the voxels.} + * {param}{lineStride The number of bytes between two lines in the target memory buffer.} + * {param}{stackStride The number of bytes between two 2D slices in the target memory buffer.} + **/ + void Load3DImage(void* target, + Orthanc::PixelFormat format, + int64_t lineStride, + int64_t stackStride) + { + Load3DImageInternal(target, format, static_cast(lineStride), + static_cast(stackStride), NULL); + } + + /** + * {summary}{Load the 3D image into a memory buffer.} + * {description}{Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image. This method will also update a progress indicator to monitor the loading of the image.} + * {param}{target The target memory buffer.} + * {param}{format The memory layout of the voxels.} + * {param}{lineStride The number of bytes between two lines in the target memory buffer.} + * {param}{stackStride The number of bytes between two 2D slices in the target memory buffer.} + * {param}{progress A pointer to a floating-point number that is continuously updated by the download threads to reflect the percentage of completion (between 0 and 1). This value can be read from a separate thread.} + **/ + void Load3DImage(void* target, + Orthanc::PixelFormat format, + int64_t lineStride, + int64_t stackStride, + float* progress); + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/ExternC.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/ExternC.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,1525 @@ +/** + * Laaw - Lightweight, Automated API Wrapper + * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux, + * Sebastien Jodogne + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include +#include // For strcpy() and strlen() +#include // For free() + +static char* LAAW_EXTERNC_CopyString(const char* str) +{ + char* copy = reinterpret_cast(malloc(strlen(str) + 1)); + strcpy(copy, str); + return copy; +} + +extern "C" +{ + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c(void** newObject, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::OrthancConnection(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b(void** newObject, const char* arg0, const char* arg1, const char* arg2) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::OrthancConnection(reinterpret_cast< const char* >(arg0), reinterpret_cast< const char* >(arg1), reinterpret_cast< const char* >(arg2)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + delete static_cast(thisObject); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7(const void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +*result = this_->GetThreadCount(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e(void* thisObject, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +this_->SetThreadCount(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +this_->Reload(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +*result = this_->GetOrthancUrl(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +*result = this_->GetPatientCount(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc(void* thisObject, void** result, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +*result = &this_->GetPatient(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7(void* thisObject, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +this_->DeletePatient(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b(void* thisObject, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +this_->StoreFile(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421(void* thisObject, const void* arg0, uint64_t arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::OrthancConnection* this_ = static_cast(thisObject); +this_->Store(reinterpret_cast< const void* >(arg0), arg1); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919(void** newObject, void* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::Patient(*reinterpret_cast< ::OrthancClient::OrthancConnection* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + delete static_cast(thisObject); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_f756172daf04516eec3a566adabb4335(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Patient* this_ = static_cast(thisObject); +this_->Reload(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Patient* this_ = static_cast(thisObject); +*result = this_->GetStudyCount(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63(void* thisObject, void** result, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Patient* this_ = static_cast(thisObject); +*result = &this_->GetStudy(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Patient* this_ = static_cast(thisObject); +*result = this_->GetId(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701(const void* thisObject, const char** result, const char* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Patient* this_ = static_cast(thisObject); +*result = this_->GetMainDicomTag(reinterpret_cast< const char* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342(void** newObject, void* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::Series(*reinterpret_cast< ::OrthancClient::OrthancConnection* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + delete static_cast(thisObject); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +this_->Reload(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetInstanceCount(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db(void* thisObject, void** result, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = &this_->GetInstance(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetId(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetUrl(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64(const void* thisObject, const char** result, const char* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetMainDicomTag(reinterpret_cast< const char* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3(void* thisObject, int32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->Is3DImage(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetWidth(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetHeight(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0(void* thisObject, float* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetVoxelSizeX(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab(void* thisObject, float* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetVoxelSizeY(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d(void* thisObject, float* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetVoxelSizeZ(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497(void* thisObject, float* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +*result = this_->GetSliceThickness(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5(void* thisObject, void* arg0, int32_t arg1, int64_t arg2, int64_t arg3) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +this_->Load3DImage(reinterpret_cast< void* >(arg0), static_cast< ::Orthanc::PixelFormat >(arg1), arg2, arg3); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c(void* thisObject, void* arg0, int32_t arg1, int64_t arg2, int64_t arg3, float* arg4) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Series* this_ = static_cast(thisObject); +this_->Load3DImage(reinterpret_cast< void* >(arg0), static_cast< ::Orthanc::PixelFormat >(arg1), arg2, arg3, reinterpret_cast< float* >(arg4)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678(void** newObject, void* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::Study(*reinterpret_cast< ::OrthancClient::OrthancConnection* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + delete static_cast(thisObject); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Study* this_ = static_cast(thisObject); +this_->Reload(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Study* this_ = static_cast(thisObject); +*result = this_->GetSeriesCount(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05(void* thisObject, void** result, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Study* this_ = static_cast(thisObject); +*result = &this_->GetSeries(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Study* this_ = static_cast(thisObject); +*result = this_->GetId(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654(const void* thisObject, const char** result, const char* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Study* this_ = static_cast(thisObject); +*result = this_->GetMainDicomTag(reinterpret_cast< const char* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d(void** newObject, void* arg0, const char* arg1) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + *newObject = new OrthancClient::Instance(*reinterpret_cast< ::OrthancClient::OrthancConnection* >(arg0), reinterpret_cast< const char* >(arg1)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + delete static_cast(thisObject); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetId(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146(void* thisObject, int32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +this_->SetImageExtractionMode(static_cast< ::Orthanc::ImageExtractionMode >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda(const void* thisObject, int32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetImageExtractionMode(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484(const void* thisObject, const char** result, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetTagAsString(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb(const void* thisObject, float* result, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetTagAsFloat(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_1729a067d902771517388eedd7346b23(const void* thisObject, int32_t* result, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetTagAsInt(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetWidth(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetHeight(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8(void* thisObject, uint32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetPitch(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c(void* thisObject, int32_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetPixelFormat(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b(void* thisObject, const void** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetBuffer(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef(void* thisObject, const void** result, uint32_t arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetBuffer(arg0); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91(void* thisObject, uint64_t* result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetDicomSize(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e(void* thisObject, const void** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetDicom(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +this_->DiscardImage(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c(void* thisObject) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +this_->DiscardDicom(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd(void* thisObject, const char* arg0) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + OrthancClient::Instance* this_ = static_cast(thisObject); +this_->LoadTagContent(reinterpret_cast< const char* >(arg0)); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + LAAW_EXPORT_DLL_API char* LAAW_CALL_CONVENTION LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb(const void* thisObject, const char** result) + { + try + { + #ifdef LAAW_EXTERNC_START_FUNCTION + LAAW_EXTERNC_START_FUNCTION; + #endif + + const OrthancClient::Instance* this_ = static_cast(thisObject); +*result = this_->GetLoadedTagContent(); + + return NULL; + } + catch (::Laaw::LaawException& e) + { + return LAAW_EXTERNC_CopyString(e.What()); + } + catch (...) + { + return LAAW_EXTERNC_CopyString("..."); + } + } + + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetDescription() + { + return "Native client to the REST API of Orthanc"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetCompany() + { + return "University Hospital of Liege"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetProduct() + { + return "OrthancClient"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetCopyright() + { + return "(c) 2012-2015, Sebastien Jodogne, University Hospital of Liege"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetVersion() + { + return "0.8"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetFileVersion() + { + return "0.8.0.6"; + } + + LAAW_EXPORT_DLL_API const char* LAAW_CALL_CONVENTION LAAW_EXTERNC_GetFullVersion() + { + return "0.8.6"; + } + + LAAW_EXPORT_DLL_API void LAAW_CALL_CONVENTION LAAW_EXTERNC_FreeString(char* str) + { + if (str != NULL) + free(str); + } +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,1817 @@ +/** + * Laaw - Lightweight, Automated API Wrapper + * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux, + * Sebastien Jodogne + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +/** + * @file + **/ + +#pragma once + +#include +#include +#include +#include + +#if defined(_WIN32) + +/******************************************************************** + ** This is the Windows-specific section + ********************************************************************/ + +#include + +/* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */ +#ifdef _M_X64 +/* 64 bits target */ +#define LAAW_ORTHANC_CLIENT_CALL_CONV __fastcall +#define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) Name +#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows64.dll" +#else +/* 32 bits target */ +#define LAAW_ORTHANC_CLIENT_CALL_CONV __stdcall +#define LAAW_ORTHANC_CLIENT_CALL_DECORATION(Name, StdCallSuffix) "_" Name "@" StdCallSuffix +#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "OrthancClient_Windows32.dll" +#endif + +#define LAAW_ORTHANC_CLIENT_HANDLE_TYPE HINSTANCE +#define LAAW_ORTHANC_CLIENT_HANDLE_NULL 0 +#define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE FARPROC +#define LAAW_ORTHANC_CLIENT_LOADER(path) LoadLibraryA(path) +#define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) GetProcAddress(handle, LAAW_ORTHANC_CLIENT_CALL_DECORATION(name, decoration)) +#define LAAW_ORTHANC_CLIENT_CLOSER(handle) FreeLibrary(handle) + + +/******************************************************************** + ** This is the Linux-specific section + ********************************************************************/ + +#elif defined (__linux) + +#include +#include + +/* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */ +#ifdef __amd64__ +#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.8" +#else +#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH "libOrthancClient.so.0.8" +#endif + +#define LAAW_ORTHANC_CLIENT_CALL_CONV +#define LAAW_ORTHANC_CLIENT_HANDLE_TYPE void* +#define LAAW_ORTHANC_CLIENT_HANDLE_NULL NULL +#define LAAW_ORTHANC_CLIENT_FUNCTION_TYPE intptr_t +#define LAAW_ORTHANC_CLIENT_LOADER(path) dlopen(path, RTLD_LAZY) +#define LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle, name, decoration) (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) dlsym(handle, name) +#define LAAW_ORTHANC_CLIENT_CLOSER(handle) dlclose(handle) + + +#else +#error Please support your platform here +#endif + + +/******************************************************************** + ** Definition of the integer types + ********************************************************************/ + +#ifndef LAAW_INT8 // Only define the integer types once + +#if defined(__GNUC__) + +// Under GCC (including MinGW), the stdint.h standard header is used. + +#include + +#define LAAW_INT8 int8_t +#define LAAW_UINT8 uint8_t +#define LAAW_INT16 int16_t +#define LAAW_UINT16 uint16_t +#define LAAW_INT32 int32_t +#define LAAW_UINT32 uint32_t +#define LAAW_INT64 int64_t +#define LAAW_UINT64 uint64_t + +#elif defined(_MSC_VER) + +// Under Visual Studio, it is required to define the various integer +// types by hand. + +#if (_MSC_VER < 1300) +typedef signed char LAAW_INT8; +typedef signed short LAAW_INT16; +typedef signed int LAAW_INT32; +typedef unsigned char LAAW_UINT8; +typedef unsigned short LAAW_UINT16; +typedef unsigned int LAAW_UINT32; +#else +typedef signed __int8 LAAW_INT8; +typedef signed __int16 LAAW_INT16; +typedef signed __int32 LAAW_INT32; +typedef unsigned __int8 LAAW_UINT8; +typedef unsigned __int16 LAAW_UINT16; +typedef unsigned __int32 LAAW_UINT32; +#endif + +typedef signed __int64 LAAW_INT64; +typedef unsigned __int64 LAAW_UINT64; + +#else +#error "Please support your compiler here" +#endif + +#endif + + + + + +/******************************************************************** + ** This is a shared section between Windows and Linux + ********************************************************************/ + +namespace OrthancClient { +/** + * @brief Exception class that is thrown by the functions of this shared library. + **/ +class OrthancClientException : public std::exception + { + private: + std::string message_; + + public: + /** + * @brief Constructs an exception. + * @param message The error message. + **/ + OrthancClientException(std::string message) : message_(message) + { + } + + ~OrthancClientException() throw() + { + } + + /** + * @brief Get the error message associated with this exception. + * @returns The error message. + **/ + const std::string& What() const throw() + { + return message_; + } +}; +} + + +namespace OrthancClient { namespace Internals { +/** + * This internal class implements a Singleton design pattern that will + * store a reference to the shared library handle, together with a + * pointer to each function in the shared library. + **/ +class Library + { + private: + LAAW_ORTHANC_CLIENT_HANDLE_TYPE handle_; + LAAW_ORTHANC_CLIENT_FUNCTION_TYPE functionsIndex_[63 + 1]; + + + + void Load(const char* sharedLibraryPath) + { + + if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL) + { + // Do nothing if the library is already loaded + return; + } + + /* Setup the path to the default shared library if not provided */ + if (sharedLibraryPath == NULL) + { + sharedLibraryPath = LAAW_ORTHANC_CLIENT_DEFAULT_PATH; + } + + /* Load the shared library */ + handle_ = LAAW_ORTHANC_CLIENT_LOADER(sharedLibraryPath); + + + if (handle_ == LAAW_ORTHANC_CLIENT_HANDLE_NULL) + { + throw ::OrthancClient::OrthancClientException("Error loading shared library"); + } + + LoadFunctions(); + } + + inline void LoadFunctions(); + + void FreeString(char* str) + { + typedef void (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (char*); + Function function = (Function) GetFunction(63); + function(str); + } + + Library() + { + handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL; + } + + ~Library() + { + Finalize(); + } + + public: + LAAW_ORTHANC_CLIENT_FUNCTION_TYPE GetFunction(unsigned int index) + { + /** + * If the library has not been manually initialized by a call to + * ::OrthancClient::Initialize(), it is loaded from + * the default location (lazy initialization). + **/ + if (handle_ == NULL) + { + Load(NULL); + } + + return functionsIndex_[index]; + } + + void ThrowExceptionIfNeeded(char* message) + { + if (message != NULL) + { + std::string tmp(message); + FreeString(message); + throw ::OrthancClient::OrthancClientException(tmp); + } + } + + static inline Library& GetInstance() + { + /** + * This function defines a "static variable" inside a "static + * inline method" of a class. This ensures that a single + * instance of this variable will be used across all the + * compilation modules of the software. + * http://stackoverflow.com/a/1389403/881731 + **/ + + static Library singleton; + return singleton; + } + + static void Initialize(const char* sharedLibraryPath) + { + GetInstance().Load(sharedLibraryPath); + } + + void Finalize() + { + if (handle_ != LAAW_ORTHANC_CLIENT_HANDLE_NULL) + { +#if 0 + /** + * Do not explicitly unload the shared library, as it might + * interfere with the destruction of static objects declared + * inside the library (e.g. this is the case of gflags that is + * internally used by googlelog). + **/ + LAAW_ORTHANC_CLIENT_CLOSER(handle_); +#endif + handle_ = LAAW_ORTHANC_CLIENT_HANDLE_NULL; + } + } +}; +}} + + +/*! + * \addtogroup Global Global definitions. + * @{ + * @} + */ + + +namespace OrthancClient { +/*! + * \addtogroup Initialization Initialization of the shared library. + * @{ + */ + +/** + * @brief Manually initialize the shared library, using the default library name. + * + * Call this method before using the library to ensure correct + * behaviour in multi-threaded applications. This method is also + * useful to control the time at which the shared library is + * loaded (e.g. for real-time applications). + **/ +inline void Initialize() +{ + ::OrthancClient::Internals::Library::Initialize(NULL); +} + +/** + * @brief Manually initialize the shared library. + * + * Call this method before using the library to ensure correct + * behaviour in multi-threaded applications. This method is also + * useful to control the time at which the shared library is + * loaded (e.g. for real-time applications). + * + * @param sharedLibraryPath The path to the shared library that + * contains the module. + **/ +inline void Initialize(const std::string& sharedLibraryPath) +{ + ::OrthancClient::Internals::Library::Initialize(sharedLibraryPath.c_str()); +} + +/** + * @brief Manually finalize the shared library. + * + * Calling explicitly this function is not mandatory. It is useful to + * force the release of the resources acquired by the shared library, + * or to manually control the order in which the global variables get + * deleted. + **/ +inline void Finalize() +{ + ::OrthancClient::Internals::Library::GetInstance().Finalize(); +} + + +/** + * @} + */ +} + + +namespace OrthancClient { namespace Internals { +inline void Library::LoadFunctions() +{ + typedef const char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (); + Function getVersion = (Function) LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_GetVersion", "0"); + if (getVersion == NULL) + { + throw ::OrthancClient::OrthancClientException("Unable to get the library version"); + } + + /** + * It is assumed that the API does not change when the revision + * number (MAJOR.MINOR.REVISION) changes. + **/ + if (strcmp(getVersion(), "0.8")) + { + throw ::OrthancClient::OrthancClientException("Mismatch between the C++ header and the library version"); + } + + functionsIndex_[63] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_FreeString", "4"); + functionsIndex_[3] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7", "8"); + functionsIndex_[4] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e", "8"); + functionsIndex_[5] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f", "4"); + functionsIndex_[6] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0", "8"); + functionsIndex_[7] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050", "8"); + functionsIndex_[8] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc", "12"); + functionsIndex_[9] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7", "8"); + functionsIndex_[10] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b", "8"); + functionsIndex_[11] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421", "16"); + functionsIndex_[0] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c", "8"); + functionsIndex_[1] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b", "16"); + functionsIndex_[2] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38", "4"); + functionsIndex_[14] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_f756172daf04516eec3a566adabb4335", "4"); + functionsIndex_[15] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118", "8"); + functionsIndex_[16] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63", "12"); + functionsIndex_[17] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1", "8"); + functionsIndex_[18] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701", "16"); + functionsIndex_[12] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919", "12"); + functionsIndex_[13] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1", "4"); + functionsIndex_[21] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2", "4"); + functionsIndex_[22] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d", "8"); + functionsIndex_[23] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db", "12"); + functionsIndex_[24] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5", "8"); + functionsIndex_[25] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca", "8"); + functionsIndex_[26] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64", "16"); + functionsIndex_[27] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3", "8"); + functionsIndex_[28] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757", "8"); + functionsIndex_[29] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5", "8"); + functionsIndex_[30] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0", "8"); + functionsIndex_[31] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab", "8"); + functionsIndex_[32] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d", "8"); + functionsIndex_[33] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497", "8"); + functionsIndex_[34] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5", "28"); + functionsIndex_[35] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c", "32"); + functionsIndex_[19] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342", "12"); + functionsIndex_[20] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0", "4"); + functionsIndex_[38] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7", "4"); + functionsIndex_[39] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321", "8"); + functionsIndex_[40] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05", "12"); + functionsIndex_[41] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7", "8"); + functionsIndex_[42] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654", "16"); + functionsIndex_[36] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678", "12"); + functionsIndex_[37] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376", "4"); + functionsIndex_[45] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb", "8"); + functionsIndex_[46] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146", "8"); + functionsIndex_[47] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda", "8"); + functionsIndex_[48] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484", "12"); + functionsIndex_[49] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb", "12"); + functionsIndex_[50] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1729a067d902771517388eedd7346b23", "12"); + functionsIndex_[51] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745", "8"); + functionsIndex_[52] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0", "8"); + functionsIndex_[53] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8", "8"); + functionsIndex_[54] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c", "8"); + functionsIndex_[55] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b", "8"); + functionsIndex_[56] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef", "12"); + functionsIndex_[57] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91", "8"); + functionsIndex_[58] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e", "8"); + functionsIndex_[59] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a", "4"); + functionsIndex_[60] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c", "4"); + functionsIndex_[61] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd", "8"); + functionsIndex_[62] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb", "8"); + functionsIndex_[43] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d", "12"); + functionsIndex_[44] = LAAW_ORTHANC_CLIENT_GET_FUNCTION(handle_, "LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207", "4"); + + /* Check whether the functions were properly loaded */ + for (unsigned int i = 0; i <= 63; i++) + { + if (functionsIndex_[i] == (LAAW_ORTHANC_CLIENT_FUNCTION_TYPE) NULL) + { + throw ::OrthancClient::OrthancClientException("Unable to load the functions of the shared library"); + } + } +} +}} +namespace OrthancClient +{ + class OrthancConnection; +} + +namespace OrthancClient +{ + class Patient; +} + +namespace OrthancClient +{ + class Series; +} + +namespace OrthancClient +{ + class Study; +} + +namespace OrthancClient +{ + class Instance; +} + +namespace Orthanc +{ + /** + * @brief The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image. + * + * The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image. + * + * @ingroup Global + **/ + enum PixelFormat + { + /** + * @brief Graylevel, signed 16bpp image. + * + * The image is graylevel. Each pixel is signed and stored in two bytes. + * + **/ + PixelFormat_SignedGrayscale16 = 5, + /** + * @brief Color image in RGB24 format. + * + * This format describes a color image. The pixels are stored in 3 consecutive bytes. The memory layout is RGB. + * + **/ + PixelFormat_RGB24 = 1, + /** + * @brief Color image in RGBA32 format. + * + * This format describes a color image. The pixels are stored in 4 consecutive bytes. The memory layout is RGBA. + * + **/ + PixelFormat_RGBA32 = 2, + /** + * @brief Graylevel 8bpp image. + * + * The image is graylevel. Each pixel is unsigned and stored in one byte. + * + **/ + PixelFormat_Grayscale8 = 3, + /** + * @brief Graylevel, unsigned 16bpp image. + * + * The image is graylevel. Each pixel is unsigned and stored in two bytes. + * + **/ + PixelFormat_Grayscale16 = 4 + }; +} + +namespace Orthanc +{ + /** + * @brief The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image. + * + * The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image. + * + * @ingroup Global + **/ + enum ImageExtractionMode + { + /** + * @brief Truncation to the [-32768, 32767] range. + * + * Truncation to the [-32768, 32767] range. + * + **/ + ImageExtractionMode_Int16 = 4, + /** + * @brief Rescaled to 8bpp. + * + * The minimum value of the image is set to 0, and its maximum value is set to 255. + * + **/ + ImageExtractionMode_Preview = 1, + /** + * @brief Truncation to the [0, 255] range. + * + * Truncation to the [0, 255] range. + * + **/ + ImageExtractionMode_UInt8 = 2, + /** + * @brief Truncation to the [0, 65535] range. + * + * Truncation to the [0, 65535] range. + * + **/ + ImageExtractionMode_UInt16 = 3 + }; +} + +namespace OrthancClient +{ + /** + * @brief Connection to an instance of %Orthanc. + * + * This class encapsulates a connection to a remote instance of %Orthanc through its REST API. + * + **/ + class OrthancConnection + { + friend class ::OrthancClient::Patient; + friend class ::OrthancClient::Series; + friend class ::OrthancClient::Study; + friend class ::OrthancClient::Instance; + private: + bool isReference_; + OrthancConnection& operator= (const OrthancConnection&); // Assignment is forbidden + void* pimpl_; + OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {} + public: + /** + * @brief Construct a new reference to this object. + * + * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid. + * + * @param other The original object. + **/ + OrthancConnection(const OrthancConnection& other) : isReference_(true), pimpl_(other.pimpl_) { } + inline OrthancConnection(const ::std::string& orthancUrl); + inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password); + inline ~OrthancConnection(); + inline LAAW_UINT32 GetThreadCount() const; + inline void SetThreadCount(LAAW_UINT32 threadCount); + inline void Reload(); + inline ::std::string GetOrthancUrl() const; + inline LAAW_UINT32 GetPatientCount(); + inline ::OrthancClient::Patient GetPatient(LAAW_UINT32 index); + inline void DeletePatient(LAAW_UINT32 index); + inline void StoreFile(const ::std::string& filename); + inline void Store(const void* dicom, LAAW_UINT64 size); + }; +} + +namespace OrthancClient +{ + /** + * @brief Connection to a patient stored in %Orthanc. + * + * This class encapsulates a connection to a patient from a remote instance of %Orthanc. + * + **/ + class Patient + { + friend class ::OrthancClient::OrthancConnection; + friend class ::OrthancClient::Series; + friend class ::OrthancClient::Study; + friend class ::OrthancClient::Instance; + private: + bool isReference_; + Patient& operator= (const Patient&); // Assignment is forbidden + void* pimpl_; + Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {} + public: + /** + * @brief Construct a new reference to this object. + * + * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid. + * + * @param other The original object. + **/ + Patient(const Patient& other) : isReference_(true), pimpl_(other.pimpl_) { } + inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id); + inline ~Patient(); + inline void Reload(); + inline LAAW_UINT32 GetStudyCount(); + inline ::OrthancClient::Study GetStudy(LAAW_UINT32 index); + inline ::std::string GetId() const; + inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const; + }; +} + +namespace OrthancClient +{ + /** + * @brief Connection to a series stored in %Orthanc. + * + * This class encapsulates a connection to a series from a remote instance of %Orthanc. + * + **/ + class Series + { + friend class ::OrthancClient::OrthancConnection; + friend class ::OrthancClient::Patient; + friend class ::OrthancClient::Study; + friend class ::OrthancClient::Instance; + private: + bool isReference_; + Series& operator= (const Series&); // Assignment is forbidden + void* pimpl_; + Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {} + public: + /** + * @brief Construct a new reference to this object. + * + * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid. + * + * @param other The original object. + **/ + Series(const Series& other) : isReference_(true), pimpl_(other.pimpl_) { } + inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id); + inline ~Series(); + inline void Reload(); + inline LAAW_UINT32 GetInstanceCount(); + inline ::OrthancClient::Instance GetInstance(LAAW_UINT32 index); + inline ::std::string GetId() const; + inline ::std::string GetUrl() const; + inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const; + inline bool Is3DImage(); + inline LAAW_UINT32 GetWidth(); + inline LAAW_UINT32 GetHeight(); + inline float GetVoxelSizeX(); + inline float GetVoxelSizeY(); + inline float GetVoxelSizeZ(); + inline float GetSliceThickness(); + inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride); + inline void Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[]); + }; +} + +namespace OrthancClient +{ + /** + * @brief Connection to a study stored in %Orthanc. + * + * This class encapsulates a connection to a study from a remote instance of %Orthanc. + * + **/ + class Study + { + friend class ::OrthancClient::OrthancConnection; + friend class ::OrthancClient::Patient; + friend class ::OrthancClient::Series; + friend class ::OrthancClient::Instance; + private: + bool isReference_; + Study& operator= (const Study&); // Assignment is forbidden + void* pimpl_; + Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {} + public: + /** + * @brief Construct a new reference to this object. + * + * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid. + * + * @param other The original object. + **/ + Study(const Study& other) : isReference_(true), pimpl_(other.pimpl_) { } + inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id); + inline ~Study(); + inline void Reload(); + inline LAAW_UINT32 GetSeriesCount(); + inline ::OrthancClient::Series GetSeries(LAAW_UINT32 index); + inline ::std::string GetId() const; + inline ::std::string GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const; + }; +} + +namespace OrthancClient +{ + /** + * @brief Connection to an instance stored in %Orthanc. + * + * This class encapsulates a connection to an image instance from a remote instance of %Orthanc. + * + **/ + class Instance + { + friend class ::OrthancClient::OrthancConnection; + friend class ::OrthancClient::Patient; + friend class ::OrthancClient::Series; + friend class ::OrthancClient::Study; + private: + bool isReference_; + Instance& operator= (const Instance&); // Assignment is forbidden + void* pimpl_; + Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {} + public: + /** + * @brief Construct a new reference to this object. + * + * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid. + * + * @param other The original object. + **/ + Instance(const Instance& other) : isReference_(true), pimpl_(other.pimpl_) { } + inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id); + inline ~Instance(); + inline ::std::string GetId() const; + inline void SetImageExtractionMode(::Orthanc::ImageExtractionMode mode); + inline ::Orthanc::ImageExtractionMode GetImageExtractionMode() const; + inline ::std::string GetTagAsString(const ::std::string& tag) const; + inline float GetTagAsFloat(const ::std::string& tag) const; + inline LAAW_INT32 GetTagAsInt(const ::std::string& tag) const; + inline LAAW_UINT32 GetWidth(); + inline LAAW_UINT32 GetHeight(); + inline LAAW_UINT32 GetPitch(); + inline ::Orthanc::PixelFormat GetPixelFormat(); + inline const void* GetBuffer(); + inline const void* GetBuffer(LAAW_UINT32 y); + inline LAAW_UINT64 GetDicomSize(); + inline const void* GetDicom(); + inline void DiscardImage(); + inline void DiscardDicom(); + inline void LoadTagContent(const ::std::string& path); + inline ::std::string GetLoadedTagContent() const; + }; +} + +namespace OrthancClient +{ + /** + * @brief Create a connection to an instance of %Orthanc. + * + * Create a connection to an instance of %Orthanc. + * + * @param orthancUrl URL to which the REST API of %Orthanc is listening. + **/ + inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(0); + char* error = function(&pimpl_, orthancUrl.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Create a connection to an instance of %Orthanc, with authentication. + * + * Create a connection to an instance of %Orthanc, with authentication. + * + * @param orthancUrl URL to which the REST API of %Orthanc is listening. + * @param username The username. + * @param password The password. + **/ + inline OrthancConnection::OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, const char*, const char*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(1); + char* error = function(&pimpl_, orthancUrl.c_str(), username.c_str(), password.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Destructs the object. + * + * Destructs the object. + * + **/ + inline OrthancConnection::~OrthancConnection() + { + if (isReference_) return; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2); + char* error = function(pimpl_); + error = error; // Remove warning about unused variable + } + /** + * @brief Returns the number of threads for this connection. + * + * Returns the number of simultaneous connections that are used when downloading information from this instance of %Orthanc. + * + * @return The number of threads. + **/ + inline LAAW_UINT32 OrthancConnection::GetThreadCount() const + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(3); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Sets the number of threads for this connection. + * + * Sets the number of simultaneous connections that are used when downloading information from this instance of %Orthanc. + * + * @param threadCount The number of threads. + **/ + inline void OrthancConnection::SetThreadCount(LAAW_UINT32 threadCount) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(4); + char* error = function(pimpl_, threadCount); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Reload the list of the patients. + * + * This method will reload the list of the patients from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated. + * + **/ + inline void OrthancConnection::Reload() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(5); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Returns the URL of this instance of %Orthanc. + * + * Returns the URL of the remote %Orthanc instance to which this object is connected. + * + * @return The URL. + **/ + inline ::std::string OrthancConnection::GetOrthancUrl() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(6); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Returns the number of patients. + * + * Returns the number of patients that are stored in the remote instance of %Orthanc. + * + * @return The number of patients. + **/ + inline LAAW_UINT32 OrthancConnection::GetPatientCount() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(7); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get some patient. + * + * This method will return an object that contains information about some patient. The patients are indexed by a number between 0 (inclusive) and the result of GetPatientCount() (exclusive). + * + * @param index The index of the patient of interest. + * @return The patient. + **/ + inline ::OrthancClient::Patient OrthancConnection::GetPatient(LAAW_UINT32 index) + { + void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(8); + char* error = function(pimpl_, &result_, index); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return ::OrthancClient::Patient(result_); + } + /** + * @brief Delete some patient. + * + * Delete some patient from the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated. + * + * @param index The index of the patient of interest. + * @return The patient. + **/ + inline void OrthancConnection::DeletePatient(LAAW_UINT32 index) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(9); + char* error = function(pimpl_, index); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Send a DICOM file. + * + * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated. + * + * @param filename Path to the DICOM file + **/ + inline void OrthancConnection::StoreFile(const ::std::string& filename) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(10); + char* error = function(pimpl_, filename.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Send a DICOM file that is contained inside a memory buffer. + * + * This method will store a DICOM file in the remote instance of %Orthanc. Pay attention to the fact that the patients that have been previously returned by GetPatient() will be invalidated. + * + * @param dicom The memory buffer containing the DICOM file. + * @param size The size of the DICOM file. + **/ + inline void OrthancConnection::Store(const void* dicom, LAAW_UINT64 size) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void*, LAAW_UINT64); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(11); + char* error = function(pimpl_, dicom, size); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } +} + +namespace OrthancClient +{ + /** + * @brief Create a connection to some patient. + * + * Create a connection to some patient. + * + * @param connection The remote instance of %Orthanc. + * @param id The %Orthanc identifier of the patient. + **/ + inline Patient::Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(12); + char* error = function(&pimpl_, connection.pimpl_, id.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Destructs the object. + * + * Destructs the object. + * + **/ + inline Patient::~Patient() + { + if (isReference_) return; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13); + char* error = function(pimpl_); + error = error; // Remove warning about unused variable + } + /** + * @brief Reload the studies of this patient. + * + * This method will reload the list of the studies of this patient. Pay attention to the fact that the studies that have been previously returned by GetStudy() will be invalidated. + * + **/ + inline void Patient::Reload() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(14); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Return the number of studies for this patient. + * + * Return the number of studies for this patient. + * + * @return The number of studies. + **/ + inline LAAW_UINT32 Patient::GetStudyCount() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(15); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get some study of this patient. + * + * This method will return an object that contains information about some study. The studies are indexed by a number between 0 (inclusive) and the result of GetStudyCount() (exclusive). + * + * @param index The index of the study of interest. + * @return The study. + **/ + inline ::OrthancClient::Study Patient::GetStudy(LAAW_UINT32 index) + { + void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(16); + char* error = function(pimpl_, &result_, index); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return ::OrthancClient::Study(result_); + } + /** + * @brief Get the %Orthanc identifier of this patient. + * + * Get the %Orthanc identifier of this patient. + * + * @return The identifier. + **/ + inline ::std::string Patient::GetId() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(17); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Get the value of one of the main DICOM tags for this patient. + * + * Get the value of one of the main DICOM tags for this patient. + * + * @param tag The name of the tag of interest ("PatientName", "PatientID", "PatientSex" or "PatientBirthDate"). + * @param defaultValue The default value to be returned if this tag does not exist. + * @return The value of the tag. + **/ + inline ::std::string Patient::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(18); + char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } +} + +namespace OrthancClient +{ + /** + * @brief Create a connection to some series. + * + * Create a connection to some series. + * + * @param connection The remote instance of %Orthanc. + * @param id The %Orthanc identifier of the series. + **/ + inline Series::Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(19); + char* error = function(&pimpl_, connection.pimpl_, id.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Destructs the object. + * + * Destructs the object. + * + **/ + inline Series::~Series() + { + if (isReference_) return; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20); + char* error = function(pimpl_); + error = error; // Remove warning about unused variable + } + /** + * @brief Reload the instances of this series. + * + * This method will reload the list of the instances of this series. Pay attention to the fact that the instances that have been previously returned by GetInstance() will be invalidated. + * + **/ + inline void Series::Reload() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(21); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Return the number of instances for this series. + * + * Return the number of instances for this series. + * + * @return The number of instances. + **/ + inline LAAW_UINT32 Series::GetInstanceCount() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(22); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get some instance of this series. + * + * This method will return an object that contains information about some instance. The instances are indexed by a number between 0 (inclusive) and the result of GetInstanceCount() (exclusive). + * + * @param index The index of the instance of interest. + * @return The instance. + **/ + inline ::OrthancClient::Instance Series::GetInstance(LAAW_UINT32 index) + { + void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(23); + char* error = function(pimpl_, &result_, index); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return ::OrthancClient::Instance(result_); + } + /** + * @brief Get the %Orthanc identifier of this series. + * + * Get the %Orthanc identifier of this series. + * + * @return The identifier. + **/ + inline ::std::string Series::GetId() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(24); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Returns the URL to this series. + * + * Returns the URL to this series. + * + * @return The URL. + **/ + inline ::std::string Series::GetUrl() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(25); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Get the value of one of the main DICOM tags for this series. + * + * Get the value of one of the main DICOM tags for this series. + * + * @param tag The name of the tag of interest ("Modality", "Manufacturer", "SeriesDate", "SeriesDescription", "SeriesInstanceUID"...). + * @param defaultValue The default value to be returned if this tag does not exist. + * @return The value of the tag. + **/ + inline ::std::string Series::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(26); + char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Test whether this series encodes a 3D image that can be downloaded from %Orthanc. + * + * Test whether this series encodes a 3D image that can be downloaded from %Orthanc. + * + * @return "true" if and only if this is a 3D image. + **/ + inline bool Series::Is3DImage() + { + LAAW_INT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(27); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_ != 0; + } + /** + * @brief Get the width of the 3D image. + * + * Get the width of the 3D image (i.e. along the X-axis). This call is only valid if this series corresponds to a 3D image. + * + * @return The width. + **/ + inline LAAW_UINT32 Series::GetWidth() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(28); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the height of the 3D image. + * + * Get the height of the 3D image (i.e. along the Y-axis). This call is only valid if this series corresponds to a 3D image. + * + * @return The height. + **/ + inline LAAW_UINT32 Series::GetHeight() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(29); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the physical size of a voxel along the X-axis. + * + * Get the physical size of a voxel along the X-axis. This call is only valid if this series corresponds to a 3D image. + * + * @return The voxel size. + **/ + inline float Series::GetVoxelSizeX() + { + float result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(30); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the physical size of a voxel along the Y-axis. + * + * Get the physical size of a voxel along the Y-axis. This call is only valid if this series corresponds to a 3D image. + * + * @return The voxel size. + **/ + inline float Series::GetVoxelSizeY() + { + float result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(31); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the physical size of a voxel along the Z-axis. + * + * Get the physical size of a voxel along the Z-axis. This call is only valid if this series corresponds to a 3D image. + * + * @return The voxel size. + **/ + inline float Series::GetVoxelSizeZ() + { + float result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(32); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the slice thickness. + * + * Get the slice thickness. This call is only valid if this series corresponds to a 3D image. + * + * @return The slice thickness. + **/ + inline float Series::GetSliceThickness() + { + float result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, float*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(33); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Load the 3D image into a memory buffer. + * + * Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image. + * + * @param target The target memory buffer. + * @param format The memory layout of the voxels. + * @param lineStride The number of bytes between two lines in the target memory buffer. + * @param stackStride The number of bytes between two 2D slices in the target memory buffer. + **/ + inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(34); + char* error = function(pimpl_, target, format, lineStride, stackStride); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Load the 3D image into a memory buffer. + * + * Load the 3D image into a memory buffer. This call is only valid if this series corresponds to a 3D image. The "target" buffer must be wide enough to store all the voxels of the image. This method will also update a progress indicator to monitor the loading of the image. + * + * @param target The target memory buffer. + * @param format The memory layout of the voxels. + * @param lineStride The number of bytes between two lines in the target memory buffer. + * @param stackStride The number of bytes between two 2D slices in the target memory buffer. + * @param progress A pointer to a floating-point number that is continuously updated by the download threads to reflect the percentage of completion (between 0 and 1). This value can be read from a separate thread. + **/ + inline void Series::Load3DImage(void* target, ::Orthanc::PixelFormat format, LAAW_INT64 lineStride, LAAW_INT64 stackStride, float progress[]) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void*, LAAW_INT32, LAAW_INT64, LAAW_INT64, float*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(35); + char* error = function(pimpl_, target, format, lineStride, stackStride, progress); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } +} + +namespace OrthancClient +{ + /** + * @brief Create a connection to some study. + * + * Create a connection to some study. + * + * @param connection The remote instance of %Orthanc. + * @param id The %Orthanc identifier of the study. + **/ + inline Study::Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36); + char* error = function(&pimpl_, connection.pimpl_, id.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Destructs the object. + * + * Destructs the object. + * + **/ + inline Study::~Study() + { + if (isReference_) return; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(37); + char* error = function(pimpl_); + error = error; // Remove warning about unused variable + } + /** + * @brief Reload the series of this study. + * + * This method will reload the list of the series of this study. Pay attention to the fact that the series that have been previously returned by GetSeries() will be invalidated. + * + **/ + inline void Study::Reload() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(38); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Return the number of series for this study. + * + * Return the number of series for this study. + * + * @return The number of series. + **/ + inline LAAW_UINT32 Study::GetSeriesCount() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(39); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get some series of this study. + * + * This method will return an object that contains information about some series. The series are indexed by a number between 0 (inclusive) and the result of GetSeriesCount() (exclusive). + * + * @param index The index of the series of interest. + * @return The series. + **/ + inline ::OrthancClient::Series Study::GetSeries(LAAW_UINT32 index) + { + void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, void**, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(40); + char* error = function(pimpl_, &result_, index); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return ::OrthancClient::Series(result_); + } + /** + * @brief Get the %Orthanc identifier of this study. + * + * Get the %Orthanc identifier of this study. + * + * @return The identifier. + **/ + inline ::std::string Study::GetId() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(41); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Get the value of one of the main DICOM tags for this study. + * + * Get the value of one of the main DICOM tags for this study. + * + * @param tag The name of the tag of interest ("StudyDate", "StudyDescription", "StudyInstanceUID" or "StudyTime"). + * @param defaultValue The default value to be returned if this tag does not exist. + * @return The value of the tag. + **/ + inline ::std::string Study::GetMainDicomTag(const ::std::string& tag, const ::std::string& defaultValue) const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(42); + char* error = function(pimpl_, &result_, tag.c_str(), defaultValue.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } +} + +namespace OrthancClient +{ + /** + * @brief Create a connection to some image instance. + * + * Create a connection to some image instance. + * + * @param connection The remote instance of %Orthanc. + * @param id The %Orthanc identifier of the image instance. + **/ + inline Instance::Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id) + { + isReference_ = false; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void**, void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43); + char* error = function(&pimpl_, connection.pimpl_, id.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Destructs the object. + * + * Destructs the object. + * + **/ + inline Instance::~Instance() + { + if (isReference_) return; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(44); + char* error = function(pimpl_); + error = error; // Remove warning about unused variable + } + /** + * @brief Get the %Orthanc identifier of this identifier. + * + * Get the %Orthanc identifier of this identifier. + * + * @return The identifier. + **/ + inline ::std::string Instance::GetId() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(45); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Set the extraction mode for the 2D image corresponding to this instance. + * + * Set the extraction mode for the 2D image corresponding to this instance. + * + * @param mode The extraction mode. + **/ + inline void Instance::SetImageExtractionMode(::Orthanc::ImageExtractionMode mode) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(46); + char* error = function(pimpl_, mode); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Get the extraction mode for the 2D image corresponding to this instance. + * + * Get the extraction mode for the 2D image corresponding to this instance. + * + * @return The extraction mode. + **/ + inline ::Orthanc::ImageExtractionMode Instance::GetImageExtractionMode() const + { + LAAW_INT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(47); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return static_cast< ::Orthanc::ImageExtractionMode >(result_); + } + /** + * @brief Get the string value of some DICOM tag of this instance. + * + * Get the string value of some DICOM tag of this instance. + * + * @param tag The name of the tag of interest. + * @return The value of the tag. + **/ + inline ::std::string Instance::GetTagAsString(const ::std::string& tag) const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(48); + char* error = function(pimpl_, &result_, tag.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } + /** + * @brief Get the floating point value that is stored in some DICOM tag of this instance. + * + * Get the floating point value that is stored in some DICOM tag of this instance. + * + * @param tag The name of the tag of interest. + * @return The value of the tag. + **/ + inline float Instance::GetTagAsFloat(const ::std::string& tag) const + { + float result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, float*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(49); + char* error = function(pimpl_, &result_, tag.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the integer value that is stored in some DICOM tag of this instance. + * + * Get the integer value that is stored in some DICOM tag of this instance. + * + * @param tag The name of the tag of interest. + * @return The value of the tag. + **/ + inline LAAW_INT32 Instance::GetTagAsInt(const ::std::string& tag) const + { + LAAW_INT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, LAAW_INT32*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(50); + char* error = function(pimpl_, &result_, tag.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the width of the 2D image. + * + * Get the width of the 2D image that is encoded by this DICOM instance. + * + * @return The width. + **/ + inline LAAW_UINT32 Instance::GetWidth() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(51); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the height of the 2D image. + * + * Get the height of the 2D image that is encoded by this DICOM instance. + * + * @return The height. + **/ + inline LAAW_UINT32 Instance::GetHeight() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(52); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the number of bytes between two lines of the image (pitch). + * + * Get the number of bytes between two lines of the image in the memory buffer returned by GetBuffer(). This value depends on the extraction mode for the image. + * + * @return The pitch. + **/ + inline LAAW_UINT32 Instance::GetPitch() + { + LAAW_UINT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(53); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get the format of the pixels of the 2D image. + * + * Return the memory layout that is used for the 2D image that is encoded by this DICOM instance. This value depends on the extraction mode for the image. + * + * @return The pixel format. + **/ + inline ::Orthanc::PixelFormat Instance::GetPixelFormat() + { + LAAW_INT32 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_INT32*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(54); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return static_cast< ::Orthanc::PixelFormat >(result_); + } + /** + * @brief Access the memory buffer in which the raw pixels of the 2D image are stored. + * + * Access the memory buffer in which the raw pixels of the 2D image are stored. + * + * @return A pointer to the memory buffer. + **/ + inline const void* Instance::GetBuffer() + { + const void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(55); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return reinterpret_cast< const void* >(result_); + } + /** + * @brief Access the memory buffer in which the raw pixels of some line of the 2D image are stored. + * + * Access the memory buffer in which the raw pixels of some line of the 2D image are stored. + * + * @param y The line of interest. + * @return A pointer to the memory buffer. + **/ + inline const void* Instance::GetBuffer(LAAW_UINT32 y) + { + const void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**, LAAW_UINT32); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(56); + char* error = function(pimpl_, &result_, y); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return reinterpret_cast< const void* >(result_); + } + /** + * @brief Get the size of the DICOM file corresponding to this instance. + * + * Get the size of the DICOM file corresponding to this instance. + * + * @return The file size. + **/ + inline LAAW_UINT64 Instance::GetDicomSize() + { + LAAW_UINT64 result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, LAAW_UINT64*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(57); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return result_; + } + /** + * @brief Get a pointer to the content of the DICOM file corresponding to this instance. + * + * Get a pointer to the content of the DICOM file corresponding to this instance. + * + * @return The DICOM file. + **/ + inline const void* Instance::GetDicom() + { + const void* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const void**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(58); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return reinterpret_cast< const void* >(result_); + } + /** + * @brief Discard the downloaded 2D image, so as to make room in memory. + * + * Discard the downloaded 2D image, so as to make room in memory. + * + **/ + inline void Instance::DiscardImage() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(59); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Discard the downloaded DICOM file, so as to make room in memory. + * + * Discard the downloaded DICOM file, so as to make room in memory. + * + **/ + inline void Instance::DiscardDicom() + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(60); + char* error = function(pimpl_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Load a raw tag from the DICOM file. + * + * Load a raw tag from the DICOM file. + * + * @param path The path to the tag of interest (e.g. "0020-000d"). + **/ + inline void Instance::LoadTagContent(const ::std::string& path) + { + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*, const char*); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(61); + char* error = function(pimpl_, path.c_str()); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + } + /** + * @brief Return the value of the raw tag that was loaded by LoadContent. + * + * Return the value of the raw tag that was loaded by LoadContent. + * + * @return The tag value. + **/ + inline ::std::string Instance::GetLoadedTagContent() const + { + const char* result_; + typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (const void*, const char**); + Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(62); + char* error = function(pimpl_, &result_); + ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + return std::string(result_); + } +} + diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.def Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,73 @@ +LIBRARY some.dll +EXPORTS + _LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7@8 = LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7@8 + _LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e@8 = LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e@8 + _LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f@4 = LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f@4 + _LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0@8 = LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0@8 + _LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050@8 = LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050@8 + _LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc@12 = LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc@12 + _LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7@8 = LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7@8 + _LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b@8 = LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b@8 + _LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421@16 = LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421@16 + _LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c@8 = LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c@8 + _LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b@16 = LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b@16 + _LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38@4 = LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38@4 + _LAAW_EXTERNC_f756172daf04516eec3a566adabb4335@4 = LAAW_EXTERNC_f756172daf04516eec3a566adabb4335@4 + _LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118@8 = LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118@8 + _LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63@12 = LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63@12 + _LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1@8 = LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1@8 + _LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701@16 = LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701@16 + _LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919@12 = LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919@12 + _LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1@4 = LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1@4 + _LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2@4 = LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2@4 + _LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d@8 = LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d@8 + _LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db@12 = LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db@12 + _LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5@8 = LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5@8 + _LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca@8 = LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca@8 + _LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64@16 = LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64@16 + _LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3@8 = LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3@8 + _LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757@8 = LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757@8 + _LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5@8 = LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5@8 + _LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0@8 = LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0@8 + _LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab@8 = LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab@8 + _LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d@8 = LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d@8 + _LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497@8 = LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497@8 + _LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5@28 = LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5@28 + _LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c@32 = LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c@32 + _LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342@12 = LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342@12 + _LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0@4 = LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0@4 + _LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7@4 = LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7@4 + _LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321@8 = LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321@8 + _LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05@12 = LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05@12 + _LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7@8 = LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7@8 + _LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654@16 = LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654@16 + _LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678@12 = LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678@12 + _LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376@4 = LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376@4 + _LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb@8 = LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb@8 + _LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146@8 = LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146@8 + _LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda@8 = LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda@8 + _LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484@12 = LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484@12 + _LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb@12 = LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb@12 + _LAAW_EXTERNC_1729a067d902771517388eedd7346b23@12 = LAAW_EXTERNC_1729a067d902771517388eedd7346b23@12 + _LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745@8 = LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745@8 + _LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0@8 = LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0@8 + _LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8@8 = LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8@8 + _LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c@8 = LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c@8 + _LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b@8 = LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b@8 + _LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef@12 = LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef@12 + _LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91@8 = LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91@8 + _LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e@8 = LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e@8 + _LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a@4 = LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a@4 + _LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c@4 = LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c@4 + _LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd@8 = LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd@8 + _LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb@8 = LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb@8 + _LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d@12 = LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d@12 + _LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207@4 = LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207@4 + _LAAW_EXTERNC_GetDescription@0 = LAAW_EXTERNC_GetDescription@0 + _LAAW_EXTERNC_GetCompany@0 = LAAW_EXTERNC_GetCompany@0 + _LAAW_EXTERNC_GetProduct@0 = LAAW_EXTERNC_GetProduct@0 + _LAAW_EXTERNC_GetCopyright@0 = LAAW_EXTERNC_GetCopyright@0 + _LAAW_EXTERNC_GetVersion@0 = LAAW_EXTERNC_GetVersion@0 + _LAAW_EXTERNC_GetFileVersion@0 = LAAW_EXTERNC_GetFileVersion@0 + _LAAW_EXTERNC_GetFullVersion@0 = LAAW_EXTERNC_GetFullVersion@0 + _LAAW_EXTERNC_FreeString@4 = LAAW_EXTERNC_FreeString@4 diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.rc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.rc Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,8,0,6 + PRODUCTVERSION 0,8,0,0 + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "Comments", "Release 0.8.6" + VALUE "CompanyName", "University Hospital of Liege" + VALUE "FileDescription", "Native client to the REST API of Orthanc" + VALUE "FileVersion", "0.8.0.6" + VALUE "InternalName", "OrthancClient" + VALUE "LegalCopyright", "(c) 2012-2015, Sebastien Jodogne, University Hospital of Liege" + VALUE "LegalTrademarks", "Licensing information is available at http://www.orthanc-server.com/" + VALUE "OriginalFilename", "OrthancClient_Windows32.dll" + VALUE "ProductName", "OrthancClient" + VALUE "ProductVersion", "0.8" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 // U.S. English + END + END diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.def Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,73 @@ +LIBRARY some.dll +EXPORTS + LAAW_EXTERNC_557aee7b61817292a0f31269d3c35db7 + LAAW_EXTERNC_0b8dff0ce67f10954a49b059e348837e + LAAW_EXTERNC_e05097c153f676e5a5ee54dcfc78256f + LAAW_EXTERNC_e840242bf58d17d3c1d722da09ce88e0 + LAAW_EXTERNC_c9af31433001b5dfc012a552dc6d0050 + LAAW_EXTERNC_3fba4d6b818180a44cd1cae6046334dc + LAAW_EXTERNC_aeb20dc75b9246188db857317e5e0ce7 + LAAW_EXTERNC_62689803d9871e4d9c51a648640b320b + LAAW_EXTERNC_2fb64c9e5a67eccd413b0e913469a421 + LAAW_EXTERNC_1f1acb322ea4d0aad65172824607673c + LAAW_EXTERNC_f3fd272e4636f6a531aabb72ee01cd5b + LAAW_EXTERNC_12d3de0a96e9efb11136a9811bb9ed38 + LAAW_EXTERNC_f756172daf04516eec3a566adabb4335 + LAAW_EXTERNC_ddb68763ec902a97d579666a73a20118 + LAAW_EXTERNC_fba3c68b4be7558dbc65f7ce1ab57d63 + LAAW_EXTERNC_b4ca99d958f843493e58d1ef967340e1 + LAAW_EXTERNC_78d5cc76d282437b6f93ec3b82c35701 + LAAW_EXTERNC_6cf0d7268667f9b0aa4511bacf184919 + LAAW_EXTERNC_7d81cd502ee27e859735d0ea7112b5a1 + LAAW_EXTERNC_48a2a1a9d68c047e22bfba23014643d2 + LAAW_EXTERNC_852bf8296ca21c5fde5ec565cc10721d + LAAW_EXTERNC_efd04574e0779faa83df1f2d8f9888db + LAAW_EXTERNC_736247ff5e8036dac38163da6f666ed5 + LAAW_EXTERNC_d82d2598a7a73f4b6fcc0c09c25b08ca + LAAW_EXTERNC_88134b978f9acb2aecdadf54aeab3c64 + LAAW_EXTERNC_152cb1b704c053d24b0dab7461ba6ea3 + LAAW_EXTERNC_eee03f337ec81d9f1783cd41e5238757 + LAAW_EXTERNC_006f08237bd7611636fc721baebfb4c5 + LAAW_EXTERNC_b794f5cd3dad7d7b575dd1fd902afdd0 + LAAW_EXTERNC_8ee2e50dd9df8f66a3c1766090dd03ab + LAAW_EXTERNC_046aed35bbe4751691f4c34cc249a61d + LAAW_EXTERNC_2be452e7af5bf7dfd8c5021842674497 + LAAW_EXTERNC_4dcc7a0fd025efba251ac6e9b701c2c5 + LAAW_EXTERNC_b2601a161c24ad0a1d3586246f87452c + LAAW_EXTERNC_193599b9e345384fcdfcd47c29c55342 + LAAW_EXTERNC_7c97f17063a357d38c5fab1136ad12a0 + LAAW_EXTERNC_e65b20b7e0170b67544cd6664a4639b7 + LAAW_EXTERNC_470e981b0e41f17231ba0ae6f3033321 + LAAW_EXTERNC_04cefd138b6ea15ad909858f2a0a8f05 + LAAW_EXTERNC_aee5b1f6f0c082f2c3b0986f9f6a18c7 + LAAW_EXTERNC_93965682bace75491413e1f0b8d5a654 + LAAW_EXTERNC_b01c6003238eb46c8db5dc823d7ca678 + LAAW_EXTERNC_0147007fb99bad8cd95a139ec8795376 + LAAW_EXTERNC_236ee8b403bc99535a8a4695c0cd45cb + LAAW_EXTERNC_2a437b7aba6bb01e81113835be8f0146 + LAAW_EXTERNC_2bcbcb850934ae0bb4c6f0cc940e6cda + LAAW_EXTERNC_8d415c3a78a48e7e61d9fd24e7c79484 + LAAW_EXTERNC_70d2f8398bbc63b5f792b69b4ad5fecb + LAAW_EXTERNC_1729a067d902771517388eedd7346b23 + LAAW_EXTERNC_72e2aeee66cd3abd8ab7e987321c3745 + LAAW_EXTERNC_1ea3df5a1ac1a1a687fe7325adddb6f0 + LAAW_EXTERNC_99b4f370e4f532d8b763e2cb49db92f8 + LAAW_EXTERNC_c41c742b68617f1c0590577a0a5ebc0c + LAAW_EXTERNC_142dd2feba0fc1d262bbd0baeb441a8b + LAAW_EXTERNC_5f5c9f81a4dff8daa6c359f1d0488fef + LAAW_EXTERNC_9ca979fffd08fa256306d4e68d8b0e91 + LAAW_EXTERNC_6f2d77a26edc91c28d89408dbc3c271e + LAAW_EXTERNC_c0f494b80d4ff8b232df7a75baa0700a + LAAW_EXTERNC_d604f44bd5195e082e745e9cbc164f4c + LAAW_EXTERNC_1710299d1c5f3b1f2b7cf3962deebbfd + LAAW_EXTERNC_bb55aaf772ddceaadee36f4e54136bcb + LAAW_EXTERNC_6c5ad02f91b583e29cebd0bd319ce21d + LAAW_EXTERNC_4068241c44a9c1367fe0e57be523f207 + LAAW_EXTERNC_GetDescription + LAAW_EXTERNC_GetCompany + LAAW_EXTERNC_GetProduct + LAAW_EXTERNC_GetCopyright + LAAW_EXTERNC_GetVersion + LAAW_EXTERNC_GetFileVersion + LAAW_EXTERNC_GetFullVersion + LAAW_EXTERNC_FreeString diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.rc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.rc Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,8,0,6 + PRODUCTVERSION 0,8,0,0 + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "Comments", "Release 0.8.6" + VALUE "CompanyName", "University Hospital of Liege" + VALUE "FileDescription", "Native client to the REST API of Orthanc" + VALUE "FileVersion", "0.8.0.6" + VALUE "InternalName", "OrthancClient" + VALUE "LegalCopyright", "(c) 2012-2015, Sebastien Jodogne, University Hospital of Liege" + VALUE "LegalTrademarks", "Licensing information is available at http://www.orthanc-server.com/" + VALUE "OriginalFilename", "OrthancClient_Windows64.dll" + VALUE "ProductName", "OrthancClient" + VALUE "ProductVersion", "0.8" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 // U.S. English + END + END diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/ConfigurationCpp.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/ConfigurationCpp.json Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,5 @@ +{ + "InternalsNamespace" : [ "OrthancClient", "Internals" ], + "PublicNamespace" : [ "OrthancClient" ], + "ExceptionClassName" : "OrthancClientException" +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/Generate.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/Generate.sh Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +mkdir -p AUTOGENERATED +LAAW_ROOT=~/Subversion/Jomago/Src/Labo/Laaw + +${LAAW_ROOT}/Parser/Build/LaawParser.exe AUTOGENERATED/CodeModelRaw.json ../OrthancConnection.h -I`pwd`/../../s/jsoncpp-src-0.6.0-rc2/include -fms-extensions +python ${LAAW_ROOT}/Generators/CodeModelPostProcessing.py AUTOGENERATED/CodeModel.json AUTOGENERATED/CodeModelRaw.json Product.json +python ${LAAW_ROOT}/Generators/GenerateWrapperCpp.py AUTOGENERATED/OrthancCppClient.h AUTOGENERATED/CodeModel.json Product.json ConfigurationCpp.json +python ${LAAW_ROOT}/Generators/GenerateExternC.py AUTOGENERATED/ExternC.cpp AUTOGENERATED/CodeModel.json Product.json +python ${LAAW_ROOT}/Generators/GenerateWindows32Def.py AUTOGENERATED/Windows32.def AUTOGENERATED/CodeModel.json +python ${LAAW_ROOT}/Generators/GenerateWindows64Def.py AUTOGENERATED/Windows64.def AUTOGENERATED/CodeModel.json +python ${LAAW_ROOT}/Generators/ApplyProductSubstitutions.py AUTOGENERATED/Windows32.rc ${LAAW_ROOT}/Resources/DllResources.rc.mustache Product.json PLATFORM_SUFFIX "_Windows32" +python ${LAAW_ROOT}/Generators/ApplyProductSubstitutions.py AUTOGENERATED/Windows64.rc ${LAAW_ROOT}/Resources/DllResources.rc.mustache Product.json PLATFORM_SUFFIX "_Windows64" diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/Laaw/VersionScript.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,9 @@ +# This is a version-script + +{ +global: + LAAW_EXTERNC_*; + +local: + *; +}; diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/Laaw/laaw/laaw-exports.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/Laaw/laaw/laaw-exports.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,85 @@ +/** + * Laaw - Lightweight, Automated API Wrapper + * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux, + * Sebastien Jodogne + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +/******************************************************************** + ** Windows target + ********************************************************************/ + +#if defined _WIN32 + +#include + +#if defined(__GNUC__) +// This is Mingw +#define LAAW_EXPORT_DLL_API // The exports are handled by the .DEF file +#else +// This is MSVC +#define LAAW_EXPORT_DLL_API __declspec(dllexport) +#endif + +#ifdef _M_X64 +// 64 bits target +#define LAAW_CALL_CONVENTION +#else +// 32 bits target +#define LAAW_CALL_CONVENTION __stdcall // Use the StdCall in Windows32 (for VB6) +#endif + + +/******************************************************************** + ** Linux target + ********************************************************************/ + +#elif defined(__linux) + +// Try the gcc visibility support +// http://gcc.gnu.org/wiki/Visibility +#if ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +#define LAAW_EXPORT_DLL_API __attribute__ ((visibility("default"))) +#define LAAW_CALL_CONVENTION +#else +#error No support for visibility in your version of GCC +#endif + + +/******************************************************************** + ** Max OS X target + ********************************************************************/ + +#else + +#define LAAW_EXPORT_DLL_API __attribute__ ((visibility("default"))) +#define LAAW_CALL_CONVENTION + +#endif diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/Laaw/laaw/laaw.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/Laaw/laaw/laaw.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,89 @@ +/** + * Laaw - Lightweight, Automated API Wrapper + * Copyright (C) 2010-2013 Jomago - Alain Mazy, Benjamin Golinvaux, + * Sebastien Jodogne + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "laaw-exports.h" +#include +#include + +#if (LAAW_PARSING == 1) + +#define LAAW_API __attribute__((deprecated(""))) +#define LAAW_API_INTERNAL __attribute__((deprecated(""))) +#define LAAW_API_OVERLOAD(name) __attribute__((deprecated(""))) +#define LAAW_API_PROPERTY __attribute__((deprecated(""))) +#define LAAW_API_STATIC_CLASS __attribute__((deprecated(""))) +#define LAAW_API_CUSTOM(name, value) __attribute__((deprecated(""))) + +#else + +#define LAAW_API +#define LAAW_API_INTERNAL +#define LAAW_API_OVERLOAD(name) +#define LAAW_API_PROPERTY +#define LAAW_API_STATIC_CLASS +#define LAAW_API_CUSTOM(name, value) + +#endif + + +namespace Laaw +{ + /** + * This is the base class from which all the public exceptions in + * the SDK should derive. + **/ + class LaawException + { + private: + std::string what_; + + public: + LaawException() + { + } + + LaawException(const std::string& what) : what_(what) + { + } + + LaawException(const char* what) : what_(what) + { + } + + virtual const char* What() const + { + return what_.c_str(); + } + }; +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/Product.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/Product.json Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,8 @@ +{ + "Product" : "OrthancClient", + "Description" : "Native client to the REST API of Orthanc", + "Company" : "University Hospital of Liege", + "Copyright" : "(c) 2012-2015, Sebastien Jodogne, University Hospital of Liege", + "Legal" : "Licensing information is available at http://www.orthanc-server.com/", + "Version" : "0.8.6" +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/SharedLibrary/SharedLibrary.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/SharedLibrary/SharedLibrary.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,56 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + + +#include "../../Core/HttpClient.h" +#include "../OrthancConnection.h" + + +class SharedLibrarySingleton +{ +public: + SharedLibrarySingleton() + { + Orthanc::HttpClient::GlobalInitialize(); + } + + ~SharedLibrarySingleton() + { + Orthanc::HttpClient::GlobalFinalize(); + } +}; + + +static SharedLibrarySingleton singleton_; + + +#include "AUTOGENERATED/ExternC.cpp" diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Study.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Study.cpp Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,80 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#include "../Core/PrecompiledHeaders.h" +#include "Study.h" + +#include "OrthancConnection.h" + +namespace OrthancClient +{ + void Study::ReadStudy() + { + Orthanc::HttpClient client(connection_.GetHttpClient()); + client.SetUrl(std::string(connection_.GetOrthancUrl()) + "/studies/" + id_); + + Json::Value v; + if (!client.Apply(study_)) + { + throw OrthancClientException(Orthanc::ErrorCode_NetworkProtocol); + } + } + + Orthanc::IDynamicObject* Study::GetFillerItem(size_t index) + { + Json::Value::ArrayIndex tmp = static_cast(index); + std::string id = study_["Series"][tmp].asString(); + return new Series(connection_, id.c_str()); + } + + Study::Study(const OrthancConnection& connection, + const char* id) : + connection_(connection), + id_(id), + series_(*this) + { + series_.SetThreadCount(connection.GetThreadCount()); + ReadStudy(); + } + + const char* Study::GetMainDicomTag(const char* tag, const char* defaultValue) const + { + if (study_["MainDicomTags"].isMember(tag)) + { + return study_["MainDicomTags"][tag].asCString(); + } + else + { + return defaultValue; + } + } +} diff -r 000000000000 -r ebc1e38ef615 OrthancCppClient/Study.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancCppClient/Study.h Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,119 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * 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. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * 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 . + **/ + + +#pragma once + +#include "Series.h" + +namespace OrthancClient +{ + /** + * {summary}{Connection to a study stored in %Orthanc.} + * {description}{This class encapsulates a connection to a study + * from a remote instance of %Orthanc.} + **/ + class LAAW_API Study : + public Orthanc::IDynamicObject, + private Orthanc::ArrayFilledByThreads::IFiller + { + private: + const OrthancConnection& connection_; + std::string id_; + Json::Value study_; + Orthanc::ArrayFilledByThreads series_; + + void ReadStudy(); + + virtual size_t GetFillerSize() + { + return study_["Series"].size(); + } + + virtual Orthanc::IDynamicObject* GetFillerItem(size_t index); + + public: + /** + * {summary}{Create a connection to some study.} + * {param}{connection The remote instance of %Orthanc.} + * {param}{id The %Orthanc identifier of the study.} + **/ + Study(const OrthancConnection& connection, + const char* id); + + /** + * {summary}{Reload the series of this study.} + * {description}{This method will reload the list of the series of this study. Pay attention to the fact that the series that have been previously returned by GetSeries() will be invalidated.} + **/ + void Reload() + { + series_.Reload(); + } + + /** + * {summary}{Return the number of series for this study.} + * {returns}{The number of series.} + **/ + uint32_t GetSeriesCount() + { + return series_.GetSize(); + } + + /** + * {summary}{Get some series of this study.} + * {description}{This method will return an object that contains information about some series. The series are indexed by a number between 0 (inclusive) and the result of GetSeriesCount() (exclusive).} + * {param}{index The index of the series of interest.} + * {returns}{The series.} + **/ + Series& GetSeries(uint32_t index) + { + return dynamic_cast(series_.GetItem(index)); + } + + /** + * {summary}{Get the %Orthanc identifier of this study.} + * {returns}{The identifier.} + **/ + const char* GetId() const + { + return id_.c_str(); + } + + /** + * {summary}{Get the value of one of the main DICOM tags for this study.} + * {param}{tag The name of the tag of interest ("StudyDate", "StudyDescription", "StudyInstanceUID" or "StudyTime").} + * {param}{defaultValue The default value to be returned if this tag does not exist.} + * {returns}{The value of the tag.} + **/ + const char* GetMainDicomTag(const char* tag, + const char* defaultValue) const; + }; +} diff -r 000000000000 -r ebc1e38ef615 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Mon Jun 01 09:47:32 2015 +0200 @@ -0,0 +1,43 @@ +Orthanc - A Lightweight, RESTful DICOM Server +============================================= + + +General Information +------------------- + +General information about this software can be found on its official +Website: +http://www.orthanc-server.com/ + +Orthanc Client is a SDK to access the content of a remote instance of +Orthanc. It is currently only available for C++, more languages will +be supported in the future. + +This software was originally part of the Orthanc core repository, but +was separated starting with Orthanc 0.9.0. + + +Licensing +--------- + +Orthanc is licensed under the GPLv3 license, with the OpenSSL +exception: +http://people.gnome.org/~markmc/openssl-and-the-gpl.html + +We also kindly ask scientific works and clinical studies that make +use of Orthanc to cite Orthanc in their associated publications. +Similarly, we ask open-source and closed-source products that make +use of Orthanc to warn us about this use. You can cite our work +using the following BibTeX entry: + +@inproceedings{Jodogne:ISBI2013, + author = {Jodogne, S. and Bernard, C. and Devillers, M. and Lenaerts, E. and Coucke, P.}, + title = {Orthanc -- {A} Lightweight, {REST}ful {DICOM} Server for Healthcare and Medical Research}, + booktitle={Biomedical Imaging ({ISBI}), {IEEE} 10th International Symposium on}, + year={2013}, + pages={190-193}, + ISSN={1945-7928}, + month=apr, + url={http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=6556444}, + address={San Francisco, {CA}, {USA}} +}