PolusAI / nyxus

A fully scalable robust image feature extraction library.
MIT License
19 stars 8 forks source link

zero-background Error for mask image #220

Closed hamshkhawar closed 2 months ago

hamshkhawar commented 3 months ago

I am facing issue of zero-background Error when using featurize_directory function of nyxus. I am treating a each image as a single roi and extracting features. This is the following error I am getting for images

File ~/miniconda3/envs/myenv/lib/python3.10/site-packages/nyxus/nyxus.py:288, in Nyxus.featurize_directory(self, intensity_dir, label_dir, file_pattern, output_type, output_path) 284 return df 286 else: --> 288 featurize_directory_imp(intensity_dir, label_dir, file_pattern, output_type, output_path) 290 return get_arrow_file_imp()

RuntimeError: Error: mask image /projects/PanMicroscopy/data/recursionpharma/omeconverted/rxrx19b/HUVEC-1/Plate18/AA24_s1_w1.ome.tif contains no zero-background

Here below is the sample code which is tested

`intensity_dir = Path('/projects/PanMicroscopy/data/recursionpharma/omeconverted/rxrx19b/HUVEC-1/Plate18/') out_name = Path('test.arrow') file_pattern = 'AA24_s1_w1.ome.tif' out_dir = Path('/home/abbasih2/PANMicroscopy_scripts/RxRx/')

def nyxfun(intensity_dir, file_pattern, outname, out_dir):

out_name= Path(out_dir, outname)

nyx = Nyxus(["*ALL*"])

nyx_params = {
    "neighbor_distance": 5,
    "pixels_per_micron": 1.0,
    "n_feature_calc_threads": 4,
    "using_gpu" : 1
}

nyx.set_params(**nyx_params)

nyx.featurize_directory(intensity_dir=str(intensity_dir), 
                        label_dir=None,
                        file_pattern=file_pattern,
                        output_type = "arrowipc",
                        output_path = str(out_name)
                        )

nyxfun(intensity_dir, file_pattern, out_name, out_dir)`

[Uploading Plate18.zip…]()

friskluft commented 3 months ago

Thanks for this bug report Hamdah! It will be fixed.

sameeul commented 2 months ago

Fixed in v0.8.1