# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import itk from distutils.version import StrictVersion as VS if VS(itk.Version.GetITKVersion()) < VS("4.8.0"): print("ITK 4.8.0 is required (see example documentation).") sys.exit(1) if len(sys.argv) != 6: print("Usage: " + sys.argv[0] + " [InputFileName] [OutputFileName1X] [OutputFileName1Y]" + " [OutputFileName2X] [OutputFileName2Y]") sys.exit(1) inputFileName = sys.argv[1] outputFileName1X = sys.argv[2] outputFileName1Y = sys.argv[3] outputFileName2X = sys.argv[4] outputFileName2Y = sys.argv[5]
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #==========================================================================*/ import sys try: import numpy as np except ImportError: # We don't have numpy -- bail sys.exit(0) from distutils.version import StrictVersion as VS if VS(np.__version__) < VS('1.15.0'): print('NumPy 1.15.0 or greater is required') sys.exit(0) import itk if len(sys.argv) < 2: print('Usage: ' + sys.argv[0] + ' <input_image>') sys.exit(1) filename = sys.argv[1] image = itk.imread(filename) meta_data = dict(image) assert meta_data['0008|0008'] == 'ORIGINAL\\PRIMARY\\AXIAL' assert meta_data['0008|0016'] == '1.2.840.10008.5.1.4.1.1.2'
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import argparse import itk from distutils.version import StrictVersion as VS if VS(itk.Version.GetITKVersion()) < VS("5.0.0"): print("ITK 5.0.0 or newer is required.") sys.exit(1) parser = argparse.ArgumentParser(description='Segment blood vessels.') parser.add_argument('input_image') parser.add_argument('output_image') parser.add_argument('--sigma', type=float, default=1.0) parser.add_argument('--alpha1', type=float, default=0.5) parser.add_argument('--alpha2', type=float, default=2.0) args = parser.parse_args() input_image = itk.imread(args.input_image, itk.ctype('float')) hessian_image = itk.hessian_recursive_gaussian_image_filter(input_image, sigma=args.sigma)
# # http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ==========================================================================*/ import sys import numpy as np from distutils.version import StrictVersion as VS if VS(np.__version__) < VS("1.15.0"): print("NumPy 1.15.0 or greater is required") sys.exit(0) import itk if len(sys.argv) < 2: print("Usage: " + sys.argv[0] + " <input_image>") sys.exit(1) filename = sys.argv[1] image = itk.imread(filename) meta_data = dict(image) assert meta_data["0008|0008"] == "ORIGINAL\\PRIMARY\\AXIAL" assert meta_data["0008|0016"] == "1.2.840.10008.5.1.4.1.1.2"