Quantcast

Image filter to remap labels to new values

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Image filter to remap labels to new values

David Gobbi
Hi All,

I'm planning to add a new image filter to VTK, and will name it something like vtkImageMapThroughLUT.  The operation of this filter will be as follows:

- It will take, as input, any image that uses an integer scalar type
- The scalars will be mapped though a lookup table to generate the output image

For the "lookup table" or (LUT), I was planning to use a plain-old vtkDataArray.  I cannot use vtkLookupTable as the LUT, since vtkLookupTable can only produce "unsigned char" output and is meant to be used for generating color data.

My question to the list is as follows: is vtkDataArray the best object to use for storing such a LUT?

Also, is there already a class in the VTK geometry pipeline that allows labels to be remapped to new label values via a LUT?

 - David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Thompson-2
Hi David,

> ...I'm planning to add a new image filter to VTK, and will name it something like vtkImageMapThroughLUT.  The operation of this filter will be as follows:
>
> - It will take, as input, any image that uses an integer scalar type
> - The scalars will be mapped though a lookup table to generate the output image
>
> For the "lookup table" or (LUT), I was planning to use a plain-old vtkDataArray.  I cannot use vtkLookupTable as the LUT, since vtkLookupTable can only produce "unsigned char" output and is meant to be used for generating color data.
>
> My question to the list is as follows: is vtkDataArray the best object to use for storing such a LUT?

You might consider vtkPiecewiseFunction (in Common/DataModel).

> Also, is there already a class in the VTK geometry pipeline that allows labels to be remapped to new label values via a LUT?

I don't know of any; what format are the labels in?

        David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Gobbi
On Wed, Mar 29, 2017 at 10:42 AM, David Thompson <[hidden email]> wrote:
Hi David,

> ...I'm planning to add a new image filter to VTK, and will name it something like vtkImageMapThroughLUT.  The operation of this filter will be as follows:
>
> - It will take, as input, any image that uses an integer scalar type
> - The scalars will be mapped though a lookup table to generate the output image
>
> For the "lookup table" or (LUT), I was planning to use a plain-old vtkDataArray.  I cannot use vtkLookupTable as the LUT, since vtkLookupTable can only produce "unsigned char" output and is meant to be used for generating color data.
>
> My question to the list is as follows: is vtkDataArray the best object to use for storing such a LUT?

You might consider vtkPiecewiseFunction (in Common/DataModel).

> Also, is there already a class in the VTK geometry pipeline that allows labels to be remapped to new label values via a LUT?

I don't know of any; what format are the labels in?

The "labels", in this case, are just scalar values.  The use case is images that represent brain segmentations, where a pixel value of "0" represents nothing, a pixel value of "1" represents one particular region of the brain, a pixel value of "2" represents a different region of the brain, etc.  Such images are commonly used in neuroscience imaging research, and are often called "label images" or, depending on their use, "atlas images".

So we're talking about simply mapping integer scalar values through a LUT, to get a new set of integer scalar values.

 - David


 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Gobbi
On Wed, Mar 29, 2017 at 10:53 AM, David Gobbi <[hidden email]> wrote:
On Wed, Mar 29, 2017 at 10:42 AM, David Thompson <[hidden email]> wrote:
Hi David,

> ...I'm planning to add a new image filter to VTK, and will name it something like vtkImageMapThroughLUT.  The operation of this filter will be as follows:
>
> - It will take, as input, any image that uses an integer scalar type
> - The scalars will be mapped though a lookup table to generate the output image
>
> For the "lookup table" or (LUT), I was planning to use a plain-old vtkDataArray.  I cannot use vtkLookupTable as the LUT, since vtkLookupTable can only produce "unsigned char" output and is meant to be used for generating color data.
>
> My question to the list is as follows: is vtkDataArray the best object to use for storing such a LUT?

You might consider vtkPiecewiseFunction (in Common/DataModel).

> Also, is there already a class in the VTK geometry pipeline that allows labels to be remapped to new label values via a LUT?

I don't know of any; what format are the labels in?

The "labels", in this case, are just scalar values.  The use case is images that represent brain segmentations, where a pixel value of "0" represents nothing, a pixel value of "1" represents one particular region of the brain, a pixel value of "2" represents a different region of the brain, etc.  Such images are commonly used in neuroscience imaging research, and are often called "label images" or, depending on their use, "atlas images".

So we're talking about simply mapping integer scalar values through a LUT, to get a new set of integer scalar values.

To put it another way, the labels that I'm referring to are categorical values, where all voxels with value "n" belong to "category n".

 - David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Thompson-2
In reply to this post by David Gobbi
Hi David,

> ... The "labels", in this case, are just scalar values.  The use case is images that represent brain segmentations, where a pixel value of "0" represents nothing, a pixel value of "1" represents one particular region of the brain, a pixel value of "2" represents a different region of the brain, etc.  Such images are commonly used in neuroscience imaging research, and are often called "label images" or, depending on their use, "atlas images".
>
> So we're talking about simply mapping integer scalar values through a LUT, to get a new set of integer scalar values.

Then I don't see vtkPiecewiseFunction or anything else doing anything you need; a vtkDataArray is probably best, although it might be nice to have a new vtkDataObject subclass (vtkScalarMap?) that takes the table and sorts it so lookups are O(log(N)) instead of O(N). That's not a whole lot of code, though, so I can also see just making it part of vtkImageMapThroughLUT.

        David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Thompson-2
In reply to this post by David Gobbi
Hi David,

> ...
> To put it another way, the labels that I'm referring to are categorical values, where all voxels with value "n" belong to "category n".

Yup. All the categorical colormap stuff uses vtkVariant (not fast) to accommodate strings as categories. I would not use it for this.

        David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image filter to remap labels to new values

David Gobbi
In reply to this post by David Thompson-2
On Wed, Mar 29, 2017 at 11:01 AM, David Thompson <[hidden email]> wrote:

Then I don't see vtkPiecewiseFunction or anything else doing anything you need; a vtkDataArray is probably best, although it might be nice to have a new vtkDataObject subclass (vtkScalarMap?) that takes the table and sorts it so lookups are O(log(N)) instead of O(N). That's not a whole lot of code, though, so I can also see just making it part of vtkImageMapThroughLUT.

The kind of lookups I'm thinking of are O(1), i.e. output = LUT[input].

 - David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Loading...