[Insight-users] Dynamic Threshold Filter

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 18 14:17:20 EDT 2010


Hi Christian,

Certainly writing the ITK image in a VTK file is an easy way
to proceed.

I still don't what difference this will make for the visualization.
It looks like the real problem is with the tetrahedraization of the
input image...

You may want to consider posting the question to the VTK
mailing list.

If you do so, you want to first convert the data to a VTK
image, so you can describe the problem fully in terms of
VTK (starting with the image size).


      Regards,


            Luis



-----------------------------------------------------
On Sun, Mar 7, 2010 at 2:51 PM, Christian Werner
<christian.werner at rwth-aachen.de> wrote:
> It's great to see that there is a dynamic threshold ITK Filter, thanks alot!
>
> Considering the volume rendering. The tetrahedralize filter kills my
> paraview, I cannot use it. It is a bit strange, since my test volume is only
> a few MB (512x512x109, unsigned char). It is read from raw image data and I
> can view it interactively with the VolumeRenderer. When I manipulate the
> data with a vtk only filter the same holds. The filter executes fast and I
> can view the result as volume in realtime.
>
> When I do Gaeten's labeling I get these slices. That also works quite fast.
> Now, starting tetrahedralilze makes my computer go totally out of usability.
> My 2GB RAM are maxed out in a few seconds and then the swapping begins. I
> can use my PC again when ParaView has finally crashed.
>
> Certainly I cannot work this way. So I wonder if there is an alternative.
> When I take a look at that simple filter I use (an example filter actually)
> I see that data for the output image in VTK can easily be set like that:
>
>   int numvox  = dim[0]*dim[1]*dim[2];
>   int numcomp = input->GetNumberOfScalarComponents();
>     vtkDataArray* inarray  = input->GetPointData()->GetScalars();
>   vtkDataArray* outarray = output->GetPointData()->GetScalars();
>     for (int component=0; component < numcomp; component++) {
>   for (int i=0; i < numvox; i++) {
>       unsigned char v=inarray->GetComponent(i,component);
>       if (v >= this->LowerThreshold && v<=this->UpperThreshold) {
>       outarray->SetComponent(i,component, 255);
>       } else {
>       outarray->SetComponent(i,component, 0);
>       }
>   }
>
> This is a binary image segmenation on 3d (or any) data. The result of this
> is labeled by Gaetens ITK filters.
>
> So after the ITK filtering, couldn't I just loop through the ITK image and
> write the data to the output VTK image in exactly that way? This should go
> in no time, at least the filter above executes in nearly no time with my
> (small!) volume. I'd only have to loop through the ITK volume in parallel.
> But then again this seems so brute force that I suspect this could be
> accomplished more elegantly...?
>
>
> Best regards,
> Christian
>
>
>
> Luis Ibanez wrote:
>>
>> Hi Christian,
>>
>> There is certainly overlap of some functionalities between VTK and ITK,
>> particularly at the level of basic image processing filters.
>>
>> When to use the functionalities of one toolkit or the other,
>> certainly depends on your specific application.
>>
>>
>> Regrading the volume rendering visualization in ParaView:
>>
>> The issue that you are observing is unrelated to whether the data is
>> coming from ITK or from VTK.  Instead, the problem is that ImageData
>> can't be directly volume rendered in ParaView, you must first convert
>> the image data to an unstructured mesh.
>>
>> You can easily do this with the "Tetrahedrilize" filter, from the Filters
>> menu,inside ParaView.  Then, you can go to the "Display" tab of that
>> output and select "Volume" as the "representation" mode (in the "Style"
>> frame).
>>
>>
>>    Regards,
>>
>>
>>         Luis
>>
>>
>>
>> ------------------------------------------------------------------------------------------
>> On Sun, Mar 7, 2010 at 5:09 AM, Christian Werner
>> <christian.werner at rwth-aachen.de> wrote:
>>
>>>
>>> You may remember that I am working with Paraview and write VTK plugins
>>> that
>>> use ITK filters. However I found out that many of the image processing is
>>> also available in VTK, like this median and subtraction you mentioned. It
>>> seems that VTK and ITK has some intersection here. So I will stick to the
>>> VTK version whenever possible.
>>>
>>> I had some difficulties when using ITK filters anyway: Volume data that
>>> comes back from ITK cannot be displayed as volume in VTK anymore:
>>>
>>> Cannot volume render since no point (or cell) data available.
>>>
>>> Despite everything works fine, I can only view the data in slices. This
>>> is
>>> unfortunate since I finally managed to integrate Gaetens Analysis
>>> functions,
>>> especially the RGB labeling (which requires many common Gaeten-functions)
>>> as
>>> a plugin. With my superb ImageBox that's possible for any image data by
>>> the
>>> way! :) To bad the result which I import back to VTK can only be viewed
>>> in
>>> slices.
>>>
>>> I see that this is likely more of a VTK or Paraview issue, so don't
>>> bother.
>>> Actually I asked the VTK mailing list, but it seems that they do not have
>>> a
>>> Luis Ibanez there... I will try the Paraview mailing list now.
>>>
>>>
>>> Best regards.
>>> Christian
>>>
>>>
>>>
>>> Luis Ibanez wrote:
>>>
>>>>
>>>> Hi Christian,
>>>>
>>>> You could do:
>>>>
>>>> 1) Pass the input image through the
>>>>   MeanImageFilter (with your kernel size)
>>>>
>>>> 2) Subtract the outcome of (1) from the input
>>>>   image by using the SubtractImageFilter
>>>>
>>>> 3) Threshold the output of (2) with the standard
>>>>    BinaryThreshold image filter.
>>>>
>>>>
>>>> Of course, you could also implement this filter
>>>> by merging together the code of the Mean
>>>> subtract and threshold filters (not in a pipeline,
>>>> but as a single pass filter).
>>>>
>>>> If you take this last option, it will be great if you
>>>> share the filter with the ITK community by posting
>>>> the code as a paper to the Insight Journal   :-)
>>>>
>>>>     http://www.insight-journal.org
>>>>
>>>>
>>>>  Regards,
>>>>
>>>>
>>>>       Luis
>>>>
>>>>
>>>> -------------------------------
>>>> On Fri, Mar 5, 2010 at 1:24 PM, Christian Werner
>>>> <christian.werner at rwth-aachen.de> wrote:
>>>>
>>>>
>>>>>
>>>>> Hello!
>>>>>
>>>>> I didn't get to find a dynamic threshold filter in ITK, is there such?
>>>>> It
>>>>> is
>>>>> typically used to extract pixel/voxels who's value differ about a
>>>>> certain
>>>>> threshold from the average of a neigborhood in a given distance (kernel
>>>>> size).
>>>>>
>>>>> In contrast to the simple BinaryThresholdImageFilter it catches
>>>>> elements
>>>>> that "stand out" from the neighborhood.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>>
>>>>> Best regards,
>>>>> Christian
>>>>> _____________________________________
>>>>> 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