H-DenseUNet icon indicating copy to clipboard operation
H-DenseUNet copied to clipboard

Could you please update the code you use about generating livermask?

Open shenhai1895 opened this issue 5 years ago • 23 comments

hello, i wish to test your code on some new CT, but i do not find the code about generating the "livermask". could you update it in this repo?

shenhai1895 avatar Jul 08 '19 07:07 shenhai1895

The liver mask is only used for speeding up the test procedure. In case you try on the new CT, I suggest you do not use liver mask.

xmengli avatar Jul 08 '19 07:07 xmengli

thank you very much. in other words, the model only predict the segmentation in the area of the liver provided by livermask. is it right?

shenhai1895 avatar Jul 08 '19 07:07 shenhai1895

Since the liver ct scans have very large number of slices, e.g., 512512800. So, test one image is very costly. The usage of liver mask can help narrow the test range to 512512300, for example. We can avoid test on useless slices.

xmengli avatar Jul 08 '19 08:07 xmengli

how do you test on new CT without loading liver mask?

mnc1423 avatar Jul 10 '19 08:07 mnc1423

Yes.

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: mnc1423 [email protected] 发送时间: Wednesday, July 10, 2019 4:19:21 PM 收件人: xmengli999/H-DenseUNet 抄送: shenhai1895; Author 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

how do you test on new CT without loading liver mask?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24IAD4OI46TXMQTAVC3P6WLQTA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZSWIMY#issuecomment-509961267, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24N6HKODY7O5EJN5PEDP6WLQTANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 10 '19 08:07 shenhai1895

how? since test.py won't work. You wrote a new code?

mnc1423 avatar Jul 10 '19 08:07 mnc1423

Just comment the "liver mask loading" part.

xmengli avatar Jul 10 '19 08:07 xmengli

Thanks for the help! :)

mnc1423 avatar Jul 10 '19 08:07 mnc1423

commenting " mask, mask_header = load(args.liver_path + str(id) + '-ori.nii') " seems to result in UnboundLocalError: local variable 'mask' referenced before assignment should set mask to [2]?

mnc1423 avatar Jul 11 '19 01:07 mnc1423

Cant seem to get it to work QQ. can i load a blank liver mask? commenting seems to yield in more errors any guild lines would help Thank you in advance

mnc1423 avatar Jul 24 '19 06:07 mnc1423

In fact, the liver mask is not nessasary. You should debug the code step by step and remove or modify the code about liver mask.

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: mnc1423 [email protected] 发送时间: Wednesday, July 24, 2019 2:38:17 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

Cant seem to get it to work QQ. can i load a blank liver mask? commenting seems to yield in more errors any guild lines would help Thank you in advance

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24MBH2X2F7EH574CMETQA72FTA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2VKUUY#issuecomment-514501203, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24PCSOIDIXW2BYA5M6DQA72FTANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 27 '19 02:07 shenhai1895

i changed the mini and maxi in the code to fit the size of the CT volumes so mini should be (0 0 0) maxi should be size of the CT shape -1 on Z (x,y,z) seems to run out of resources.. running on titan Xp QQ

mnc1423 avatar Jul 27 '19 06:07 mnc1423

In the file func.py, I do like this: [cid:[email protected]]

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: mnc1423 [email protected] 发送时间: Saturday, July 27, 2019 2:09:40 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

i changed the mini and maxi in the code to fit the size of the CT volumes so mini should be (0 0 0) maxi should be size of the CT shape -1 on Z (x,y,z) seems to run out of resources.. running on titan Xp QQ

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24MYITM4IMHJF64WZKTQBPRCJA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26ERXY#issuecomment-515655903, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24ITJFMY4RPAYB7E7I3QBPRCJANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 28 '19 08:07 shenhai1895

Can't See the .png file

mnc1423 avatar Jul 28 '19 09:07 mnc1423

x = imgs_test.shape[0] y = imgs_test.shape[1] z = imgs_test.shape[2]

right_cols = int(min(z, maxi[2] + 10) - img_cols)

left_cols = max(0, min(mini[2] - 5, right_cols))

right_cols = int(z - img_cols) left_cols = 0 score = np.zeros((x, y, z, num), dtype='float32') score_num = np.zeros((x, y, z, num), dtype='int16')

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: mnc1423 [email protected] 发送时间: Sunday, July 28, 2019 5:32:22 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

