[ITK-users] Texture pixel by pixel

Cyril Jaudet drcjaudet at gmail.com
Mon Sep 28 09:16:40 EDT 2015


Hello, if you want here some code to implement the offset values depending
of the maximal radius (neighborhood_radius)
 between the center voxel and his neighbors.

 NeighborhoodType neighborhood;
    neighborhood.SetRadius(Neighborhood_Radius);
    unsigned int centerIndex = neighborhood.GetCenterNeighborhoodIndex();

     OffsetType offset;

     int Nd=0;

     const OffsetVectorType::Pointer list_offset=OffsetVectorType::New();

     //list_offset->reserve(1000);//memory mamagement

     for ( unsigned int d = 0; d < centerIndex; d++ )  //limit the
direction to 13 if you want the 26 standard one go to centerindex*2
      {
        offset = neighborhood.GetOffset(d);
        //std::cout << "test Offset"<<offset<<std::endl;
        Nd++;
        list_offset->push_back(offset);
      }
     //std::cout<<"Number of offset: "<<Nd<<std::endl;

It'll show yo uthe different direction that are used dependaing of the
radius.
Also you can choose one direction.
Best regards,
Cyril Jaudet, UZBrussel, PhD


2015-09-28 14:19 GMT+02:00 Bradley Lowekamp <blowekamp at mail.nih.gov>:

