[Insight-users] vector image processing
Chr. Rossmanith
cr at neuro.ma.uni-heidelberg.de
Wed Mar 31 09:58:57 EDT 2010
Hi Luis,
thank you for the code! I had to remove Statistics:: from
itkMultiplyAbsoluteVectorByScalarImageFilter.h then I could compile
without errors.
Now I'm trying to connect the output to an ImageSeriesWriter and use an
IntensityWindowingImageFilter on the scalar image in order to get
unsigned byte output for the PNG format. I'll report if I need more help
or if I have success.
Christina
Luis Ibanez schrieb:
> Hi Christina,
>
> Given that your process is so specific, it turns out to be a lot easier
> to customize a filter for doing exactly what you want, instead of
> combining existing filters.
>
> Please find attached a filter based on the BinaryFunctorImageFilter.
>
> This attached filter takes two input images. One is expected to be
> an RGB image, and the other a scalar image. The filter will compute
> the absolute values of the rgb components and will multiply them
> by the values of the scalar image (all this pixel-wise).
>
> The key part of the code is the implementation of the Functor,
> that is the class defining the operation to be performed on
> every pixel of the image:
>
>
> inline TOutput operator()( const TInput1 & A, const TInput2 & B) const
> {
> TOutput output;
> const unsigned int numberOfComponents =
> Statistics::MeasurementVectorTraits::GetLength(A);
> for( unsigned int cc = 0; cc < numberOfComponents; cc++ )
> {
> output[cc] = (A[cc] > 0) ? A[cc] : -A[cc];
> output[cc] *= B;
> }
> return output;
> }
>
>
> The entire filter is defined in a single header file,
> given that the rest of functionalities are inherited
> from the base class.
>
>
> They include:
>
> * Support for multi-threading and
> * Support for streaming.
>
> You will also find attached a test for running
> the filter (along with a CMakeLists.txt for
> configuring their build).
>
>
> For more details on how to write new ITK filters
> you may want to look at the Tutorial:
>
> http://www.na-mic.org/Wiki/images/b/bc/Insight-Writing-a-New-Filter.ppt
>
>
> Please give it a try at the attached code and let
> us know if you have any questions.
>
>
> Thanks
>
>
> Luis
>
>
> --------------------------------------------------------------------------------
> On Fri, Mar 12, 2010 at 4:54 AM, Chr. Rossmanith
> <cr at neuro.ma.uni-heidelberg.de> wrote:
>
>> Hi,
>>
>> I'd like to do a componentwise abs() of a vector valued image volume and
>> multiply it with a scalar image and save the result as 2D RGB images. I'm
>> unsure about the best way to do this.
>>
>> What I've done so far:
>>
>> read scalar image using ImageFileReader
>> read vector image using ImageFileReader
>> use VectorIndexSelectionCastImageFilter to extract each of the three
>> components
>> use AbsImageFilter on the components
>> use MultiplyImageFilter on that result and the scalar image
>> use ImageToVectorImageFilter to arrange the the scalar results into a vector
>>
>> At this stage there rises a big '?'. How do I switch from vector to rgb?
>>
>> The last steps are:
>>
>> NumericSeriesFileNames for file name creation
>> ImageSeriesWriter to create PNGs
>>
>> My first idea was to use a VectorToRGBImageAdaptor but then I've read that
>> it's not possible to connect an adaptor to an image writer.
>>
>> Any hint is welcome.
>>
>> Thank you,
>> Christina Rossmanith
>> _____________________________________
>> 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