Hi,<br>I'd like to do something like a convolution, but not quite.<br>I can't explain it too well so here's a picture.<br><br>x.x.x.x<br>.......<br>x.x.x.x<br>.......<br>x.x.x.x<br><br>Here my input image is of dimension 5x7, and the 'x' and '.' are voxels of the input image. (It is really N-dimensional).<br>
Then there's an image of dimension 3x4 (call it the x-image), where x-image(i,j) is the value of the (i,j)th 'x' in the picture above.<br>The idea is I want to do a convolution, but only at the voxels marked 'x'. <br>
I know MaskNeighborhoodOperatorImageFilter does this, however I would like the output image to be the same dimensions as the x-image - smaller than the input image. So output(i,j) contains the convolution at the (i,j)th 'x'.<br>
I use this for something done in voxel space, so if the physical space/origin aren't right it doesn't matter.<br><br>The additional bits of information are that:<br>- I know exactly how to orient the 'x' within the input image; they are on a regular grid starting at (0,0) of the input image, and then placed every h voxels (of the input image).<br>
- My kernel is separable ( however, can range from 3x3 to ~35x35. I anticipate the likely sizes will be 3x3 to ~20x20 ) (mine will be usu. 2- or 3-D)<br><br>If I use MaskNeighborhoodOperatorImageFilter, I'd need to create a mask of the same size as the input image with 1 where the 'x' are, run it, and then loop through the output image and copy the values (where the mask is 1) back to my x-image. <br>
I get the feeling that because my 'x' are regularly spaced and my kernel is separable, I can modify this code to speed up the convolution greatly, but I'm not sure how to do it. <br><br>The part that causes me the most difficulty is how to make my neighborhood iterator only walk the 'x' of the input image. I could try a<br>
'iterator += spacing', but I'd need to work out when to skip h rows (eg row 1 of the picture above) and when to skip h voxels (eg in row 0 of the picture above).<br><br>Also, in this case, would it be faster to do one ND convolution or N lots of 1D convolutions? <br>
I think I have three options:<br>- do the convolution on the input image and at the end pick out the values that match the indices of the 'x's. Disadvantage being that I have to do the convolution at every voxel whereas I only want the answer every h voxels, so I waste some computation (?)<br>
- do N lots of 1D convolutions, but I think this is the same as the previous option because all the intermediate convolutions will need to be done on the input image (ie at every voxel). I don't save any time by skipping the non-'x' voxels.<br>
- do one ND convolution, but only at the indices marked 'x'. I need some way of visiting just the 'x' with my neighborhood iterator.<br><br>Does anyone have some advice regarding this? (apologies for the clumsy explanation)<br>
<br>thanks,<br>Amy<br>