@@ -525,13 +525,26 @@ def term_info_parse_object(results, short_form):
525525 images = {}
526526 image = vfbTerm .template_channel
527527 record = {}
528- record ["id" ] = vfbTerm .template_channel .channel .short_form
528+
529+ # Validate that the channel ID matches the template ID (numeric part should be the same)
530+ template_id = vfbTerm .term .core .short_form
531+ channel_id = vfbTerm .template_channel .channel .short_form
532+
533+ # Extract numeric parts for validation
534+ if template_id and channel_id :
535+ template_numeric = template_id .replace ("VFB_" , "" ) if template_id .startswith ("VFB_" ) else ""
536+ channel_numeric = channel_id .replace ("VFBc_" , "" ) if channel_id .startswith ("VFBc_" ) else ""
537+
538+ if template_numeric != channel_numeric :
539+ print (f"Warning: Template ID { template_id } does not match channel ID { channel_id } " )
540+
541+ record ["id" ] = template_id
529542 label = vfbTerm .template_channel .channel .label
530543 if vfbTerm .template_channel .channel .symbol != "" and len (vfbTerm .template_channel .channel .symbol ) > 0 :
531544 label = vfbTerm .template_channel .channel .symbol
532545 record ["label" ] = label
533- if not vfbTerm . template_channel . channel . short_form in images .keys ():
534- images [vfbTerm . template_channel . channel . short_form ]= []
546+ if not template_id in images .keys ():
547+ images [template_id ]= []
535548 record ["thumbnail" ] = image .image_thumbnail .replace ("http://" ,"https://" ).replace ("thumbnailT.png" ,"thumbnail.png" )
536549 record ["thumbnail_transparent" ] = image .image_thumbnail .replace ("http://" ,"https://" ).replace ("thumbnail.png" ,"thumbnailT.png" )
537550 for key in vars (image ).keys ():
@@ -549,7 +562,7 @@ def term_info_parse_object(results, short_form):
549562 record ['voxel' ] = image .get_voxel ()
550563 if 'orientation' in image_vars .keys ():
551564 record ['orientation' ] = image .orientation
552- images [vfbTerm . template_channel . channel . short_form ].append (record )
565+ images [template_id ].append (record )
553566
554567 # Add the thumbnails to the term info
555568 termInfo ["Images" ] = images
0 commit comments