Skip to content
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

Example to use VectorImage in python #548

Open
juanprietob opened this Issue Feb 27, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@juanprietob
Copy link

juanprietob commented Feb 27, 2019

Description

An example of how to read and write an Image with an unknown number of Components will be great. The VectorImage is wrapped in itk python and it works great but there is no usage example.

Expected behavior

An example at the ITKExamples would be great.

Actual behavior

There is no example of this feature.

Additional Information

Dimension = 3
ComponentType = itk.ctype('float')
OutputImageType = itk.VectorImage[ComponentType, Dimension]

out_img = OutputImageType.New()
out_img.SetNumberOfComponentsPerPixel(40)

size = itk.Size[Dimension]()
size.Fill(64)

index = itk.Index[Dimension]()
index.Fill(0)

RegionType = itk.ImageRegion[Dimension]
region = RegionType()
region.SetIndex(index)
region.SetSize(size)

out_img.SetRegions(region)
out_img.SetDirection(img.GetDirection())
out_img.SetOrigin(img.GetOrigin())
out_img.SetSpacing(img.GetSpacing())
out_img.Allocate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.