Esempio n. 1
0
    def start(self):
        ### INITIAL STEPS ###

        # check parameters look good before proceeding
        self.validate_parameters()

        self.__write_output_dirs()

        ### DATA LOAD AND SUBSAMPLE
        #TODO: No ftype param
        self.dataset = DatasetFactory.ds_from_dir(self.mesh_dir, ftype='ply')

        # need to get both sets of subsample results
        ss_points = [self.ss_points_i, self.ss_points_f]
        #TODO: Should use named parameters as the constructor for Subsample, I'm not sure what ss_type refers to.
        #TODO: init doesn't return anything, so I've encoded the results dictionary in subsample_res.ret
        subsample_res = Subsample(
            self.dataset['mesh'], ss_points, self.ss_type
        )  # dataset class should eventually support multiple named mesh sets and should be dict-style callable like this for mesh TODO: Currently does not support multiple named mesh sets, and the param is dataset.meshes
        ss_meshes_i = subsample_res[ss_points[0]]['output'][
            'results']  #TODO: Results isnt a list of meshes, its a dict
        ss_meshes_f = subsample_res[ss_points[1]]['output']['results']

        #TODO: Add mesh set doesnt exist as a method. Self.dataset isnt a dataset, its a data set collection, maybe create a method to instantiate a new data set, and add it to the Dataset COllection? THis naming is kind of bad
        self.dataset.add_mesh_set(self.ss_label_i, ss_meshes_i)
        self.dataset.add_mesh_set(self.ss_label_f, ss_meshes_f)

        ### INITIAL SUBSAMPLE POINTS ANALYSIS ###
        ss_i_correspondence_res = Correspondence(  # Correspondence should take an initial alignment object with d, p, and r arrays; also correspondence should handle bundling pairwise results into a single data structure
            meshes=self.dataset[self.ss_label_i],
            initial_alignment=None,
            globalize=True,
            mirror=self.allow_reflection)
        # Correspondence data structure should be an object with the following attributes: local_align with d, p, and r arrays, mst with minimum spanning tree, and global_align with d, p, and r arrays

        self.dataset.add_analysis_set(self.ss_label_i, ss_i_correspondence_res)

        ### FINAL SUBSAMPLE POINTS ANALYSIS ###
        ss_f_correspondence_res = Correspondence(  # Correspondence should take an initial alignment object with d, p, and r arrays; also correspondence should handle bundling pairwise results into a single data structure
            meshes=self.dataset[self.ss_label_f],
            initial_alignment=self.dataset.analysis_set[
                self.ss_label_i].global_align,
            globalize=True,
            mirror=self.allow_reflection)
Esempio n. 2
0
from auto3dgm_nazar.dataset.datasetfactory import DatasetFactory
from auto3dgm_nazar.mesh.subsample import Subsample
from auto3dgm_nazar.analysis.correspondence import Correspondence
import os

cwd=os.getcwd()
mesh_dir = cwd+"/input/"

# Create a DatasetCollection with meshes from a sample directory 
dc = DatasetFactory.ds_from_dir(dir_path=mesh_dir, center_scale=True)
print(dc)
print(dc.datasets)
print(dc.analysis_sets) # Why is the initial dataset copied as an analysis_set?

# Generate two sets of subsamples with 100 and 200 points each
subsample_points = [100, 200]
subsample_results = Subsample(dc.datasets[0], subsample_points, 'FPS') # this absolutely does not work

# Add these results as additional datasets to our DatasetCollection
dc.add_dataset(subsample_results[100]['output']['results'], 'ss100')
dc.add_dataset(subsample_results[200]['output']['results'], 'ss200')

# Generate Correspondence results for first (100) subsample points dataset
# Correspondence data structure should be an object with the following attributes: local_align with d, p, and r arrays, mst with minimum spanning tree, and global_align with d, p, and r arrays
ss_100_correspondence_res = Correspondence( 
	meshes=dc.datasets['ss100'],
	initial_alignment=None, 
	globalize=True,
	mirror=True)
dc.add_analysis_set(ss_100_correspondence_res, 'ss100')
#Test script for the dataset factory
from auto3dgm_nazar.dataset.datasetfactory import DatasetFactory

#Test case 1:
#Conditions: directorystring refers to an invalid directory
#Action: I try to create a dataset using the directory string
#Expected result: I get and error
directorystring = '/home/safari/Desktop/tutkimus/Slicer/HackathonJAN/testdata/20_Test_Teeth_PLY'
DatasetFactory.ds_from_dir(directorystring)
"""
In [1]: #Test script for the dataset factory

In [2]: from auto3dgm.dataset.datasetfactory import DatasetFactory

In [3]: 

In [3]: #Test case 1:

In [4]: #

In [5]: directorystring='/home/safari/Desktop/tutkimus/Slicer/HackathonJAN/testdata/20_Test_Teeth_PLY'

In [6]: DatasetFactory.ds_from_dir(directorystring)
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-6-ca24c7604382> in <module>()
----> 1 DatasetFactory.ds_from_dir(directorystring)

/home/safari/Desktop/tutkimus/Slicer/HackathonJAN/gitstuff/auto3dgm/auto3dgm/dataset/datasetfactory.py in ds_from_dir(directorystring, ftype)
     12         if not files:
     13             msg = 'No .'+ftype+' files were found in '+path
Esempio n. 4
0
 def createDataset(inputdirectory):
     from auto3dgm_nazar.dataset.datasetfactory import DatasetFactory
     dataset = DatasetFactory.ds_from_dir(inputdirectory, center_scale=True)
     return dataset
Esempio n. 5
0
 def createDataset(inputdirectory):
     dataset = DatasetFactory.ds_from_dir(inputdirectory, center_scale=True)
     return dataset