BodenmillerGroup / ImcSegmentationPipeline

A pixel classification based multiplexed image segmentation pipeline
https://bodenmillergroup.github.io/ImcSegmentationPipeline/
MIT License
86 stars 36 forks source link

Error with load zip file #39

Closed hfl112 closed 4 years ago

hfl112 commented 4 years ago

I can't load the zip file (each zip have a mcd file, not txt files) successfully.

The error I encountered was:
ERROR:root:Error in /Users/fhe/Downloads/seg_test/zip/1.mcd.zip
Traceback (most recent call last):
  File "<timed exec>", line 12, in <module>
  File "/Users/f/opt/anaconda3/lib/python3.7/site-packages/imctools/scripts/convertfolder2imcfolder.py", line 45, in convert_folder2imcfolder
    assert len(mcd_files) == 1
AssertionError
ERROR:root:Error in /Users/fhe/Downloads/seg_test/zip/2.mcd.zip
Traceback (most recent call last):
  File "<timed exec>", line 12, in <module>
  File "/Users/f/opt/anaconda3/lib/python3.7/site-packages/imctools/scripts/convertfolder2imcfolder.py", line 45, in convert_folder2imcfolder
    assert len(mcd_files) == 1
AssertionError

Any advices might be appreciated, Thank you

votti commented 4 years ago

Hi hfl112, I am pretty sure this is due the MacOS behaviour to include hidden .[something].mcd files into the Zip archive. I pushed again to get this resolved in imctools (https://github.com/BodenmillerGroup/imctools/issues/43). Two solutions: 1) try another way to zip, or manually delete the hidden .mcd file from your zip archive 2) Actually it is also possible to have unzipped folders with 1 .mcd file each. In this case one would need to change the 'file_regexp = '.*.zip'' to something that recognizes the folder name. E.g. if you make your folder names end in _mcdac, you could change this to: 'file_regexp = '.*_mcdac''

Again also for 2) one needs to make sure that no hidden .mcd files are around.

Let me know if this helps!

hfl112 commented 4 years ago

Hi hfl112, I am pretty sure this is due the MacOS behaviour to include hidden .[something].mcd files into the Zip archive. I pushed again to get this resolved in imctools (BodenmillerGroup/imctools#43). Two solutions:

  1. try another way to zip, or manually delete the hidden .mcd file from your zip archive
  2. Actually it is also possible to have unzipped folders with 1 .mcd file each. In this case one would need to change the 'fileregexp = '..zip'' to something that recognizes the folder name. E.g. if you make your folder names end in _mcdac, you could change this to: 'file_regexp = '.__mcdac''

Again also for 2) one needs to make sure that no hidden .mcd files are around.

Let me know if this helps!

Hi votti, It indeed related to the MacOS zip file with corresponding MACOSX file folder. I just used "zip -d xxx.zip "MACOSX*" to delete all the files redundant, it worked. Thank you for the help,
hfl