Nati,
This is a two-way process and requires you to be very clear on what is not 
working or what you are trying to do or help clear away having us try to 
understand lots of code that is not very related to the question.
Your code, as shown, makes an empty string repeatedly in a loop. 
a=dict()
I am guessing the code there works fine and does nothing useful. Well, what do 
you want in your dictionary? Most people create a dictionary outside the loop 
as an empty dictionary and then in the loop use one of many methods to add 
key:value pairs.
Earlier in the code you had another line:
a=labels.to_dict()

If the labels variable had a method like that, that is also a way.
So be specific about what LINE or region of code and what is wrong and what you 
already tried or error messages you got.
Avi


-----Original Message-----
From: נתי שטרן <nsh...@gmail.com>
To: Neuroimaging analysis in Python <neuroimag...@python.org>; 
python-list@python.org
Sent: Wed, Jul 13, 2022 2:35 pm
Subject: Re: what's the problem??????

I want to set dict

בתאריך יום ד׳, 13 ביולי 2022, 20:47, מאת נתי שטרן ‏<nsh...@gmail.com>:

> CODE:
>
> for nii in os.listdir("c:/users/administrator/desktop/nii"):
>
>    from nilearn import plotting
>    from nilearn import datasets
>    atlas = datasets.fetch_atlas_msdl()
>    # Loading atlas image stored in 'maps'
>    atlas_filename =
> "C:/Users/Administrator/Desktop/64/64/2mm/maps.nii.gz"
>    # Loading atlas data stored in 'labels'
>    labels = pd.read_csv(
> "C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
>    a=labels.to_dict()
>    b=a["Difumo_names"]
>    from nilearn.maskers import NiftiMapsMasker
>    masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
>                            memory='nilearn_cache', verbose=5)
>
>    time_series = masker.fit_transform(
> "c:/users/administrator/desktop/nii/"+nii)
>    try:
>        from sklearn.covariance import GraphicalLassoCV
>    except ImportError:
>        # for Scitkit-Learn < v0.20.0
>        from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
>
>    estimator = GraphicalLassoCV()
>    estimator.fit(time_series)
> # Display the covariancec
>    aas={}
>    jsa=0
>    for i in estimator.covariance_:
>        r=list(a["Difumo_names"].values())[jsa]
>        jsa=jsa+1
>        a=dict()
>
>
>        for x in range(64):
>            g=list(a["Difumo_names"].values())[x]
>
>    print(aas)
>    t=  nilearn.plotting.plot_img(estimator.covariance_, labels=list(a[
> "Difumo_names"].values()),
>                        figure=(9, 7), vmax=1, vmin=-1,
>                        title='Covariance')# The covariance can be found
> at estimator.covariance_
>
> # The covariance can be found at estimator.covariance_
>    t2=  nilearn.plotting.plot_matrix(estimator.covariance_, labels=list(a
> ["Difumo_names"].values()),
>                        figure=(9, 7), vmax=1, vmin=-1,
>                        title='Covariance')
>
>
>
> --
> <https://netanel.ml>
>
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to