<commit_before>def get_points(root_folder, study_name):
    import os
    import CIP.logic.geometry_topology_data as gtd
    points = 0
    for file_name in os.listdir(root_folder):
        if study_name in file_name:
            geom = gtd.GeometryTopologyData.from_xml_file(os.path.join(root_folder, file_name))
            points += len(geom.points)
    print "Total number of points: {}".format(points)


if  __name__ == "__main__":
    get_points("/Users/jonieva/Projects/acil-master/parenchymaTraining", "PLuSS")<commit_msg>ENH: ParenchymaTraining: new script to get number of points-patients filtering by type<commit_after>import sys
sys.path.append('/Users/jonieva/Projects/SlicerCIP/Scripted/CIP_ParenchymaSubtypeTraining')
sys.path.append('/Users/jonieva/Projects/SlicerCIP/Scripted/CIP_Common')

def get_points(root_folder, study_name):
    import os
    import CIP.logic.geometry_topology_data as gtd
    points = 0
    for file_name in os.listdir(root_folder):
        if study_name in file_name:
            geom = gtd.GeometryTopologyData.from_xml_file(os.path.join(root_folder, file_name))
            points += len(geom.points)
    print "Total number of points: {}".format(points)

def get_points_type(root_folder, study_name, typeId):
    import os
    import CIP.logic.geometry_topology_data as gtd
    points = 0
    patients = set()
    from CIP_ParenchymaSubtypeTrainingLogic import SubtypingParameters
    s = SubtypingParameters.SubtypingParameters()
    subtypes = s.getSubtypes(typeId)
    subtypes[typeId] = 0

    print "Subtypes: ", subtypes

    for file_name in os.listdir(root_folder):
        if study_name in file_name:
            geom = gtd.GeometryTopologyData.from_xml_file(os.path.join(root_folder, file_name))
            p = gtd.Point
            for point in geom.points:
                if point.chest_type in subtypes:
                    points += 1
                    patients.add(file_name)

    return patients, points


if  __name__ == "__main__":
    patients, points = get_points_type("/Users/jonieva/Projects/acil/parenchymaTraining/", "DECAMP", 2)
    print points
    print patients
    print len(patients)
{'fraction_non_alphanumeric': 0.09111933395004625, 'fraction_numerical': 0.0027752081406105457, 'mean_word_length': 3.2916666666666665, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '1460812', 'n_tokens_mistral': 725, 'n_tokens_neox': 689, 'n_words': 147}