Package: imagetocsv
About•Install•Terminal•Python•LicenseAboutConverts an Image to a CSV. This exists because Chorus 3.0 is bat-shit and only shows images for vital metadata.PrerequisitesAnacondaI am partial towardsminiforge, but you can replace these commands with your favorite conda distribution.Windows Miniforge InstallationSpecial walkthrough for Windows users since Windows is awful.curl-Ohttps://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe
start/wait""Miniforge3-Windows-x86_64.exe/InstallationType=JustMe/RegisterPython=0/S/D=%UserProfile%\Miniforge3# Follow the prompts.BugsLinux using Python 3.7Conda does not install all needed packages for Python 3.7 so you need to install the following to get ImageToCSV to work properly.sudoaptinstall--yesbuild-essentiallibpoppler-cpp-devpkg-configtesseract-ocrlibtesseract-devInstallationcondacreate-nimagetocsv-fenvironment.yml
condaactivateimagetocsv
pipinstallimagetocsvDevelopmentConda environmentcondacreate-nimagetocsv-fenvironment.yml
condaactivateimagetocsv
pipinstall-e".[dev]"TestingcdImageToCSV
pytest-svvvtestsPreconfiguring Index/Column NamesIf you have a lot of images to convert, you can preconfigure the index and column names to save time in the hardcoded_options.py filehere. Each option will need a format ofdict[str, tuple[str, list[str], list[str]]]aka slug -> (name, indexes, columns).imagetocsv-pmyslugmyimage.pngUsageTerminal Help Message[CSV_PATH] means that it is a stdout (printed on the terminal) if output is not specified.Usage:imagetocsv[OPTIONS]IMAGE_PATH[CSV_PATH]Consolescriptforimagetocsv.

