I have 3 questions, which are somewhat of a follow-up to a previous thread I started (http://sourceforge.net/mailarchive/forum.php?thread_name=4D08F0C5.9010600%40imorphics.com&forum_name=vxl-users). I was temporarily occupied with other responsibilities, but have now returned to the problem I was having, and can't seem to find a solution. With Ian's help, I've made some progress. As mentioned in my last post, I have many types of (huge) images (e.g., 1x8, 1x16, 3x16, 4x16 not RGBA), so I start with an image resource:
vil_image_resource_sptr pResource = vil_load_image_resource(name);
Then, as Ian suggested, I use pResource->pixel_format() to determine what I will call my "native" view:
vil_image_view<vxl_uint_16> nativeView = pResource->get_view(i, ni, j, nj);
But now I need to know what the different planes are, so I can know which ones to use when I need to display the image or combine information across planes. But according to this post (http://sourceforge.net/mailarchive/message.php?msg_id=8353305), VXL can't tell me what each plane is. So my first question (1): in the three years since that post, is that still true? I know the information is in the image file header, so if VXL has a was a way to query that, I could use that. If so, please give an example. Thanks!
If not, then let's assume I can get that information from somewhere else. Question (2): how can I create a view from nativeView that looks at only the (e.g.) second plane. I tried using the vil_image_view constructor referred to in the above post:
vil_image_view<vxl_byte> singlePlaneView(nativeView.memory_chunk(), nativeView.top_left_ptr(), nativeView.ni(), nativeView.nj(), 1, nativeView.istep(), nativeView.jstep(), 2*nativeView.planestep());
But singlePlaneView.top_left_ptr() doesn't seem to point to contiguous memory corresponding to just the second plane. So I must be doing something wrong.
And question (3), if I'd like to reorder the representation in memory of (a possible subset of) the planes, say from BGRA to RGB, what do I have to do so that (e.g.) myRgbView.top_left_ptr() will point to contiguous memory? With this problem, I'm not even sure where to start, since I can't get a single plane, let alone combine them back together in arbitrary order.
Examples would be especially appreciated, as I have a difficult time figuring out what to do from the VXL reference docs alone. Thank you very much for any help!