[Insight-users] PadImageFilter question
Benjamin King
king . benjamin at mh-hannover . de
Thu, 21 Aug 2003 11:17:12 +0100
------------7bA80ZJEuFvfCDi4x3qbSF
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Hello James,
I tried to use the ChangeInformationImageFilter as you proposed, but the
region indices are still different. Even worse is that the filter throws an
exception when it is Update()d. I attached code that demonstrates the
problem using two random images of different size.
I'm unsure whether my problems are based on a misconception about image
regions. I read the documentation and I think that the
LargestPossibleRegion should always have the index (0,0,0) because that
index defines where the region starts in image coordinates. So I think that
PadImageFilter should not return an output whose LargestPossibleRegion
starts outside the image. Or should it?
Best regards,
Benjamin
--
Benjamin King
Institut für Medizinische Informatik
Medizinische Hochschule Hannover
Tel.: +49 511 532-2663
------------7bA80ZJEuFvfCDi4x3qbSF
Content-Disposition: attachment;
filename="DebugChangeInformationFilter.cpp"
Content-Type: application/octet-stream;
name="DebugChangeInformationFilter.cpp"
Content-Transfer-Encoding: Base64
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RkZXhjZXB0PgojaW5j
bHVkZSAiaXRrSW1hZ2UuaCIKI2luY2x1ZGUgIml0a1JhbmRvbUltYWdlU291
cmNlLmgiCiNpbmNsdWRlICJpdGtDb25zdGFudFBhZEltYWdlRmlsdGVyLmgi
CiNpbmNsdWRlICJpdGtDaGFuZ2VJbmZvcm1hdGlvbkltYWdlRmlsdGVyLmgi
CiNpbmNsdWRlICJpdGtFeGNlcHRpb25PYmplY3QuaCIKCnVzaW5nIHN0ZDo6
Y291dDsKdXNpbmcgc3RkOjplbmRsOwoKaW50IG1haW4oaW50IGFyZ2MsIGNo
YXIgKmFyZ3ZbXSkgewogIHR5cGVkZWYgaXRrOjpJbWFnZTx1bnNpZ25lZCBz
aG9ydCwgMz4gSW1hZ2VUeXBlOwoKICAvLyBHZW5lcmF0ZSByYW5kb20gaW1h
Z2VzCiAgdHlwZWRlZiBpdGs6OlJhbmRvbUltYWdlU291cmNlPEltYWdlVHl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