Can't See the .png file

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24J5KZA43ZB5HGNYYTDQBVRSNA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD263AJI#issuecomment-515747877, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24PQXZ2KTBKZCUDGZ3DQBVRSNANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 28 '19 09:07 shenhai1895

Thank you for the help! Can i ask what GPU you're using?

mnc1423 avatar Jul 28 '19 09:07 mnc1423

2080Ti*2. You can run the model on two gpus, and the OOM will be solved. 发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: mnc1423 [email protected] 发送时间: Sunday, July 28, 2019 5:36:39 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

Thank you for the help! Can i ask what GPU you're using?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24I6DA2JCZAEZZWN2T3QBVSCPA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD263CPQ#issuecomment-515748158, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24OBILQGJCYVQZDYNBTQBVSCPANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 29 '19 00:07 shenhai1895

Thank you for the help!

mnc1423 avatar Jul 29 '19 04:07 mnc1423

After commenting the part of loading mask,what do you change for preserving results in test.py?

guolihong avatar Jul 30 '19 11:07 guolihong

You could use the liver_res predicted by the model as the mask. Like this

mask = liver_res

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: guolihong [email protected] 发送时间: Tuesday, July 30, 2019 7:50:43 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

After commenting the part of loading mask,what do you change for preserving results in test.py?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24J5NT3SGEES4KMTRFLQCATJHA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3DWXWI#issuecomment-516385753, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24KZHIY5TVE5CMZB3ILQCATJHANCNFSM4H6YVIFA.

shenhai1895 avatar Jul 31 '19 02:07 shenhai1895

Thank you very much for your help!

---Original--- From: "shenhai1895"[email protected] Date: Wed, Jul 31, 2019 10:15 AM To: "xmengli999/H-DenseUNet"[email protected]; Cc: "Comment"[email protected];"guolihong"[email protected]; Subject: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

You could use the liver_res predicted by the model as the mask. Like this

mask = liver_res

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: guolihong [email protected] 发送时间: Tuesday, July 30, 2019 7:50:43 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

After commenting the part of loading mask,what do you change for preserving results in test.py?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24J5NT3SGEES4KMTRFLQCATJHA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3DWXWI#issuecomment-516385753, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24KZHIY5TVE5CMZB3ILQCATJHANCNFSM4H6YVIFA. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

guolihong avatar Jul 31 '19 03:07 guolihong

Thank you!But without masks,I use the model author replied and the dice of tumor is only 0.23,which is so low.Have you reproduced the results in the article?

---Original--- From: "shenhai1895"[email protected] Date: Wed, Jul 31, 2019 10:15 AM To: "xmengli999/H-DenseUNet"[email protected]; Cc: "Comment"[email protected];"guolihong"[email protected]; Subject: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

You could use the liver_res predicted by the model as the mask. Like this

mask = liver_res

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: guolihong [email protected] 发送时间: Tuesday, July 30, 2019 7:50:43 PM 收件人: xmengli999/H-DenseUNet [email protected] 抄送: shenhai1895 [email protected]; Author [email protected] 主题: Re: [xmengli999/H-DenseUNet] Could you please update the code you use about generating livermask? (#39)

After commenting the part of loading mask,what do you change for preserving results in test.py?

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xmengli999/H-DenseUNet/issues/39?email_source=notifications&email_token=AE2Q24J5NT3SGEES4KMTRFLQCATJHA5CNFSM4H6YVIFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3DWXWI#issuecomment-516385753, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE2Q24KZHIY5TVE5CMZB3ILQCATJHANCNFSM4H6YVIFA.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

guolihong avatar Aug 15 '19 10:08 guolihong

x = imgs_test.shape[0] y = imgs_test.shape[1] z = imgs_test.shape[2] right_cols = int(min(z, maxi[2] + 10) - img_cols) left_cols = max(0, min(mini[2] - 5, right_cols)) right_cols = int(z - img_cols) left_cols = 0 score = np.zeros((x, y, z, num), dtype='float32') score_num = np.zeros((x, y, z, num), dtype='int16') 发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用

I wonder if x, y, z is maxi in "load liver mask" part(num is referenced before assignment)? So, what is "mini"? # load liver mask mask, mask_header = load(args.liver_path + str(id) + '-ori.nii') mask[mask==2]=1 mask = ndimage.binary_dilation(mask, iterations=1).astype(mask.dtype) index = np.where(mask==1) mini = np.min(index, axis = -1) maxi = np.max(index, axis = -1)

anxingle avatar Dec 18 '19 14:12 anxingle