InsightSoftwareConsortium / InsightSoftwareConsortium/ITKTubeTK

gap appears when I generate the nii.gz file from .tre when using TubeTK

Open
#141 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
57
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Thank you for sharing your excellent project professor!

I meet the same problems as [Subhashis-Banerjee] [https://github.com/InsightSoftwareConsortium/ITKTubeTK/issues/81](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](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:

![111](https://user-images.githubusercontent.com/101242990/228702081-97b9d9ee-96d4-4e44-9dd3-b8869831bb79.png)

the vtp image shows these gaps should not exist:
![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:

![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 !

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.