-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gap appears when I generate the nii.gz file from .tre when using TubeTK #141
Comments
Hi,
How are you generating the renderings? The _label.nii.gz images produced
are volumes, but it looks like you're showing the results as red surfaces.
So, this could be a problem of the surface extraction/renderer you're
using to convert from a binary volume to surfaces, or it could definitely
be my code that is at fault. I'll check my code again, but it would be
good if you also checked the volume (_label.nii.gz) file directly instead
of as a 3D rendering.
Thanks!
s
…On Wed, Mar 29, 2023 at 9:22 PM jinshuozhang ***@***.***> wrote:
Thank you for sharing your excellent project professor!
I meet the same problems as [Subhashis-Banerjee]
#81
<http://url> when I try to generate the label image from .tre
my .mha and .tre data come from the public dataset
https://public.kitware.com/Wiki/TubeTK/Data <http://url>, the size of the
image is 448×448×128 and the spacing is 0.513×0.513×0.8.
I use the 'Normal002-MRA.mha' and the corresponding VascularNetwork.tre
for testing. the following is my code:
`
import itk
from itk import TubeTK as ttk
PixelType = itk.F
Dimension = 3
ImageType = itk.Image[PixelType, Dimension]
Read tre file
TubeFileReaderType = itk.SpatialObjectReader[Dimension]
tubeFileReader = TubeFileReaderType.New()
tubeFileReader.SetFileName("F:/MIDAS_data/002/Vessel_annotation_file/VascularNetwork.tre")
tubeFileReader.Update()
tubes = tubeFileReader.GetGroup()
''''###
SurfWriter = ttk.WriteTubesAsPolyData.New()
SurfWriter.SetFileName("F:/MIDAS_data/002/vesselsurface.vtp")
SurfWriter.SetInput(tubes)
SurfWriter.Update()
'''
Read template image
TemplateImageType = itk.Image[PixelType, Dimension]
TemplateImageReaderType = itk.ImageFileReader[TemplateImageType]
templateImageReader = TemplateImageReaderType.New()
templateImageReader.SetFileName("F:/MIDAS_data/002/MRA/Normal002-MRA.mha")
templateImageReader.Update()
templateImage = templateImageReader.GetOutput()
###########################
#Resample = ttk.ResampleImage.New(templateImage,ResampleFactor=(2,2,2))
#Resample = ttk.ResampleImage.New(templateImage)
#Resample.SetMakeHighResIso(True)
#Resample.Update()
#image_iso = Resample.GetOutput()
##########################
TubesToImageFilterType = ttk.ConvertTubesToImage[TemplateImageType]
tubesToImageFilter = TubesToImageFilterType.New()
tubesToImageFilter.SetUseRadius(True)
tubesToImageFilter.SetTemplateImage(templateImageReader.GetOutput())
#tubesToImageFilter.SetTemplateImage(image_iso)
tubesToImageFilter.SetInput(tubes)
tubesToImageFilter.Update()
outputImage = tubesToImageFilter.GetOutput()
itk.imwrite(outputImage, 'F:/MIDAS_data/002/double_label.nii.gz')
`
I get the image( size: 448×448×128 spacing: 0.513,0.513,0.8 ) shows the
label discontinuous:
[image: 111]
<https://user-images.githubusercontent.com/101242990/228702081-97b9d9ee-96d4-4e44-9dd3-b8869831bb79.png>
the vtp image shows these gaps should not exist:
[image: 222]
<https://user-images.githubusercontent.com/101242990/228702304-cf01caae-ba06-431c-badf-47c173b9e8e2.png>
when I up-resampling the mha image to 896×896×255 ,spacing
0.257,0.257,0.4, I got the right label:
[image: 333]
<https://user-images.githubusercontent.com/101242990/228702520-a2121223-c277-4987-9534-5e9387f1f896.png>
however, this size is too large for us to use for study.
So, Is there any way to get continuous vessel labels without upsampling? I
need the continuous vessel labels with the size of 448×448×128 and spacing
of 0.513,0.513,0.8.
Thank you !
—
Reply to this email directly, view it on GitHub
<#141>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJLZDTCBNHMVEEZQBIYLW6TN5JANCNFSM6AAAAAAWMTQUGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
Chair of MONAI Advisory Board
---
Kitware: *Delivering innovation.*
|
Thank you for your reply. We are using the code you provided to get the _label.nii.gz file. Then we opened the file using itk-snap, a popular software, and got the 3D rendered result. As far as we know, the reason for the broken blood vessels in the label file is not caused by itk-snap, but the label file itself is faulty. Could you check if there is a problem with the code itself that we are using, thank you ! |
Hi,
Please email me your _label.nii.gz file.
Thanks,
Stephen
***@***.***
…On Mon, Apr 17, 2023 at 2:56 AM jinshuozhang ***@***.***> wrote:
[image: 7777]
<https://user-images.githubusercontent.com/101242990/232407523-0b2be5d1-eb7b-4dbc-87d3-78f302224fdc.png>
This is the python version of the code we use, and the data we use is the
.tre annotated file provided in MIDAS.
—
Reply to this email directly, view it on GitHub
<#141 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL5K7BZHTRF2HZR45WTXBTSQRANCNFSM6AAAAAAWMTQUGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
Chair of MONAI Advisory Board
---
Kitware: *Delivering innovation.*
|
professor, we have emailed the label.nii.gz, have you got it? |
I have not received it, and it is not in my spam folder.
Sorry for the troubles. Please try sharing via gdrive or dropbox or box or
such. Some mail systems blog .gz and .zip file attachments. Otherwise, I
can try duplicating your code later this week, but it is already a busy
week for me.
Thanks,
s
On Sun, Apr 23, 2023 at 4:01 AM jinshuozhang ***@***.***>
wrote:
… Hi, Please email me your _label.nii.gz file. Thanks, Stephen *@*.***
… <#m_-4720112394795503434_>
On Mon, Apr 17, 2023 at 2:56 AM jinshuozhang *@*.*> wrote: [image: 7777]
https://user-images.githubusercontent.com/101242990/232407523-0b2be5d1-eb7b-4dbc-87d3-78f302224fdc.png
<https://user-images.githubusercontent.com/101242990/232407523-0b2be5d1-eb7b-4dbc-87d3-78f302224fdc.png>
This is the python version of the code we use, and the data we use is the
.tre annotated file provided in MIDAS. — Reply to this email directly, view
it on GitHub <#141 (comment)
<#141 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AACEJL5K7BZHTRF2HZR45WTXBTSQRANCNFSM6AAAAAAWMTQUGQ
<https://github.com/notifications/unsubscribe-auth/AACEJL5K7BZHTRF2HZR45WTXBTSQRANCNFSM6AAAAAAWMTQUGQ>
. You are receiving this because you commented.Message ID: @.*>
-- Stephen R. Aylward, Ph.D. Senior Director of Strategic Initiatives
Chair of MONAI Advisory Board --- Kitware: *Delivering innovation.*
professor, we have emailed the label.nii.gz, have you got it?
—
Reply to this email directly, view it on GitHub
<#141 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL644X4PZELPXZIYIMLXCTOWHANCNFSM6AAAAAAWMTQUGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
Chair of MONAI Advisory Board
---
Kitware: *Delivering innovation.*
|
professor,this is my code and the lable.nii.gz. https://drive.google.com/file/d/1-HrBRIsKxKITljZcSCtNZ7OBkBnu-hri/view?usp=share_link. We are very grateful for your help and we wish you all the best in your work. |
Hi, Sorry for the delay. Looking at the label.nii.gz file, there are no gaps. The issue is how you are displaying the label.nii.gz file. Below is a comparison: on the left is your visualization and on the right is a maximum intensity projection (MIP) of your file. The MIP shows that the vessels get very narrow at the regions you see as gaps, but there are still connections. The challenge is the discretization of the image, i.e., the size of the vessels relative to the size of a voxel. When a segment of a vessel has a diameter that is approximately one voxel, that vessel segment is rendered as one-voxel-wide curves. Your display seems to be doing a surface extraction or volume rendering from the label.nii.gz file - and many surface extraction (and other rendering methods) will not handle one-voxel-wide objects very well - making them appear to "disappear." Right now things are (arguably) as accurate as the resolution of the image allows. That is why when you reconstruction using a higher resolution image you get a more accurate looking representation regardless of the rendering method. The one-voxel-wide segments become two or more voxel wide segments, and volume rendering / surface extraction works. Hope all of this makes sense. One possible hack...you could apply a morphological dilate filter to make every vessel appear wider. Then your rendering method should work. |
Thank you for sharing your excellent project professor!
I meet the same problems as [Subhashis-Banerjee] https://github.com/InsightSoftwareConsortium/ITKTubeTK/issues/81 when I try to generate the label image from .tre
my .mha and .tre data come from the public dataset https://public.kitware.com/Wiki/TubeTK/Data, the size of the image is 448×448×128 and the spacing is 0.513×0.513×0.8.
I use the 'Normal002-MRA.mha' and the corresponding VascularNetwork.tre for testing. the following is my code:
`
import itk
from itk import TubeTK as ttk
PixelType = itk.F
Dimension = 3
ImageType = itk.Image[PixelType, Dimension]
Read tre file
TubeFileReaderType = itk.SpatialObjectReader[Dimension]
tubeFileReader = TubeFileReaderType.New()
tubeFileReader.SetFileName("F:/MIDAS_data/002/Vessel_annotation_file/VascularNetwork.tre")
tubeFileReader.Update()
tubes = tubeFileReader.GetGroup()
''''###
SurfWriter = ttk.WriteTubesAsPolyData.New()
SurfWriter.SetFileName("F:/MIDAS_data/002/vesselsurface.vtp")
SurfWriter.SetInput(tubes)
SurfWriter.Update()
'''
Read template image
TemplateImageType = itk.Image[PixelType, Dimension]
TemplateImageReaderType = itk.ImageFileReader[TemplateImageType]
templateImageReader = TemplateImageReaderType.New()
templateImageReader.SetFileName("F:/MIDAS_data/002/MRA/Normal002-MRA.mha")
templateImageReader.Update()
templateImage = templateImageReader.GetOutput()
###########################
#Resample = ttk.ResampleImage.New(templateImage,ResampleFactor=(2,2,2))
#Resample = ttk.ResampleImage.New(templateImage)
#Resample.SetMakeHighResIso(True)
#Resample.Update()
#image_iso = Resample.GetOutput()
##########################
TubesToImageFilterType = ttk.ConvertTubesToImage[TemplateImageType]
tubesToImageFilter = TubesToImageFilterType.New()
tubesToImageFilter.SetUseRadius(True)
tubesToImageFilter.SetTemplateImage(templateImageReader.GetOutput())
#tubesToImageFilter.SetTemplateImage(image_iso)
tubesToImageFilter.SetInput(tubes)
tubesToImageFilter.Update()
outputImage = tubesToImageFilter.GetOutput()
itk.imwrite(outputImage, 'F:/MIDAS_data/002/double_label.nii.gz')
`
I get the image( size: 448×448×128 spacing: 0.513,0.513,0.8 ) shows the label discontinuous:
the vtp image shows these gaps should not exist:
when I up-resampling the mha image to 896×896×255 ,spacing 0.257,0.257,0.4, I got the right label:
however, this size is too large for us to use for study.
So, Is there any way to get continuous vessel labels without upsampling? I need the continuous vessel labels with the size of 448×448×128 and spacing of 0.513,0.513,0.8.
Thank you !
The text was updated successfully, but these errors were encountered: