<commit_before>#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Modul is used for skeleton binary 3D data analysis
"""

# import sys
# import os.path
# path_to_script = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.join(path_to_script, "../extern/dicom2fem/src"))

import logging
logger = logging.getLogger(__name__)

import traceback
import numpy as np
import scipy.ndimage
import scipy.interpolate


class SkeletonAnalyser:

    """
    | Example:
    | skan = SkeletonAnalyser(data3d_skel, volume_data, voxelsize_mm)
    | stats = skan.skeleton_analysis()
    
    | data3d_skel: 3d array with skeleton as 1s and background as 0s
    | use_filter_small_objects: removing small objects
    | filter_small_threshold: threshold for small filtering

    :arg cut_wrong_skeleton: remove short skeleton edges to terminal
    :arg aggregate_near_nodes_distance: combine near nodes to one. Parameter 
    defines distance in mm.
    """

    def __init__(self, data3d_skel, volume_data=None, voxelsize_mm=[1, 1, 1],
                 use_filter_small=False, filter_small_threshold=3,
                 cut_wrong_skeleton=True, aggregate_near_nodes_distance=0):
        # for not
        self.volume_data = volume_data
        self.voxelsize_mm = voxelsize_mm<commit_msg>fix py27: use io.open<commit_after>#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Modul is used for skeleton binary 3D data analysis
"""

# import sys
# import os.path
# path_to_script = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.join(path_to_script, "../extern/dicom2fem/src"))

import logging
logger = logging.getLogger(__name__)

import traceback
import numpy as np
import scipy.ndimage
import scipy.interpolate
from io import open


class SkeletonAnalyser:

    """
    | Example:
    | skan = SkeletonAnalyser(data3d_skel, volume_data, voxelsize_mm)
    | stats = skan.skeleton_analysis()
    
    | data3d_skel: 3d array with skeleton as 1s and background as 0s
    | use_filter_small_objects: removing small objects
    | filter_small_threshold: threshold for small filtering

    :arg cut_wrong_skeleton: remove short skeleton edges to terminal
    :arg aggregate_near_nodes_distance: combine near nodes to one. Parameter 
    defines distance in mm.
    """

    def __init__(self, data3d_skel, volume_data=None, voxelsize_mm=[1, 1, 1],
                 use_filter_small=False, filter_small_threshold=3,
                 cut_wrong_skeleton=True, aggregate_near_nodes_distance=0):
        # for not
        self.volume_data = volume_data
        self.voxelsize_mm = voxelsize_mm
{'fraction_non_alphanumeric': 0.0901386748844376, 'fraction_numerical': 0.011556240369799691, 'mean_word_length': 3.6624775583482942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1980675', 'n_tokens_mistral': 880, 'n_tokens_neox': 836, 'n_words': 208}