joint_registration_tumor_segmentation icon indicating copy to clipboard operation
joint_registration_tumor_segmentation copied to clipboard

moudle error

Open cy-yong opened this issue 3 years ago • 23 comments

image

cy-yong avatar Dec 06 '21 03:12 cy-yong

Hello, Thanks for your interest to my code. To launch it, you need to be in the parent folder and launch with python -m

For instance :

cd /home/home_folder/
git clone https://github.com/TheoEst/joint_registration_tumor_segmentation.git
python -m joint_registration_tumor_segmentation.main 

TheoEst avatar Dec 08 '21 13:12 TheoEst

您好, 感谢您对我的代码的兴趣。要启动它,您需要在父文件夹中并使用python -m

例如:

cd /home/home_folder/
git clone https://github.com/TheoEst/joint_registration_tumor_segmentation.git
python -m joint_registration_tumor_segmentation.main 

I have solved this problem. Unfortunately, I have encountered a new problem. The ". NPY" file is not in the original data. Has your data been preprocessed, and the "-" only brats "on the command line does not seem to be an argument. image

cy-yong avatar Dec 09 '21 01:12 cy-yong

Hello, The data is not provided in the GitHub. You need to download both BraTS 2018 and OASIS3 before running the code. You can find the datasets on the following link : https://www.oasis-brains.org/ and https://www.med.upenn.edu/sbia/brats2018/data.html

TheoEst avatar Dec 12 '21 10:12 TheoEst

您好, GitHub中没有提供数据。 在运行代码之前,您需要下载 BraTS 2018 和 OASIS3。 您可以在以下链接中找到数据集:https : //www.oasis-brains.org/和https://www.med.upenn.edu/sbia/brats2018/data.html I have downloaded this original data set from the official website,Unfortunately, the original data does not contain files in ". NPY" format. I want to know whether this is the preprocessed file format or the original one,thank you very much.

cy-yong avatar Dec 16 '21 11:12 cy-yong

During my work, I save all the BraTS dataset into a numpy array. There is no preprocessing, I just load the nii.gz files and save them as .npy. You have two solutions :

  • You can change the code to directly load .nii.gz
  • Save all the files in .npy as I did.

To export them to .npy, you can use this code :

cohorts = ['HGG', 'LGG']
modalities = ['_flair.nii.gz', '_t1.nii.gz', '_t1ce.nii.gz', '_t2.nii.gz']

for cohort in cohorts:
        cohort_path = main_path+ cohort + '/'
        patients = [file for file in os.listdir(cohort_path) if
                    os.path.isdir(cohort_path + file)]

    for patient in tqdm(patients):
            patient_path = path + patient + '/'

            modalities_array = []

            for modalitie in modalities:

                file = patient_path + patient + modalitie
                image = sitk.ReadImage(file)
                array = sitk.GetArrayFromImage(image)
                modalities_array.append(array)

           array = np.stack(modalities_array)
           np.save(save_path + '/' + cohort + '/' + patient, array)

TheoEst avatar Dec 18 '21 16:12 TheoEst

During my work, I save all the BraTS dataset into a numpy array. There is no preprocessing, I just load the nii.gz files and save them as .npy. You have two solutions :

  • You can change the code to directly load .nii.gz
  • Save all the files in .npy as I did.

To export them to .npy, you can use this code :

cohorts = ['HGG', 'LGG']
modalities = ['_flair.nii.gz', '_t1.nii.gz', '_t1ce.nii.gz', '_t2.nii.gz']

for cohort in cohorts:
        cohort_path = main_path+ cohort + '/'
        patients = [file for file in os.listdir(cohort_path) if
                    os.path.isdir(cohort_path + file)]

    for patient in tqdm(patients):
            patient_path = path + patient + '/'

            modalities_array = []

            for modalitie in modalities:

                file = patient_path + patient + modalitie
                image = sitk.ReadImage(file)
                array = sitk.GetArrayFromImage(image)
                modalities_array.append(array)

           array = np.stack(modalities_array)
           np.save(save_path + '/' + cohort + '/' + patient, array)

image Sorry to bother you, I have another problem when I use it The following error occurred while NPY file format.

cy-yong avatar Dec 23 '21 11:12 cy-yong

