sitk.ComposeImageFilter with list of images (python)

Hello!

I am trying to use the ComposeImageFilter to combine three grayscale volumes into an RGB volume. All my images have the same metadata in regards of origin, spacing, dimensions,etc…

This is what I am doing:

def compose_image(image_list):
    filter = sitk.ComposeImageFilter(image_list)
    return filter.Execute()

From the ITK documentation I get this is possible since the Execute method is overloaded and one of the versions receives a vector:

What am I doing wrong?

Thanks,

Diego

1 Like

You are passing the arguments for the execute method to the constructor. Are you wanting to use the procedural or the object oriented interface?

I saw that! sorry! I tried to delete this post but I don’t have that option.

I reverted your edit. @matt.mccormick and @fbudin can probably delete the post, but I see no reason for that. You should not be ashamed for asking questions!

3 Likes

Hi Dženan! I am not worried about asking, it is just that it was silly because I passed the list of images to the constructor instead of passing it to the execute method (this is what happens when you code past midnight lol). I noticed and I tried to delete the question but it was too late… :man_facepalming:t4: and I had a DUH! moment.

1 Like

Other people might make the same late night mistake. Having an explanation of what they should have done is helpful. Thanks for asking the question!