[Insight-users] itkResampleImageFilter Up sample take too long?
Feng Ma
mafeng at hotmail . com
Thu, 23 Oct 2003 16:58:30 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_d0d_7581_74e1
Content-Type: text/plain; format=flowed
Hi,
I am using itkResampleImageFilter to do resampling both down sampling and
up sampling. I found out that down sampling almost take no time, while up
sampling takes significantly longer. Attached is my test code, with results
as below:
Start down sampling: 0
End down sampling: 0.33
Start up sampling: 0.33
End up sampling: 107.77
The code works as:
First downsample a volume 512x512x251 to 64x64x50. Then up sample the
small volume to original size.
Any idea about this?
Thanks a lot.
-Feng
_________________________________________________________________
See when your friends are online with MSN Messenger 6.0. Download it now
FREE! http://msnmessenger-download . com
------=_NextPart_000_d0d_7581_74e1
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"
I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRl
ICJpdGtDYXN0SW1hZ2VGaWx0ZXIuaCIKI2luY2x1ZGUgIml0a1Jlc2FtcGxl
SW1hZ2VGaWx0ZXIuaCIKI2luY2x1ZGUgIml0a05lYXJlc3ROZWlnaGJvcklu
dGVycG9sYXRlSW1hZ2VGdW5jdGlvbi5oIgojaW5jbHVkZSAiaXRrTGluZWFy
SW50ZXJwb2xhdGVJbWFnZUZ1bmN0aW9uLmgiCgpleHRlcm4gIkMiIHsKI2lu
Y2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUg
PHRpbWUuaD4KfQoKaW50IG1haW4oKQp7CiAgaW50IGksIHpvb21bM107CiAg
ZG91YmxlIGRpbXNbM10sIHNwYWNpbmdbM10sIG9yaWdpblszXSwgc21hbGxE
aW1zWzNdLCBzbWFsbFNwYWNpbmdbM10sIHNtYWxsT3JpZ2luWzNdOwogIGNs
b2NrX3Qgc3RhcnRjOwoKICBjb25zdCB1bnNpZ25lZCBzaG9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