jlevy44 / PathFlow-MixMatch

Don't mix, match! Simple utilities for improved registration of Histopathology Whole Slide Images.
10 stars 6 forks source link

n_components=4 must be between 0 and min(n_samples, n_features)=2 with svd_solver='full' #23

Closed gmh1033286494 closed 3 years ago

gmh1033286494 commented 3 years ago

Hi, I am trying to do image registration with the dapi channel of mIHC. I extract the dapi channel from its original format mrxs into tiff and then I used openslide.read_region to convert it into a png. Finally I put them into mixmatch. And I got this error. Its size is (10496, 15616)

Here is my code pathflow-mixmatch register_images --im1 test724.png --im2 test824.png --fix_rotation False --output_dir output_registered_images/ --gpu_device -1 --transform_type similarity --lr 0.1 --iterations 100 --min_object_size 500 --black_background=True

Error message: Loading images. Locating Sections. Estimating section properties. Matching tissue sections. Traceback (most recent call last): File "/home/chixing/anaconda3/bin/pathflow-mixmatch", line 8, in sys.exit(main()) File "/home/chixing/anaconda3/lib/python3.8/site-packages/pathflow_mixmatch/cli.py", line 577, in main fire.Fire(Commands) File "/home/chixing/.local/lib/python3.8/site-packages/fire/core.py", line 138, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/chixing/.local/lib/python3.8/site-packages/fire/core.py", line 463, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/home/chixing/.local/lib/python3.8/site-packages/fire/core.py", line 672, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/home/chixing/anaconda3/lib/python3.8/site-packages/pathflow_mixmatch/cli.py", line 549, in register_images registerimages(im1_fname=im1, File "/home/chixing/anaconda3/lib/python3.8/site-packages/pathflow_mixmatch/cli.py", line 413, in registerimages sections=list(get_matched_tissue(props,props2)) File "/home/chixing/anaconda3/lib/python3.8/site-packages/pathflow_mixmatch/cli.py", line 61, in get_matched_tissue x=PCA(n_components=4,random_state=42).fit_transform(pd.concat((props,props2)))#n_components=2 StandardScaler().fit_transform() File "/home/chixing/.local/lib/python3.8/site-packages/sklearn/decomposition/_pca.py", line 376, in fit_transform U, S, V = self._fit(X) File "/home/chixing/.local/lib/python3.8/site-packages/sklearn/decomposition/_pca.py", line 423, in _fit return self._fit_full(X, n_components) File "/home/chixing/.local/lib/python3.8/site-packages/sklearn/decomposition/_pca.py", line 439, in _fit_full raise ValueError("n_components=%r must be between 0 and " ValueError: n_components=4 must be between 0 and min(n_samples, n_features)=2 with svd_solver='full'

Thank you.

gmh1033286494 commented 3 years ago

I got it. I added --no_segment_analysis True and it worked