@@ -137,13 +137,16 @@ def swanson(filename="swanson2allen.npz"):
137137
138138def swanson_json (filename = "swansonpaths.json" ):
139139
140- OLD_MD5 = ['f848783954883c606ca390ceda9e37d2' ]
140+ OLD_MD5 = ['97ccca2b675b28ba9b15ca8af5ba4111' , # errored map with FOTU and CUL4, 5 mixed up
141+ '56daa7022b5e03080d8623814cda6f38' , # old md5 of swanson json without CENT and PTLp
142+ # and CUL4 split (on s3 called swansonpaths_56daa.json)
143+ 'f848783954883c606ca390ceda9e37d2' ]
141144
142145 json_file = AllenAtlas ._get_cache_dir ().joinpath (filename )
143146 if not json_file .exists () or md5 (json_file ) in OLD_MD5 :
144147 json_file .parent .mkdir (exist_ok = True , parents = True )
145148 _logger .info (f'downloading swanson paths from { aws .S3_BUCKET_IBL } s3 bucket...' )
146- aws .s3_download_file (f'atlas/{ json_file .name } ' , json_file )
149+ aws .s3_download_file (f'atlas/{ json_file .name } ' , json_file , overwrite = True )
147150
148151 with open (json_file ) as f :
149152 sw_json = json .load (f )
@@ -198,44 +201,45 @@ def plot_swanson_vector(acronyms=None, values=None, ax=None, hemisphere=None, br
198201 color = empty_color
199202
200203 coords = reg ['coordsReg' ]
204+ reg_id = reg ['thisID' ]
201205
202206 if reg ['hole' ]:
203207 vertices , codes = coords_for_poly_hole (coords )
204208 if orientation == 'portrait' :
205209 vertices [:, [0 , 1 ]] = vertices [:, [1 , 0 ]]
206- plot_polygon_with_hole (ax , vertices , codes , color , ** kwargs )
210+ plot_polygon_with_hole (ax , vertices , codes , color , reg_id , ** kwargs )
207211 if hemisphere is not None :
208212 color_inv = color if hemisphere == 'mirror' else empty_color
209213 vertices_inv = np .copy (vertices )
210214 vertices_inv [:, 0 ] = - 1 * vertices_inv [:, 0 ] + (sw .shape [0 ] * 2 )
211- plot_polygon_with_hole (ax , vertices_inv , codes , color_inv , ** kwargs )
215+ plot_polygon_with_hole (ax , vertices_inv , codes , color_inv , reg_id , ** kwargs )
212216 else :
213- plot_polygon_with_hole (ax , vertices , codes , color , ** kwargs )
217+ plot_polygon_with_hole (ax , vertices , codes , color , reg_id , ** kwargs )
214218 if hemisphere is not None :
215219 color_inv = color if hemisphere == 'mirror' else empty_color
216220 vertices_inv = np .copy (vertices )
217221 vertices_inv [:, 1 ] = - 1 * vertices_inv [:, 1 ] + (sw .shape [0 ] * 2 )
218- plot_polygon_with_hole (ax , vertices_inv , codes , color_inv , ** kwargs )
222+ plot_polygon_with_hole (ax , vertices_inv , codes , color_inv , reg_id , ** kwargs )
219223 else :
220224 coords = [coords ] if type (coords ) == dict else coords
221225 for c in coords :
222226
223227 if orientation == 'portrait' :
224228 xy = np .c_ [c ['y' ], c ['x' ]]
225- plot_polygon (ax , xy , color , ** kwargs )
229+ plot_polygon (ax , xy , color , reg_id , ** kwargs )
226230 if hemisphere is not None :
227231 color_inv = color if hemisphere == 'mirror' else empty_color
228232 xy_inv = np .copy (xy )
229233 xy_inv [:, 0 ] = - 1 * xy_inv [:, 0 ] + (sw .shape [0 ] * 2 )
230- plot_polygon (ax , xy_inv , color_inv , ** kwargs )
234+ plot_polygon (ax , xy_inv , color_inv , reg_id , ** kwargs )
231235 else :
232236 xy = np .c_ [c ['x' ], c ['y' ]]
233- plot_polygon (ax , xy , color , ** kwargs )
237+ plot_polygon (ax , xy , color , reg_id , ** kwargs )
234238 if hemisphere is not None :
235239 color_inv = color if hemisphere == 'mirror' else empty_color
236240 xy_inv = np .copy (xy )
237241 xy_inv [:, 1 ] = - 1 * xy_inv [:, 1 ] + (sw .shape [0 ] * 2 )
238- plot_polygon (ax , xy_inv , color_inv , ** kwargs )
242+ plot_polygon (ax , xy_inv , color_inv , reg_id , ** kwargs )
239243
240244 if orientation == 'portrait' :
241245 ax .set_ylim (0 , sw .shape [1 ])
0 commit comments