[vtkusers] reading a bmp file into a lookup table

Steve Chall stevec at renci.org
Fri Jun 8 09:40:43 EDT 2007


Ah, yes, Update().  And worse yet, there it is on page 24.  I apologize for
bothering you with this.  Thank you.

-Steve

-----Original Message-----
From: Amy Squillacote [mailto:amy.squillacote at kitware.com] 
Sent: Friday, June 08, 2007 7:46 AM
To: Steve Chall
Cc: vtkusers at vtk.org; theresa-marie at renci.org
Subject: Re: [vtkusers] reading a bmp file into a lookup table



Steve Chall wrote:
>
> Dear fellow vtk fans:
>
> I'm trying to read a 255x1 24-bit bitmap and convert it into a lookup 
> table so I don't have to manually input 255 rgb values.
>
> vtkLookupTable *lut = vtkLookupTable::New; // or no ::New(): doesn't 
> seem to matter
>
> vtkBMPReader *bmpReader = vtkBMPReader::New();
>
> char bmpFileName[] = "topo-bathy255x1.bmp";
>
> bmpReader->SetFileName(bmpFileName);
>
> lut = bmpReader->GetLookupTable();
>
> //lut->Build(); // ????????
>
> This doesn't do it, because nothing is forcing the reader to execute 
> reading the file. I could write a subclass of vtkBMPReader and call 
> the parent class's protected Execute() method in a public function, 
> but that's at best a kludge. When I look at lut, it's got its default 
> 256-element size and all the r, g, and b values are 0. How can I force 
> a read?
>
Try calling Update() on the reader. Calling Update() on any source, 
reader, or filter will force it to execute.

- Amy

> The more general question is: why are we restricted to employing this 
> lazy evaluation approach? What are the drawbacks to providing a public 
> ReadFile() method for vtkBMPReader (as a specific example)? Thanks, 
> both for helping me to see what may be an obvious solution to my 
> immediate problem, and for helping me to understand the underlying 
> rationale.
>
> -Steve
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
Amy Squillacote
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
Phone: (518) 371-3971 x106





More information about the vtkusers mailing list