Changes between Initial Version and Version 1 of DicomBrowserDemo

Nov 5, 2010, 2:34:13 PM (9 years ago)



  • DicomBrowserDemo

    v1 v1  
     1DICOM files come in batches of many files with related
     2metadata in each. We have written a browser that displays an organized
     3summary of this metadata in a tree and also displays a preview of some
     4image files.
     6This browser is also small enough to be a manageable introduction to
     7wxPython. It runs under OS X, Linux and Windows provided
     8wxPython is installed.
     10The browser does just a few things. It allows one to select a directory
     11containing DICOM files, it reads the metadata in each file while providing
     12feedback, and then it displays the files organized in a tree. Finally, when
     13the user chooses a file (or hits cancel), it closes and prints out the user's
     16In order to run it, you'll need to install
     17[ the pydicom library].
     19To run it, `cd` to the directory where `` lives and type
     22If you don't have any DICOM files with which to test, you can download some
     23from our SVN repository (see the `siemens_dicom_export` directory):
     26There are three versions, each an improvement on the previous. They live in
     27the orphans SVN
     28repository ( in the directory
     31The simple version is in `orphans/philip/dicom_browser-1.0/`. This version doesn't
     32offer image preview. It also assumes that all DICOM files contain a
     33Siemens-specific tag.
     35A more sophisticated version is in `orphans/philip/dicom_browser-2.0/`.
     36This offers
     37image previewing (for certain files, notably the 55* series in our sample
     38data). It differentiates between Siemens and
     39non-Siemens files, and it makes the dialog easy to subclass for coders who
     40want to change how the dialog constructs the tree item description string.
     42The most recent version in `orphans/philip/dicom_browser-2.1/` adds
     43optional multi-select capability and a subclass-friendly dialog class method
     44that can filter files out of the tree.
     47== The Files ==
     49 * `browser_ui.wxg` is the wxGlade file that describes the user interface.
     50 wxGlade generates `` for me.
     51 * `` subclasses the dialog created in ``.
     52 * `` contains the code that talks to the pydicom library and
     53 generates a list of DICOM files for the dialog box.
     54 * `` contains the DicomFile class which is a generic
     55 container for DICOM files.
     56 * `` contains a Siemens-specific subclass of the
     57 DicomFile class.
     58 * `` creates a dummy main window that launches the dialog.
     60== Technical Notes ==
     62 * It might be tempting to combine `` and ``,
     63 but separating them is useful. It allows the latter to be used with a
     64 dependency on wx. It can be used, for example, on a server to generate
     65 a DICOM file list for a Web application. In that context a wx dependency
     66 would be a headache.
     68 * Similarly, we want to be careful with integrating `` with
     69 our library of wx utilities since it has a depedency on the pydicom library.
     70 We can add it to the library but it should remain a separate file so that
     71 only applications that `import dicom_browser` will have a dependency on
     72 pydicom. The rest of the files in the wx utilities library will remain
     73 free of this depedency.
     75 * wxPython code is always a little awkward because Python and wxWidgets
     76 follow different naming conventions. Python naming convention uses
     77 `lower_case_variables_names` while wx uses `TitleCaps`.
     78 This results from the fact that
     79 wxWidgets is written in C++ and wxPython is a thin, auto-generated
     80 wrapper around it. In practice, it's unusual to find a Python library that
     81 doesn't follow Python's naming conventions.
     83 In our code we've
     84 introduced a third style (from Java, I think) for naming GUI controls and
     85 event handlers which
     86 is `firstLetterLowerThenUpper` (e.g. the dialog has an event handler called
     87 `onTreeItemActivated()`).
     89 Using two different naming conventions is
     90 confusing enough; I do not recommend following our example and introducing
     91 a third. In this code, I used firstLetterLowerThenUpper only to be
     92 consistent with our existing libraries.
     94 * The function `util_dicom.get_files()` is a Python generator which is
     95 something you might not be familiar with. There's a lot of tutorials online
     96 about generators, all of which I find much harder to grasp than the actual code.
     97 Maybe it's just me! Here's one such article: