<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks Suyash.<div><br><div><div>On Dec 6, 2012, at 11:23 PM, Suyash P. Awate <<a href="mailto:suyash@sci.utah.edu">suyash@sci.utah.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>Hi folks,<br><br>I've discussed this with Kris this afternoon and this needs a small fix in the way weights are being handled for anisotropic voxel sizes and in dimensions higher than 2.<br><div class="gmail_extra">
<br clear="all">
<br>Regards,<br>Suyash<br>
<br><br><div class="gmail_quote">On Thu, Dec 6, 2012 at 4:02 PM, Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Kris,<br>
<br>
You're right. If I change the image spacing to be isotropic, I get<br>
past the error which is great. I'm assuming we'll just see what<br>
Suyash says. Thanks for looking into this.<br>
<br>
Nick<br>
<div><br>
<br>
On Dec 6, 2012, at 5:24 PM, Kris Zygmunt <<a href="mailto:krismz@sci.utah.edu" target="_blank">krismz@sci.utah.edu</a>> wrote:<br>
<br>
> Ok, there are 2 problems going on. The first is that the patch weights are not appropriately 3D sphere. The second is that the resampling of the patch weights results in a max patch weight < 1 for non-integer resampling values. But I think the resampling should really be reconsidered a bit more. If the image spacing is 0.5,0.5,0.5 I'm not sure that resampling really needs to happen. The point is really to make the patch weights capture the relative anisotropy. Thus if the image spacing is 1,1,0.5 then maybe in that case it makes sense to resample the patch weights in the z direction to cover the same amount of physical space. I'm including Suyash on this message to see what he thinks is the best way to handle this.<br>
><br>
> I haven't looked at your code changes yet, as I first wanted to understand better what was happening. I'll take a look there next.<br>
><br>
> -Kris<br>
><br>
> On Dec 6, 2012, at 12:24 PM, Nicholas Tustison wrote:<br>
><br>
>> Thanks Kris and Brad for your responses. Since it's easier to<br>
>> look at code, I thought I'd post the changes I had to make.<br>
>><br>
>> <a href="http://review.source.kitware.com/#/c/8833/" target="_blank">http://review.source.kitware.com/#/c/8833/</a><br>
>><br>
>> Kris, if I read the code correctly, it seems to me that the physical<br>
>> weighting image shouldn't be affected at all by anisotropic voxels<br>
>> in the input image. Am I reading that right? The size of the physical<br>
>> weighting image seems only affected by the patch radius with<br>
>> isotropic spacing equal to 1. When I write that image to disk using<br>
>> my patch, I get an isotropic weighting distance function. Otherwise<br>
>> I get a flat disk where the weighting in the z? direction seems to be<br>
>> close to 0. Before we get to the issue that both Brad and I are<br>
>> having of the thrown exception, perhaps we can clarify this issue.<br>
>> Is that okay?<br>
>><br>
>> Thanks again for your help with this, Kris,<br>
>><br>
>> Nick<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Dec 6, 2012, at 1:08 PM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>> wrote:<br>
>><br>
>>> Nick,<br>
>>><br>
>>> I just ran into this problem too this morning. I am glad you looked into the problem further than I did.<br>
>>><br>
>>> I was wrapping it for SimpleITK. I was setting up the filter with the defaults matching:<br>
>>><br>
>>> <a href="http://review.source.kitware.com/#/c/8803/1/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json" target="_blank">http://review.source.kitware.com/#/c/8803/1/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json</a><br>
>>><br>
>>> And I was testing it with the following 3D image:<br>
>>><br>
>>> <a href="http://itk.org/gitweb?p=SimpleITKData.git;a=blob;f=Input/RA-Short.nrrd;h=fca085049470a826324a4f2c93af2fd65fbaed52;hb=HEAD" target="_blank">http://itk.org/gitweb?p=SimpleITKData.git;a=blob;f=Input/RA-Short.nrrd;h=fca085049470a826324a4f2c93af2fd65fbaed52;hb=HEAD</a><br>
>>><br>
>>> With the following meta information:<br>
>>> Size: [64, 64, 64]<br>
>>> Spacing: [0.755874, 0.755874, 0.755874]<br>
>>> Origin: [0.283453, 0.283453, 0.283453]<br>
>>> Direction:<br>
>>> 1 0 0<br>
>>> 0 1 0<br>
>>> 0 0 1<br>
>>><br>
>>><br>
>>> I get the same error with the defaults as you did, when I run the filter with the defaults<br>
>>><br>
>>> And then if I change the patchRadius:<br>
>>><br>
>>> python: sitk.PatchBasedDenoising( img, patchRadius=8 )<br>
>>> ---------------------------------------------------------------------------<br>
>>> RuntimeError Traceback (most recent call last)<br>
>>><br>
>>> /home/blowekamp/src/SimpleITK/Testing/Data/Input/<ipython console> in <module>()<br>
>>><br>
>>> /home/blowekamp/build/SimpleITK/SimpleITK-build/Wrapping/SimpleITK.pyc in PatchBasedDenoising(*args, **kwargs)<br>
>>> 5767 double fractionPixelsForSigmaUpdate=1.0) -> Image<br>
>>> 5768 """<br>
>>> -> 5769 return _SimpleITK.PatchBasedDenoising(*args, **kwargs)<br>
>>> 5770 class MaximumProjectionImageFilter(_object):<br>
>>> 5771 """<br>
>>><br>
>>> RuntimeError: Exception thrown in SimpleITK PatchBasedDenoising: /home/blowekamp/build/SimpleITK/ITK-prefix/include/ITK-4.3/itkPatchBasedDenoisingImageFilter.hxx:641:<br>
>>> itk::ERROR: PatchBasedDenoisingImageFilter(0x3086ee0): Center pixel's weight (0.685381) must be equal to 1.0<br>
>>><br>
>>> Thanks,<br>
>>> Brad<br>
>>><br>
>>> On Dec 6, 2012, at 12:07 PM, Nicholas Tustison <<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>> wrote:<br>
>>><br>
>>>> Hi Kris,<br>
>>>><br>
>>>> Today I finally got a chance to look at your denoising work (I'm ashamed<br>
>>>> that I was at Penn for with Suyash for some time but I never asked him<br>
>>>> about it). Anyway, I have a couple questions and I was hoping you could<br>
>>>> help me try to run your denoising work on some of my MRI. I took the test<br>
>>>> that you wrote and modified it only so that I could use it as a stand-alone<br>
>>>> program. I also verified that my version worked with the test images.<br>
>>>> However, when I tried to use it on my image (stats below)<br>
>>>><br>
>>>> Image information<br>
>>>> Size: [256, 256, 20]<br>
>>>> Origin: [-232.879, -135.656, 240.706]<br>
>>>> SpatialExtent: [498.047, 498.047, 190]<br>
>>>> Center: [16.1448, 113.368, 335.706]<br>
>>>> Spacing: [1.95312, 1.95312, 10]<br>
>>>> Index: [0, 0, 0]<br>
>>>> Direction:<br>
>>>> 1 0 0<br>
>>>> 0 1 0<br>
>>>> 0 0 1<br>
>>>><br>
>>>> using the following parameters<br>
>>>><br>
>>>> patchRadius = 4<br>
>>>> noiseModel = gaussian<br>
>>>> fidelityWeight = 0.0<br>
>>>> numberOfIterations = 1<br>
>>>> sigmaMultiplicationFactor = 2<br>
>>>><br>
>>>> it gave me the following error<br>
>>>><br>
>>>> Line: 634<br>
>>>> Description: itk::ERROR: PatchBasedDenoisingImageFilter(0x7fbffb0f5e10): Center pixel's weight (0) must be equal to 1.0<br>
>>>><br>
>>>> After investigating this section of the code, I noticed that the physicalWeightsImage<br>
>>>> (after writing it to an image file) consists of what looked like a weighted 2-D disc.<br>
>>>> Based on my reading of the comments, should this be more of a 3-D weighted sphere?<br>
>>>> If so, I made some changes in the code to actually get a weighted sphere thinking<br>
>>>> that might be solve the problem but I still got the same error. However, if I increase<br>
>>>> the radius to 8, it seems to get past that error without issue. Is there a general rule<br>
>>>> for determining a minimal radius for this filter?<br>
>>>><br>
>>>> Thanks for your help,<br>
>>>> Nick<br>
>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
>>>><br>
>>>> Visit other Kitware open-source projects at<br>
>>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>><br>
>>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>>> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
>>>><br>
>>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>>><br>
>>>> Follow this link to subscribe/unsubscribe:<br>
>>>> <a href="http://www.itk.org/mailman/listinfo/insight-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a><br>
>>><br>
>><br>
><br>
<br>
</div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>