imtools Documentation

Transkript

imtools Documentation
imtools Documentation
Release
M. Jirik
January 21, 2016
Contents
1
2
imtools package
1.1 Subpackages . . . . . . . . . . . . .
1.2 Submodules . . . . . . . . . . . . .
1.3 imtools.misc module . . . . . . . . .
1.4 imtools.qmisc module . . . . . . . .
1.5 imtools.sample_data module . . . . .
1.6 imtools.segmentation module . . . .
1.7 imtools.surface_measurement module
1.8 imtools.tools module . . . . . . . . .
1.9 imtools.uiThreshold module . . . . .
1.10 Module contents . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
3
3
4
5
5
6
7
8
9
Indices and tables
11
Python Module Index
13
i
ii
imtools Documentation, Release
Contents:
Contents
1
imtools Documentation, Release
2
Contents
CHAPTER 1
imtools package
Test text
1.1 Subpackages
1.2 Submodules
1.3 imtools.misc module
imtools.misc.obj_from_file(filename=’annotation.yaml’, filetype=’yaml’)
Read object from file
imtools.misc.obj_to_file(obj, filename=’annotation.yaml’, filetype=’yaml’)
Writes annotation in file.
Filetypes: yaml pkl, pickle pklz, picklezip
imtools.misc.read_pkl_and_pklz(filename)
Try read zipped or not zipped pickle file
imtools.misc.resize_to_mm(data3d, voxelsize_mm, new_voxelsize_mm, mode=’nearest’)
Function can resize data3d or segmentation to specifed voxelsize_mm :new_voxelsize_mm: requested voxelsize. List of 3 numbers, also
can be a string ‘orig’, ‘orgi*2’ and ‘orgi*4’.
Voxelsize_mm size of voxel
Mode default is ‘nearest’
imtools.misc.resize_to_shape(data, shape, zoom=None, mode=’nearest’, order=0)
Function resize input data to specific shape.
Parameters
• data – input 3d array-like data
• shape – shape of output data
• zoom – zoom is used for back compatibility
Mode default is ‘nearest’
3
imtools Documentation, Release
imtools.misc.suggest_filename(file_path, exists=None)
Append a string with number to its filename if the path exist. :param file_path: input file path :param exists:
You can force path exists check. It is usefull for debug issues.
1.4 imtools.qmisc module
class imtools.qmisc.SparseMatrix(ndarray)
todense()
imtools.qmisc.combinecrinfo(crinfo1, crinfo2)
Combine two crinfos. First used is crinfo1, second used is crinfo2.
imtools.qmisc.crinfo_from_specific_data(data, margin)
Create crinfo of minimum orthogonal nonzero block in input data.
Parameters
• data – input data
• margin – add margin to minimum block
Returns
imtools.qmisc.crop(data, crinfo)
Crop the data.
crop(data, crinfo)
Parameters crinfo – min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
imtools.qmisc.fix_crinfo(crinfo, to=’axis’)
Function recognize order of crinfo and convert it to proper format.
imtools.qmisc.getVersionString()
Function return string with version information. It is performed by use one of three procedures: git describe,
file in .git dir and file __VERSION__.
imtools.qmisc.get_one_biggest_object(data)
Return biggest object
imtools.qmisc.isSparseMatrix(obj)
imtools.qmisc.manualcrop(data)
imtools.qmisc.max_area_index(labels, num)
Return index of maxmum labeled area
imtools.qmisc.resize_to_mm(*pars, **params)
Function can resize data3d or segmentation to specifed voxelsize_mm :new_voxelsize_mm: requested voxelsize. List of 3 numbers, also
can be a string ‘orig’, ‘orgi*2’ and ‘orgi*4’.
Voxelsize_mm size of voxel
Mode default is ‘nearest’
imtools.qmisc.resize_to_shape(*pars, **params)
imtools.qmisc.uncrop(data, crinfo, orig_shape, resize=False)
4
Chapter 1. imtools package
imtools Documentation, Release
Parameters
• data – input data
• crinfo – array with minimum and maximum index along each axis [[minX. maxX],[minY,
maxY],[minZ, maxZ]]
• orig_shape – shape of uncropped image
• resize –
Returns
1.5 imtools.sample_data module
imtools.sample_data.check_python_architecture(pythondir, target_arch_str)
functions check architecture of target python
imtools.sample_data.download_and_run(url, local_file_name)
imtools.sample_data.downzip(url, destination=’./sample_data/’)
Download, unzip and delete.
imtools.sample_data.file_copy_and_replace_lines(in_path, out_path)
imtools.sample_data.get_conda_path()
imtools.sample_data.get_sample_data(data_label=None, destination_dir=’.’)
Download sample data by data label. Labels can be listed by sample_data.data_urls.keys() :param data_label:
label of data. If it is set to None, all data are downloaded :param destination_dir: output dir for data :return:
imtools.sample_data.get_sample_data_old()
imtools.sample_data.main()
imtools.sample_data.make_icon()
imtools.sample_data.remove(local_file_name)
imtools.sample_data.submodule_update()
1.6 imtools.segmentation module
Purpose: (CZE-ZCU-FAV-KKY) Liver medical project
Author: Pavel Volkovinsky Email: [email protected]
Created: 2012/11/08 Copyright: (c) Pavel Volkovinsky
imtools.segmentation.vesselSegmentation(data, segmentation=-1, threshold=-1, voxelsize_mm=[1, 1, 1], inputSigma=-1, dilationIterations=0, dilationStructure=None, nObj=10,
biggestObjects=False,
useSeedsOfCompactObjects=False, seeds=None, interactivity=True,
binaryClosingIterations=2,
binaryOpeningIterations=0,
smartInitBinaryOperations=False,
returnThreshold=False, binaryOutput=True, returnUsedData=False, qapp=None, auto_method=’‘)
Vessel segmentation z jater.
1.5. imtools.sample_data module
5
imtools Documentation, Release
Input: data - CT (nebo MRI) 3D data segmentation - zakladni oblast pro segmentaci, oznacena struktura se
stejnymi rozmery jako “data”,
kde je oznaceni (label) jako: 1 jatra, -1 zajimava tkan (kosti, ...) 0 jinde
threshold - prah voxelsize_mm - (vektor o hodnote 3) rozmery jednoho voxelu inputSigma - pocatecni
hodnota pro prahovani dilationIterations - pocet operaci dilation nad zakladni oblasti pro
segmentaci (“segmantation”)
dilationStructure - struktura pro operaci dilation nObj - oznacuje, kolik nejvetsich objektu se ma vyhledat
- pokud je
rovno 0 (nule), vraci cela data
biggestObjects - moznost, zda se maji vracet nejvetsi objekty nebo ne seeds - moznost zadat pocatecni
body segmentace na vstupu. Je to matice
o rozmerech jako data. Vsude nuly, tam kde je oznaceni jsou jednicky
interactivity - nastavi, zda ma nebo nema byt pouzit interaktivni mod upravy dat
binaryClosingIterations - vstupni binary closing operations binaryOpeningIterations - vstupni binary opening operations smartInitBinaryOperations - logicka hodnota pro smart volbu pocatecnich
hodnot binarnich operaci (bin. uzavreni a bin. otevreni)
returnThreshold - jako druhy parametr funkce vrati posledni hodnotu prahu
binaryOutput - zda ma byt vystup vracen binarne nebo ne (binarnim vystupem se rozumi: cokoliv
jineho nez hodnota 0 je hodnota 1)
returnUsedData - vrati pouzita data
Output: filtrovana data
1.7 imtools.surface_measurement module
Measurement of object surface.
data3d: 3D numpy array segmentation: 3D numpyarray
imtools.surface_measurement.bufford_needle_sond(data3d, voxelsize_mm,
axis, aoi)
raster_mm,
imtools.surface_measurement.find_edge(segmentation, axis)
imtools.surface_measurement.main()
imtools.surface_measurement.surface_density(segmentation, voxelsize_mm,
sond_raster_mm=None)
aoi=None,
Segmentation is ndarray with 0 and 1
Voxelsize_mm is array of three numbers specifiing size of voxel for each axis
Aoi is specify area of interest. It is ndarray with 0 and 1
Sond_raster_mm unimplemented. It is parametr of sonds design
6
Chapter 1. imtools package
imtools Documentation, Release
1.8 imtools.tools module
imtools.tools.analyse_histogram(data, roi=None, show=False, show_now=True, dens_min=20,
dens_max=255, minT=0.95, maxT=1.05)
imtools.tools.arange_figs(imgs,
tits=None,
max_r=3,
max_c=5,
same_range=False, show_now=True)
colorbar=False,
imtools.tools.auto_canny(image, sigma=0.33)
imtools.tools.change_slice_index(data)
imtools.tools.closing3D(data,
selem=<Mock
name=’mock.morphology.disk()’
id=‘140377740157392’>, slicewise=False, sliceId=0)
imtools.tools.crop_to_bbox(im, mask)
imtools.tools.eroding3D(data, selem=None, selem_size=3, slicewise=False, sliceId=0)
imtools.tools.get_bbox(im)
Returns bounding box in slicing-friendly format (i-min, i-xmax, j-min, j-max, k-min, k-max). The fourth and
fifth items are returned only if input image is 3D. Parameters ———- im - input binary image
indices - (i-min, i-xmax, j-min, j-max, k-min, k-max) in 3D case, (i-min, i-xmax, j-min, j-max) in 2D case.
imtools.tools.get_central_moment(obj, p, q, r)
imtools.tools.get_hist_mode(im, mask=None, debug=False)
imtools.tools.get_overlay(mask, alpha=0.3, color=’r’)
imtools.tools.get_seeds(im, minT=0.95, maxT=1.05, minInt=0, maxInt=255, debug=False)
imtools.tools.get_status_text(text, iter, max_iter)
imtools.tools.get_subdir_fname(data_fname, subdir, ext=’npy’, create=False)
imtools.tools.get_superpxl_intensities(im, suppxls)
Calculates mean intensities of pixels in superpixels inputs:
im ... grayscale image, ndarray [MxN] suppxls ... image with suppxls labels, ndarray -same shape as
im
outputs: suppxl_intens ... vector with suppxls mean intensities
imtools.tools.get_zunics_compatness(obj)
imtools.tools.intensity_probability(data,
std=20,
dens_max=255)
mask=None,
dens_min=10,
imtools.tools.intensity_range2superpixels(im, superpixels, intMinT=0.95, intMaxT=1.05,
debug=False, intMin=0, intMax=255)
imtools.tools.label_3D(data, class_labels, background=-1)
imtools.tools.load_pickle_data(fname, slice_idx=-1, return_datap=False)
imtools.tools.morph_hat(img, strels, type=’tophat’, show=False, show_now=True)
imtools.tools.opening3D(data,
selem=<Mock
id=‘140377740157392’>, sliceId=0)
name=’mock.morphology.disk()’
imtools.tools.put_bbox_back(im_o, im_b, bbox=None, mask=None)
imtools.tools.read_data(dcmdir,
indices=None,
wildcard=’*.dcm’,
name=’mock.int16’ id=‘140377740099536’>)
1.8. imtools.tools module
type=<Mock
7
imtools Documentation, Release
imtools.tools.remove_empty_suppxls(suppxls)
Remove empty superpixels. Sometimes there are superpixels(labels), which are empty. To overcome subsequent
problems, these empty superpixels should be removed. inputs:
suppxls ... image with suppxls labels, ndarray [MxN]-same size as im
outputs: new_supps ... image with suppxls labels, ndarray [MxN]-same size as im, empty superpixel labels are
removed
imtools.tools.resize3D(data, scale, sliceId=2, method=’cv2’)
imtools.tools.save_figs(data_fname, subdir, data, mask, imgs, ranges=None, cmaps=None)
imtools.tools.save_pickle(data_fname, subdir, data, mask, segs, voxel_size, slab=None)
imtools.tools.seeds2superpixels(seed_mask, superpixels, debug=False, im=None)
imtools.tools.show_3d(data, range=True)
imtools.tools.show_slice(data, segmentation=None, lesions=None, win_l=50, win_w=350, windowing=False, show=’True’)
imtools.tools.slics_3D(im, pseudo_3D=True, n_segments=100, get_slicewise=False)
imtools.tools.slim_seeds(seeds, sliceId=2)
imtools.tools.smoothing(data, d=10, sigmaColor=10, sigmaSpace=10, sliceId=2)
imtools.tools.smoothing_bilateral(data,
sigma_space=15,
pseudo_3D=’True’, sliceId=2)
sigma_color=0.05,
imtools.tools.smoothing_float_tv(data, weight=0.01, pseudo_3D=True, multichannel=False,
sliceId=2)
imtools.tools.smoothing_gauss(data, sigma=1, pseudo_3D=’True’, sliceId=2)
imtools.tools.smoothing_tv(data, weight=0.1, pseudo_3D=True, multichannel=False, sliceId=2)
imtools.tools.suppxl_ints2im(suppxls, suppxl_ints=None, im=None)
Replaces superpixel labels with their mean value. inputs:
suppxls ... image with suppxls labels, ndarray suppxl_intens ... vector with suppxls mean intensities
im ... input image
outputs: suppxl_ints_im ... image with suppxls mean intensities, ndarray same shape as suppxls
imtools.tools.view_segmentation(datap_1, datap_2=None)
imtools.tools.windowing(data, level=50, width=350, sub1024=False, sliceId=2)
1.9 imtools.uiThreshold module
Purpose: (CZE-ZCU-FAV-KKY) Liver medical project
Author: Pavel Volkovinsky Email: [email protected]
Created: 2012/11/08 Copyright: (c) Pavel Volkovinsky
imtools.uiThreshold.main()
8
Chapter 1. imtools package
imtools Documentation, Release
class imtools.uiThreshold.uiThreshold(data, voxel, threshold=-1, interactivity=True, number=100.0, inputSigma=-1, nObj=10, biggestObjects=True, useSeedsOfCompactObjects=True, binaryClosingIterations=2,
binaryOpeningIterations=0,
seeds=None, cmap=<Mock name=’mock.cm.Greys_r’
id=‘140377735585488’>, fillHoles=True, figure=None,
auto_method=’‘)
UI pro prahovani 3D dat.
buttonContinue(event)
buttonMaxNext(event)
buttonMaxPrev(event)
buttonMinNext(event)
buttonMinPrev(event)
buttonNextClosing(event)
buttonNextOpening(event)
buttonPrevClosing(event)
buttonPrevOpening(event)
buttonReset(event)
debugInfo()
drawVisualization()
Vykresleni dat.
getBiggestObjects()
Vraceni nejvetsich objektu (nebo objektu, ktere obsahuji prioritni seedy).
returnLastThreshold()
run()
Spusteni UI.
updateImage(val)
Hlavni update metoda. Cinny kod pro gaussovske filtrovani, prahovani, binarni uzavreni a otevreni a
vraceni nejvetsich nebo oznacenych objektu.
1.10 Module contents
1.10. Module contents
9
imtools Documentation, Release
10
Chapter 1. imtools package
CHAPTER 2
Indices and tables
• genindex
• modindex
• search
11
imtools Documentation, Release
12
Chapter 2. Indices and tables
Python Module Index
i
imtools, 9
imtools.misc, 3
imtools.qmisc, 4
imtools.sample_data, 5
imtools.segmentation, 5
imtools.surface_measurement, 6
imtools.tools, 7
imtools.uiThreshold, 8
13
imtools Documentation, Release
14
Python Module Index
Index
A
analyse_histogram() (in module imtools.tools), 7
arange_figs() (in module imtools.tools), 7
auto_canny() (in module imtools.tools), 7
download_and_run() (in module imtools.sample_data), 5
downzip() (in module imtools.sample_data), 5
drawVisualization()
(imtools.uiThreshold.uiThreshold
method), 9
B
E
bufford_needle_sond()
(in
module
imtools.surface_measurement), 6
buttonContinue()
(imtools.uiThreshold.uiThreshold
method), 9
buttonMaxNext()
(imtools.uiThreshold.uiThreshold
method), 9
buttonMaxPrev()
(imtools.uiThreshold.uiThreshold
method), 9
buttonMinNext()
(imtools.uiThreshold.uiThreshold
method), 9
buttonMinPrev()
(imtools.uiThreshold.uiThreshold
method), 9
buttonNextClosing() (imtools.uiThreshold.uiThreshold
method), 9
buttonNextOpening() (imtools.uiThreshold.uiThreshold
method), 9
buttonPrevClosing() (imtools.uiThreshold.uiThreshold
method), 9
buttonPrevOpening() (imtools.uiThreshold.uiThreshold
method), 9
buttonReset() (imtools.uiThreshold.uiThreshold method),
9
eroding3D() (in module imtools.tools), 7
C
F
file_copy_and_replace_lines()
(in
module
imtools.sample_data), 5
find_edge() (in module imtools.surface_measurement), 6
fix_crinfo() (in module imtools.qmisc), 4
G
get_bbox() (in module imtools.tools), 7
get_central_moment() (in module imtools.tools), 7
get_conda_path() (in module imtools.sample_data), 5
get_hist_mode() (in module imtools.tools), 7
get_one_biggest_object() (in module imtools.qmisc), 4
get_overlay() (in module imtools.tools), 7
get_sample_data() (in module imtools.sample_data), 5
get_sample_data_old() (in module imtools.sample_data),
5
get_seeds() (in module imtools.tools), 7
get_status_text() (in module imtools.tools), 7
get_subdir_fname() (in module imtools.tools), 7
get_superpxl_intensities() (in module imtools.tools), 7
get_zunics_compatness() (in module imtools.tools), 7
getBiggestObjects() (imtools.uiThreshold.uiThreshold
method), 9
imgetVersionString() (in module imtools.qmisc), 4
change_slice_index() (in module imtools.tools), 7
check_python_architecture()
(in
module
tools.sample_data), 5
closing3D() (in module imtools.tools), 7
I
combinecrinfo() (in module imtools.qmisc), 4
crinfo_from_specific_data() (in module imtools.qmisc), 4 imtools (module), 9
imtools.misc (module), 3
crop() (in module imtools.qmisc), 4
imtools.qmisc (module), 4
crop_to_bbox() (in module imtools.tools), 7
imtools.sample_data (module), 5
imtools.segmentation (module), 5
D
debugInfo() (imtools.uiThreshold.uiThreshold method), 9 imtools.surface_measurement (module), 6
15
imtools Documentation, Release
imtools.tools (module), 7
imtools.uiThreshold (module), 8
intensity_probability() (in module imtools.tools), 7
intensity_range2superpixels() (in module imtools.tools),
7
isSparseMatrix() (in module imtools.qmisc), 4
L
smoothing_gauss() (in module imtools.tools), 8
smoothing_tv() (in module imtools.tools), 8
SparseMatrix (class in imtools.qmisc), 4
submodule_update() (in module imtools.sample_data), 5
suggest_filename() (in module imtools.misc), 3
suppxl_ints2im() (in module imtools.tools), 8
surface_density()
(in
module
imtools.surface_measurement), 6
label_3D() (in module imtools.tools), 7
load_pickle_data() (in module imtools.tools), 7
T
M
main() (in module imtools.sample_data), 5
main() (in module imtools.surface_measurement), 6
main() (in module imtools.uiThreshold), 8
make_icon() (in module imtools.sample_data), 5
manualcrop() (in module imtools.qmisc), 4
max_area_index() (in module imtools.qmisc), 4
morph_hat() (in module imtools.tools), 7
O
obj_from_file() (in module imtools.misc), 3
obj_to_file() (in module imtools.misc), 3
opening3D() (in module imtools.tools), 7
P
todense() (imtools.qmisc.SparseMatrix method), 4
U
uiThreshold (class in imtools.uiThreshold), 8
uncrop() (in module imtools.qmisc), 4
updateImage()
(imtools.uiThreshold.uiThreshold
method), 9
V
vesselSegmentation() (in module imtools.segmentation),
5
view_segmentation() (in module imtools.tools), 8
W
windowing() (in module imtools.tools), 8
put_bbox_back() (in module imtools.tools), 7
R
read_data() (in module imtools.tools), 7
read_pkl_and_pklz() (in module imtools.misc), 3
remove() (in module imtools.sample_data), 5
remove_empty_suppxls() (in module imtools.tools), 7
resize3D() (in module imtools.tools), 8
resize_to_mm() (in module imtools.misc), 3
resize_to_mm() (in module imtools.qmisc), 4
resize_to_shape() (in module imtools.misc), 3
resize_to_shape() (in module imtools.qmisc), 4
returnLastThreshold() (imtools.uiThreshold.uiThreshold
method), 9
run() (imtools.uiThreshold.uiThreshold method), 9
S
save_figs() (in module imtools.tools), 8
save_pickle() (in module imtools.tools), 8
seeds2superpixels() (in module imtools.tools), 8
show_3d() (in module imtools.tools), 8
show_slice() (in module imtools.tools), 8
slics_3D() (in module imtools.tools), 8
slim_seeds() (in module imtools.tools), 8
smoothing() (in module imtools.tools), 8
smoothing_bilateral() (in module imtools.tools), 8
smoothing_float_tv() (in module imtools.tools), 8
16
Index