> Hello,
>
> Use the source [1]! It's just a little debugging information, which should
> be changed to itkDebugMacro. Pull requests are welcomed.
>
> The real offsets used relative to each pixel are the ones provided by
> "Offsets". What's printed out is all pairs used to generate the histogram
> in a neighborhood.
>
> HTH,
> Brad
>
> [1]
> https://github.com/blowekamp/itkTextureAnalysis/blob/b3911a8ab891859c50c7e3c8819d1a9fa0eaf4af/include/itkTextureFeatureImageFilter.hxx#L129
>
>
> On Sep 28, 2015, at 5:53 AM, Francisco Lopez de la Franca <
> franciscolopezdelafranca at gmail.com> wrote:
>
> Hi Bradley,
> I'm using your filter for a 3D image and the following is happpening: I
> store in a vector the offset list. When I print it, the list contains just
> 13 offsets (I've used the same code as in the
> itk::ScalarImageToTextureImageFilter). The problem comes when I call your
> SetOffsets(myOffsetList) method, my application starts printing a lot of
> offsets, I guess all the possible combinations for three dimensions.
> Do you know this "problem"? Then, what is the real offsets your filter use?
>
> Thank you so much.
> Kind regards.
> /Francisco
>
> 2015-09-25 15:10 GMT+02:00 Bradley Lowekamp <blowekamp at mail.nih.gov>:
>
>> Hello,
>>
>> For my itkTextureFeatureImageFilter, the default for the OffsetVector is
>> an empty list. So it is required to set this member to get meaningful
>> results.
>>
>> ITK is an OpenSource project. When you don't know how something is
>> implemented you can open the hood and find out [1].
>>
>> HTH,
>> Brad
>>
>> [1]
>> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx#L66-L76
>>
>> On Sep 25, 2015, at 6:37 AM, Francisco Lopez de la Franca <
>> franciscolopezdelafranca at gmail.com> wrote:
>>
>> Which directions (for 3D images) will your filter use if I donot specify
>> any offset?
>>
>> 2015-09-25 11:12 GMT+02:00 Francisco Lopez de la Franca <
>> franciscolopezdelafranca at gmail.com>:
>>
>>> Hi again,
>>>
>>> For 3D images, what should I use as default offset vector if I use your
>>> class?
>>>
>>> I've been using itk::ScalarImageToTextureFeaturesFilter for 3D images
>>> and I've also done some tests on 3D NIFTI images but its description talks
>>> only about the default 2D image offsets ({(-1, 0), (-1, -1), (0, -1), (1,
>>> -1)}) but not for 3D. Besides, the 2D default is missing some offsets.
>>>
>>> I'd like to use your class and test it with the same default values as
>>> with the ScalarIm.... class.
>>>
>>> Thank you very much.
>>> My best regards.
>>>
>>>
>>> 2015-09-22 14:27 GMT+02:00 Bradley Lowekamp <blowekamp at mail.nih.gov>:
>>>
>>>> Hello,
>>>>
>>>> Please try to keep this discussion on the mailing list.
>>>>
>>>> You can find a basic program here [1].  Which provide a good example
>>>> for usage.
>>>>
>>>>  It allows writing to any file format that ITK supports with vector
>>>> images. I know that mha, nii, and nrrd should support this. Others may and
>>>> it varies based what modules are compiled into ITK.
>>>>
>>>> You can see how the texture information is written into the vector here
>>>> [2]. Contributions to improve the documentation are welcomed.
>>>>
>>>>
>>>>
>>>> [1]
>>>> https://github.com/blowekamp/itkTextureAnalysis/blob/master/test/itkTextureFeatureImageFilterTest.cxx
>>>> [2]
>>>> https://github.com/blowekamp/itkTextureAnalysis/blob/b3911a8ab891859c50c7e3c8819d1a9fa0eaf4af/include/itkTextureFeatureImageFilter.hxx#L217-L224
>>>>
>>>> On Sep 22, 2015, at 3:25 AM, Francisco Lopez de la Franca <
>>>> franciscolopezdelafranca at gmail.com> wrote:
>>>>
>>>> Hi Bradley,
>>>> I'd like to use your class. A couple of questions:
>>>>
>>>> - Which format can the vectorimage generated be saved in? Is it
>>>> possible to save it in Nifti format?
>>>>
>>>> - Which information does the vector image contain, I mean, what is the
>>>> info stored for each voxel? How can I access that info?
>>>>
>>>> I guess the usage of yourclass is in the same way as any ITK filter:
>>>>
>>>> yourFilter->setInput(inputImage);
>>>> yourFilter->setWindowSize(windowSize);
>>>> ... // other sets...
>>>> yourFilter->update();
>>>> vectorImage = yourFilter->GetOutput();
>>>>
>>>> but, how can I read the data of each voxel in the vector image?
>>>>
>>>> Thank you very much.
>>>> Kind regards.
>>>>
>>>>
>>>> 2015-09-21 14:30 GMT+02:00 Bradley Lowekamp <blowekamp at mail.nih.gov>:
>>>>
>>>>> Hello,
>>>>>
>>>>> I have a external ITK extension you may find useful:
>>>>>
>>>>> https://github.com/blowekamp/itkTextureAnalysis/blob/master/include/itkTextureFeatureImageFilter.h
>>>>>
>>>>> This computed the GLCM, for a neighborhood for every pixel and
>>>>> produces a VectorImage with all the features.
>>>>>
>>>>> Contributions to improving the class and documentation are welcome.
>>>>>
>>>>> HTH,
>>>>> Brad
>>>>>
>>>>> On Sep 21, 2015, at 7:15 AM, Francisco Lopez de la Franca <
>>>>> franciscolopezdelafranca at gmail.com> wrote:
>>>>>
>>>>> > Hi,
>>>>> > I've used the itk::Statistics::ScalarImageToTextureFeaturesFilter
>>>>> class with the default parameters and everything was OK.
>>>>> >
>>>>> > But now, I have to calculate the texture features of a 2D scalar
>>>>> image pixel by pixel, I mean, iterate over the whole image and calculate
>>>>> the texture features of every pixel.
>>>>> >
>>>>> > I guess I've got to use each pixel as the masked region over which
>>>>> to calculate the texture features, but I think this process could be very
>>>>> slow (I have to do it with a lot of 2D images).
>>>>> >
>>>>> > Is there a faster way to do it or isn't it possible as I've
>>>>> described?
>>>>> >
>>>>> > Thanks a lot.
>>>>> > Kind regards.
>>>>> > _____________________________________
>>>>> > 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.php
>>>>> >
>>>>> > 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://public.kitware.com/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.php
>
> 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://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150928/7a5e07ea/attachment.html>


More information about the Insight-users mailing list