File: __init__.py

package info (click to toggle)
vistrails 2.1.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 74,208 kB
  • ctags: 46,250
  • sloc: python: 316,267; xml: 52,512; sql: 3,627; php: 731; sh: 260; makefile: 108
file content (179 lines) | stat: -rw-r--r-- 6,364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
############################################################################
##
## Copyright (C) 2006-2007 University of Utah. All rights reserved.
##
## This file is part of VisTrails.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Foundation
## and appearing in the file LICENSE.GPL included in the packaging of
## this file.  Please review the following to ensure GNU General Public
## Licensing requirements will be met:
## http://www.opensource.org/licenses/gpl-license.php
##
## If you are unsure which license is appropriate for your use (for
## instance, you are interested in developing a commercial derivative
## of VisTrails), please contact us at contact@vistrails.org.
##
## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
############################################################################
#  ITK package for VisTrails
############################################################################

"""ITK is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. www.itk.org

For info on installing itk and python-itk on ubuntu see: http://paulnovo.org/node/2

For info on generating wrapper modules for more itk filters see itk/filter_generator.py"""

version = '0.2'
identifier = 'edu.utah.sci.vistrails.itk'
name = 'ITK'

import core.bundles.utils
import core.requirements
from core.modules.vistrails_module import Module, ModuleError

# Ugly, but Carlos doesnt know any better
if core.bundles.utils.guess_system() == 'linux-ubuntu':
    import sys
    sys.path.append('/usr/local/lib/VisTrailsITK')

try:
    from core.bundles import py_import
    itk = py_import('itk', {'linux-ubuntu': 'vistrails-itk'})
except ImportError:
    raise core.requirements.MissingRequirement("ITK and WrapITK")

import core.modules
import core.modules.module_registry

# ITK Package imports
from PixelType import *
from FeatureExtractionFilters import *
from ITK import *
from Image import Image
from IntensityFilters import *
from SegmentationFilters import *
from SelectionFilters import *
from SmoothingFilters import *
from ThresholdFilters import *
from GradientFilters import *
from NeighborhoodFilters import *
from ImageReader import *

def initialize(*args, **keywords):
    reg = core.modules.module_registry
    basic = core.modules.basic_modules

########################################################################################
# Misc.
    Index2D.register(reg,basic)
    Index3D.register(reg,basic)
    Size.register(reg,basic)
    Region.register(reg,basic)
    PixelType.register(reg,basic)
    Filter.register(reg,basic)
    Kernel.register(reg,basic)

    Image.register(reg,basic)

########################################################################################
# Pixel Types
    pixeltypes = [PixelTypeFloat,
                  PixelTypeUnsignedChar,
                  PixelTypeUnsignedShort,
                  PixelTypeRGB]

    for cls in pixeltypes:
        cls.register(reg,basic)


########################################################################################
# Feature Extraction Filters
    featurefilters = [GradientMagnitudeRecursiveGaussianImageFilter,
                      DanielssonDistanceMapImageFilter,
                      SobelEdgeDetectionImageFilter]

    for cls in featurefilters:
        cls.register(reg,basic)

########################################################################################
# Intensity Filters
    intensityfilters = [RescaleIntensityImageFilter,
                        SigmoidImageFilter,
                        ThresholdImageFilter,
                        ShiftScaleImageFilter,
                        NormalizeImageFilter]

    for cls in intensityfilters:
        cls.register(reg,basic)

########################################################################################
# Segmentation Filters
    segmentationfilters = [IsolatedWatershedImageFilter,
                           ConnectedThresholdImageFilter,
                           ConfidenceConnectedImageFilter,
                           IsolatedConnectedImageFilter]

    for cls in segmentationfilters:
        cls.register(reg,basic)

########################################################################################
# Selection Filters
    selectionfilters = [RegionOfInterestImageFilter,
                        CastImageFilter,
                        ExtractImageFilter]

    for cls in selectionfilters:
        cls.register(reg,basic)

########################################################################################
# Smoothing Filters
    smoothingfilters = [CurvatureAnisotropicDiffusionFilter,
                        RecursiveGaussianImageFilter,
                        DiscreteGaussianImageFilter,
                        GradientAnisotropicDiffusionImageFilter,
                        MinMaxCurvatureFlowImageFilter,
                        BinomialBlurImageFilter,
                        BilateralImageFilter,
                        CurvatureFlowImageFilter]

    for cls in smoothingfilters:
        cls.register(reg,basic)

########################################################################################
# Threshold Filters
    thresholdfilters = [BinaryThresholdImageFilter]

    for cls in thresholdfilters:
        cls.register(reg,basic)

########################################################################################
# Gradient Filters
    gradientfilters = [GradientMagnitudeImageFilter]

    for cls in gradientfilters:
        cls.register(reg,basic)

########################################################################################
# Neighborhood Filters
    neighborhoodfilters = [MeanImageFilter,
                           MedianImageFilter,
                           BinaryErodeImageFilter]

    for cls in neighborhoodfilters:
        cls.register(reg,basic)

########################################################################################
# Image Reader
    imagereader = [ImageReader,
                   ImageToFile,
                   GDCMReader,
                   DICOMReader]


    for cls in imagereader:
        cls.register(reg,basic)