Options:--versionShowtheversionandexit.-v,--verboseVebositylevel,ex.-vvvvvfordebuglevellogging-n,--index_nameTEXTIndexNamefortheCSVfile-i,--indexTEXTIndexfortheCSVfile-c,--column_headerTEXTColumnsfortheCSVfile-p,--preconfigured-optionsTEXT--helpShowthismessageandexit.Terminal# Convert an image to a CSVimagetocsvmyimage.pngoutput.csv# Convert an image to a stdout (printed on the terminal) TSVimagetocsvmyimage.png01234560598150100.00%123428.5057.53%130689.0050.55%123798739.79%39.79%134356.0014.45%102556.0030.89%222800095.80%38.12%433804.0013.96%100917.0029.64%322245397.57%37.19%133307.0013.63%100091.0029.09%421247495.51%35.52%134238.0012.97%9700.0029.27%55588526.30%9.34%131386.0013.34%93086.0027.69%63474556.80%5.31%127549.0010.25%88501.0024.60%72249640.25%3.76%1415245015.79%102606.0030.31%81740977.39%2.91%144624.0014.88%107966.0028.93%9266315.30%0.45%163750.0011.93%130908.0026.18%1050.03%0.00%166073.005.07%160211.006.57%111473684.65%2.46%1412645014.20%103995.0028.13%1250.03%0.00%162803.006.04%156540.009.02%1300.00%0.00%14888839.51%1.49%431473.0015.37%90965.5028.65%1518068.03%0.30%153347.0012.19%121119.5024.60%16489621.76%0.82%141244.0016.41%101527.0030.63%17690630.70%1.15%147753.0012.13%113108.5025.94%# Used for Chorus 3.0 to auto header and index names.imagetocsv-pchorusmyimage.pngPopulationEvents% Parent% TotalFSC-A MedianFSC-A %rCVSSC-A MedianSSC-A %rCVAll Events598,150100.00%123428.5057.53%130689.0050.55%Lymphocytes237,98739.79%39.79%134356.0014.45%102556.0030.89%Single cells...228,00095.80%38.12%433804.0013.96%100917.0029.64%Single cells...222,45397.57%37.19%133307.0013.63%100091.0029.09%Live/Dead212,47495.51%35.52%134238.0012.97%9700.0029.27%CD19+ Dump-55,88526.30%9.34%131386.0013.34%93086.0027.69%Naive gD+34,74556.80%5.31%127549.0010.25%88501.0024.60%Memory IgD-22,49640.25%3.76%1415245015.79%102606.0030.31%IgD- KO-17,40977.39%2.91%144624.0014.88%107966.0028.93%P15-12,66315.30%0.45%163750.0011.93%130908.0026.18%P15-250.03%0.00%166073.005.07%160211.006.57%P15-314,73684.65%2.46%1412645014.20%103995.0028.13%P15-450.03%0.00%162803.006.04%156540.009.02%MARIO WT++00.00%0.00%P14-18,88839.51%1.49%431473.0015.37%90965.5028.65%P14-21,8068.03%0.30%153347.0012.19%121119.5024.60%P14-3489621.76%0.82%141244.0016.41%101527.0030.63%P14-46,90630.70%1.15%147753.0012.13%113108.5025.94%Terminal AdvancedAdding Index Name, Index, and Column Header. They need to match the deminsions of the matrix! This may be more trouble than its worth so, this is just to show you can do it. No pressure.imagetocsvmyimage.jpg\--index_name"Population"\--index"All Events,Lymphocytes,Single cells...,Single cells...,Live/Dead,CD19+ Dump-,Naive gD+,Memory IgD-,IgD- KO-,P15-1,P15-2,P15-3,P15-4,MARIO WT++,P14-1,P14-2,P14-3,P14-4"\--column_header"Events,%Parent,%Total,FSC-A Median,FSC-A %rCV,SSC-A Median,SSC-A %rCV"PopulationEvents% Parent% TotalFSC-A MedianFSC-A %rCVSSC-A MedianSSC-A %rCVAll Events598,150100.00%123428.5057.53%130689.0050.55%Lymphocytes237,98739.79%39.79%134356.0014.45%102556.0030.89%Single cells...228,00095.80%38.12%433804.0013.96%100917.0029.64%Single cells...222,45397.57%37.19%133307.0013.63%100091.0029.09%Live/Dead212,47495.51%35.52%134238.0012.97%9700.0029.27%CD19+ Dump-55,88526.30%9.34%131386.0013.34%93086.0027.69%Naive gD+34,74556.80%5.31%127549.0010.25%88501.0024.60%Memory IgD-22,49640.25%3.76%1415245015.79%102606.0030.31%IgD- KO-17,40977.39%2.91%144624.0014.88%107966.0028.93%P15-12,66315.30%0.45%163750.0011.93%130908.0026.18%P15-250.03%0.00%166073.005.07%160211.006.57%P15-314,73684.65%2.46%1412645014.20%103995.0028.13%P15-450.03%0.00%162803.006.04%156540.009.02%MARIO WT++00.00%0.00%P14-18,88839.51%1.49%431473.0015.37%90965.5028.65%P14-21,8068.03%0.30%153347.0012.19%121119.5024.60%P14-3489621.76%0.82%141244.0016.41%101527.0030.63%P14-46,90630.70%1.15%147753.0012.13%113108.5025.94%Pythonfromimagetocsvimportimagetocsvfromimagetocsv.examplesimportno_grid_exampledf=imagetocsv(no_grid_example)print(df.to_markdown())01234560598150100.00%123428.5057.53%130689.0050.55%123798739.79%39.79%134356.0014.45%102556.0030.89%222800095.80%38.12%433804.0013.96%100917.0029.64%322245397.57%37.19%133307.0013.63%100091.0029.09%421247495.51%35.52%134238.0012.97%9700.0029.27%55588526.30%9.34%131386.0013.34%93086.0027.69%63474556.80%5.31%127549.0010.25%88501.0024.60%72249640.25%3.76%1415245015.79%102606.0030.31%81740977.39%2.91%144624.0014.88%107966.0028.93%9266315.30%0.45%163750.0011.93%130908.0026.18%1050.03%0.00%166073.005.07%160211.006.57%111473684.65%2.46%1412645014.20%103995.0028.13%1250.03%0.00%162803.006.04%156540.009.02%1300.00%0.00%14888839.51%1.49%431473.0015.37%90965.5028.65%1518068.03%0.30%153347.0012.19%121119.5024.60%16489621.76%0.82%141244.0016.41%101527.0030.63%17690630.70%1.15%147753.0012.13%113108.5025.94%Python Advancedfromimagetocsvimportimagetocsvfromimagetocsv.examplesimportno_grid_exampledf=imagetocsv(no_grid_example,index_name="Population",index=["All Events","Lymphocytes","Single cells...","Single cells...","Live/Dead","CD19+ Dump-","Naive gD+","Memory IgD-","IgD- KO-","P15-1","P15-2","P15-3","P15-4","MARIO WT++","P14-1","P14-2","P14-3","P14-4",],column_header=["Events","% Parent","% Total","FSC-A Median","FSC-A%rCV","SSC-A Median","SSC-A%rCV"],)print(df.to_markdown())PopulationEvents% Parent% TotalFSC-A MedianFSC-A %rCVSSC-A MedianSSC-A %rCVAll Events598,150100.00%123428.5057.53%130689.0050.55%Lymphocytes237,98739.79%39.79%134356.0014.45%102556.0030.89%Single cells...228,00095.80%38.12%433804.0013.96%100917.0029.64%Single cells...222,45397.57%37.19%133307.0013.63%100091.0029.09%Live/Dead212,47495.51%35.52%134238.0012.97%9700.0029.27%CD19+ Dump-55,88526.30%9.34%131386.0013.34%93086.0027.69%Naive gD+34,74556.80%5.31%127549.0010.25%88501.0024.60%Memory IgD-22,49640.25%3.76%1415245015.79%102606.0030.31%IgD- KO-17,40977.39%2.91%144624.0014.88%107966.0028.93%P15-12,66315.30%0.45%163750.0011.93%130908.0026.18%P15-250.03%0.00%166073.005.07%160211.006.57%P15-314,73684.65%2.46%1412645014.20%103995.0028.13%P15-450.03%0.00%162803.006.04%156540.009.02%MARIO WT++00.00%0.00%P14-18,88839.51%1.49%431473.0015.37%90965.5028.65%P14-21,8068.03%0.30%153347.0012.19%121119.5024.60%P14-3489621.76%0.82%141244.0016.41%101527.0030.63%P14-46,90630.70%1.15%147753.0012.13%113108.5025.94%LicenseCopyright © Troy M. Sincomb