| 87 | |
| 88 | |
| 89 | class HairStylePathData(): |
| 90 | def __init__(self, hairstyle_path): |
| 91 | self.hairstyle_path=hairstyle_path |
| 92 | |
| 93 | #check the chunked versions |
| 94 | #for full_strands |
| 95 | # path_chunk_10 = os.path.join(hairstyle_path,"full_strands_chunked","nr_strands_10") |
| 96 | self.path_chunk_100 = os.path.join(hairstyle_path,"full_strands_chunked","nr_strands_100") |
| 97 | self.path_chunk_1000 = os.path.join(hairstyle_path,"full_strands_chunked","nr_strands_1000") |
| 98 | # self.chunked_10_strands_files = [os.path.join(path_chunk_10, f) for f in listdir(path_chunk_10)] |
| 99 | # self.chunked_100_strands_files = [os.path.join(path_chunk_100, f) for f in listdir(path_chunk_100)] |
| 100 | # self.chunked_1000_strands_files = [os.path.join(path_chunk_1000, f) for f in listdir(path_chunk_1000)] |
| 101 | |
| 102 | # check if we even have the chunked data required |
| 103 | def can_load_chunked_paths(self,chunk=100): |
| 104 | if chunk==100: |
| 105 | return os.path.isdir(self.path_chunk_100) and not dir_empty(self.path_chunk_100) |
| 106 | elif chunk==1000: |
| 107 | return os.path.isdir(self.path_chunk_1000) and not dir_empty(self.path_chunk_1000) |
| 108 | else: |
| 109 | return False |
| 110 | |
| 111 | # to save memory and process time, we load the chunked paths of the granularity that we expect to read from later |
| 112 | def load_chunked_paths(self,chunk=100): |
| 113 | if chunk==100: |
| 114 | self.chunked_100_strands_files = [os.path.join(self.path_chunk_100, f) for f in listdir(self.path_chunk_100)] |
| 115 | elif chunk==1000: |
| 116 | self.chunked_1000_strands_files = [os.path.join(self.path_chunk_1000, f) for f in listdir(self.path_chunk_1000)] |
| 117 | else: |
| 118 | print('please check chunk value') |
| 119 | exit() |
| 120 | |
| 121 | |
| 122 | |