Podobné dokumenty

zadání tutoriálu

zadání tutoriálu V minulém dı́le tutoriálu jsme se seznámili se základnı́mi pravidly syntaxe a programovanı́ v jazyce Python. Popularita tohoto jazyka však nepramenı́ pouze z velmi pohodlné syntaxe, ale také...

Více

Oxygen 2 Light je oficiální program na tvorbu addonů. Můžete si ho

Oxygen 2 Light je oficiální program na tvorbu addonů. Můžete si ho Naprosto zbytečný LOD. Měl by značit to odkud můžete střílet z aut atd., ale OFP to zatím neumožňuje. 11. View cargo/commander/gunner/pilot - geometry Funguje jako View geometry (viz. níže), ale pr...

Více

Nástroje pro vývoj aplikací a jejich vazba na CASE

Nástroje pro vývoj aplikací a jejich vazba na CASE Předpokládá se, že uživatel těchto modelů je člověk, který není obeznámen s modely nebo konstrukcemi užívaných k vyjádření funkčnosti těch požadavků, které jsou právě specifikované v CIM. Nejčastěj...

Více

Bezpečnostní politika Flash Playeru a použití ASPX pro odeslání

Bezpečnostní politika Flash Playeru a použití ASPX pro odeslání možností. Ne stát ale velmi intenzivně se snažit jim porozumět a naučit se je v plné šíři využívat. Tato myšlenka nás vedla k rozhodnutí, ukázat jedno velmi zajímavé a užitečné použití. Flash vytvá...

Více