Python Forum
How to sort image files according to a metadata file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to sort image files according to a metadata file?
#1
I would like to sort image files with same tags into a specific folder.
(The HAM 10000 dataset, https://dataverse.harvard.edu/dataset.xh...DVN/DBW86T)

A metadata file (HAM10000_metadata.csv) was made like this;

lesion_id image_id dx dx_type age sex localization
HAM_0000550 ISIC_0024306 nv follow_up 45 male trunk
HAM_0003577 ISIC_0024307 nv follow_up 50 male lower extremity
HAM_0001477 ISIC_0024308 nv follow_up 55 female trunk
HAM_0000484 ISIC_0024309 nv follow_up 40 male trunk
HAM_0003350 ISIC_0024310 mel histo 60 male chest
HAM_0000981 ISIC_0024311 nv follow_up 75 female back
HAM_0001359 ISIC_0024312 bkl histo 75 male lower extremity
HAM_0002869 ISIC_0024313 mel histo 50 female back
HAM_0002198 ISIC_0024314 nv histo 75 male lower extremity
.
.
. so on

And, all image files were named after image_id (ISIC_XXXXXXX.jpeg).
What I want is to sort these image files (ISIC_XXXXXXX.jpeg) according to the variable, "dx" (nv, mel, bkl,...) ! In a metadata file (HAM10000_metadata.csv), there are seven different values of "dx" (akiec, bcc, bk1, mel, df, vasc, nv).
Therefore, I want to put these 10,000 image files with a same value of "dx" into 7 different folders according to the metadata file which contains the macthed value of "dx" of every image file.

How can I make a script?
(all files are located at c:\ and I would like make new seven folders with same name of "dx")

Thank you for your help!!
Reply


Messages In This Thread
How to sort image files according to a metadata file? - by Brahmslove - Dec-05-2019, 12:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error "cannot identify image file" part way through running hatflyer 0 663 Nov-02-2023, 11:45 PM
Last Post: hatflyer
Question image manipulation (cropping and MetaData) SpongeB0B 4 1,152 Jul-03-2023, 06:35 PM
Last Post: SpongeB0B
  is it possible to copy image from email and place into excel file? cubangt 3 1,259 Nov-30-2022, 05:11 PM
Last Post: snippsat
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 718 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy
  How to sort .csv file test log which item first fail and paint color SamLiu 24 4,835 Sep-03-2022, 07:32 AM
Last Post: Pedroski55
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,309 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  AttributeError: 'function' object has no attribute 'metadata 3lnyn0 5 4,595 Mar-28-2022, 04:42 PM
Last Post: Larz60+
  How to open/load image .tiff files > 2 GB ? hobbyist 1 2,442 Aug-19-2021, 12:50 AM
Last Post: Larz60+
  Sort data from JSON file Dummy_in_programming 2 2,435 Jan-04-2021, 06:17 PM
Last Post: deanhystad
  Count & Sort occurrences of text in a file oradba4u 7 3,064 Sep-06-2020, 03:23 PM
Last Post: oradba4u

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020