[Insight-users] downsampling a 3D volume

Bill Lorensen bill.lorensen at gmail.com
Thu Apr 1 16:09:04 EDT 2010


I think that fitsum wants to produce an image with fewer pixels.
http://en.wikipedia.org/wiki/Downsampling

On Wed, Mar 31, 2010 at 9:23 AM, michiel mentink
<michael.mentink at st-hughs.ox.ac.uk> wrote:
>>>I think that only changes the spacing of the image artificially and does
>>> not change the image size and its contents.
>
> I think changing the pixel spacing does change the image size. There is no
> property attached to an image that gives it
> "image size".
> The image size is calculated by multiplying pixelspacing with the number of
> pixels.
>
> When you use a linear interpolator, you inherently apply a low-pass filter
> to your pixels, which makes the picture more
> blurry.
>
> Feel free to correct me when I'm wrong.
>
> cheers, Michael
>
> On Tue, Mar 30, 2010 at 11:43 PM, Kishore Mosaliganti
> <kishoreraom at gmail.com> wrote:
>>
>> I think that only changes the spacing of the image artificially and does
>> not change the image size and its contents.
>>
>> It is best to use a ResampleImageFilter and you can set the output spacing
>> and size of the output image:
>>
>>   ResampleFilterType::Pointer resample = ResampleFilterType::New();
>>   resample->SetTransform ( transform ); // identity transform
>>   resample->SetInterpolator ( interp ); // linear interpolator
>>   resample->SetInput ( reader->GetOutput() );
>>   resample->SetSize ( size );
>>   resample->SetOutputOrigin ( origin );
>>   resample->SetOutputSpacing ( spacing );
>>   resample->SetDefaultPixelValue ( 0 );
>>   resample->Update();
>>
>> Kishore
>>
>> On Tue, Mar 30, 2010 at 5:40 PM, michiel mentink
>> <michael.mentink at st-hughs.ox.ac.uk> wrote:
>>>
>>> I think the easiest option for you would be just to open an image, and
>>> then
>>> decrease the pixel size.
>>> After opening an image, the pixel size is just a property of the matrix
>>> with
>>> pixel values.
>>>
>>> You can get that property with
>>>
>>>
>>>  image=reader->GetOutput(); // open your image
>>>
>>> ImageType::SpacingType sp = image->GetSpacing();
>>>    std::cout << "Spacing = ";
>>>    std::cout << sp[0] << ", " << sp[1] << ", " << sp[2] << std::endl;
>>>
>>> Then, divide all spacing parameters by 1.07:
>>>
>>> sp[0] = sp[0]/1.07;
>>> sp[1] = sp[1]/1.07; // etc.
>>>
>>> and then set the spacing:
>>>
>>> image->SetSpacing(sp)
>>>
>>> After that, you will have changed the dimension of your image without
>>> having
>>> touched any of your pixels. Ideal.
>>>
>>> cheers, Michael
>>>
>>>
>>>
>>> On 3/30/10, Reda, Fitsum A <fitecx at gmail.com> wrote:
>>> > Hi all,
>>> >
>>> > I wanted to downsample CT volumes using floating point scale , say,
>>> > (scale_x, scale_y,scale_z) = (1.07, 1.07, 1.07);
>>> > I would really appreciate any help with this. I am kind of getting
>>> > started
>>> > with itk.
>>> >
>>> > Thanks in advance,
>>> > Reda
>>> >
>>> >
>>> >
>>> > _____________________________________
>>> >  Powered by www.kitware.com
>>> >
>>> >  Visit other Kitware open-source projects at
>>> >  http://www.kitware.com/opensource/opensource.html
>>> >
>>> >  Kitware offers ITK Training Courses, for more information visit:
>>> >  http://www.kitware.com/products/protraining.html
>>> >
>>> >  Please keep messages on-topic and check the ITK FAQ at:
>>> >  http://www.itk.org/Wiki/ITK_FAQ
>>> >
>>> >  Follow this link to subscribe/unsubscribe:
>>> >  http://www.itk.org/mailman/listinfo/insight-users
>>> >
>>> >
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list