What did you do ? I don't understand, how the problem occurs

TheoEst avatar Jan 09 '22 15:01 TheoEst

What did you do ? I don't understand, how the problem occurs

This problem happened because I generated it according to your way The NPY file cannot be recognized. I don't know if it is a process error in generating the file.

cy-yong avatar Jan 10 '22 01:01 cy-yong

Normaly, if you do the training with brats file, you should open image with the following line : https://github.com/TheoEst/joint_registration_tumor_segmentation/blob/62b4b25f3c3285a016861e74f3708aca5511f796/Dataset.py#L307

And the function np.load can load .npy files without problem.

TheoEst avatar Jan 10 '22 08:01 TheoEst

Normaly, if you do the training with brats file, you should open image with the following line :

https://github.com/TheoEst/joint_registration_tumor_segmentation/blob/62b4b25f3c3285a016861e74f3708aca5511f796/Dataset.py#L307

And the function can load files without problem.np.load``.npy

I found that my problem was generated There is an error in the NPY file. I want to know whether the code you replied to me needs to be run independently or added to a Py file to run.

cy-yong avatar Jan 10 '22 08:01 cy-yong

You need to put in a py file and run it independently.

TheoEst avatar Jan 10 '22 15:01 TheoEst

您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code

cy-yong avatar Apr 04 '22 11:04 cy-yong

image image image Dear author, how can I solve this problem?

HilbertMaximov avatar Jun 22 '22 07:06 HilbertMaximov

您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code

image image image Hi! How did you solve this problem?

HilbertMaximov avatar Jun 22 '22 07:06 HilbertMaximov

您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code

image image image Hi! How did you solve this problem?

I can not solve this problem

cy-yong avatar Jun 22 '22 08:06 cy-yong

您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code

image image image Hi! How did you solve this problem?

I can not solve this problem

do you meet the problem 'DataGenerator' object has no attribute 'only_close_tumor'? Is this a question about the version?

HilbertMaximov avatar Jun 22 '22 08:06 HilbertMaximov

我认为那不是版本问题,应该是代码本身问题吧

------------------ 原始邮件 ------------------ 发件人: "TheoEst/joint_registration_tumor_segmentation" @.>; 发送时间: 2022年6月22日(星期三) 下午4:06 @.>; @.@.>; 主题: Re: [TheoEst/joint_registration_tumor_segmentation] moudle error (Issue #2)

您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code

Hi! How did you solve this problem?

I can not solve this problem

do you meet the problem 'DataGenerator' object has no attribute 'only_close_tumor'? Is this a question about the version?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

cy-yong avatar Jun 22 '22 08:06 cy-yong

我认为那不是版本问题,应该是代码本身问题吧 ------------------ 原始邮件 ------------------ 发件人: "TheoEst/joint_registration_tumor_segmentation" @.>; 发送时间: 2022年6月22日(星期三) 下午4:06 @.>; @.@.>; 主题: Re: [TheoEst/joint_registration_tumor_segmentation] moudle error (Issue #2) 您需要放入py文件并独立运行它。 Senior, I think some of the errors may be caused by version problems. Can you provide keras and tensorflow versions of the source code Hi! How did you solve this problem? I can not solve this problem do you meet the problem 'DataGenerator' object has no attribute 'only_close_tumor'? Is this a question about the version? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

我现在在做配准分割这类的一些东西,能加你个联系方式吗?qq vx啥的

HilbertMaximov avatar Jun 22 '22 08:06 HilbertMaximov

Hello, Indeed there is a problem in the code. I will correct it soon best regards

TheoEst avatar Jun 22 '22 08:06 TheoEst

Hello, Indeed there is a problem in the code. I will correct it soon best regards

thank you

cy-yong avatar Jun 22 '22 08:06 cy-yong

Hello, Indeed there is a problem in the code. I will correct it soon best regards

thank you very much

HilbertMaximov avatar Jun 22 '22 08:06 HilbertMaximov

Fix in 2cefdeb1e00c8516bb1382697dd11ccb73cdbdb1

TheoEst avatar Jun 22 '22 08:06 TheoEst

Fix in 2cefdeb image image Dear author, how should I use l2 loss here?

HilbertMaximov avatar Jun 22 '22 09:06 HilbertMaximov