Re: [osg-users] osgvolume brightness and sample density
Hi Clement, On 8 May 2012 08:44, clement@csiro.au wrote: Thanks for your help. The colour map in the osgvolume.cpp example contains specific colour. I would like to implement full range of colours as possible supported by osg. Any idea what I can do to create a colour map of full range colours. Thanks. I don't know what you actually mean by a colour map of full range colours, so can't answer your question. What are you intending here, to map the intensity values from the 3d image data to a specific colour, which is what the TransferFunction1D is for, or from colour to colour which is rather more open ended. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Robert, I would like to know how to generate colour map. Except rgb, the alpha is very important, so each colour I would like to use much alpha. If there is 1 colour, I can do like this. osg::TransferFunction1D::ColorMap colorMap; for (int i=0; i255; i++) colorMap[i] = osg::Vec4((float)r/255, (float)g/255, (float)b/255, (float)i/255); If the colour are more than 10, what the colour map looks like? Currently, I am using osgVolume without created colour map, but I believe there is somewhere defined the colour map. Do you know where I can find the code? Thanks again. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Monday, 14 May 2012 9:07 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, On 8 May 2012 08:44, clement@csiro.au wrote: Thanks for your help. The colour map in the osgvolume.cpp example contains specific colour. I would like to implement full range of colours as possible supported by osg. Any idea what I can do to create a colour map of full range colours. Thanks. I don't know what you actually mean by a colour map of full range colours, so can't answer your question. What are you intending here, to map the intensity values from the 3d image data to a specific colour, which is what the TransferFunction1D is for, or from colour to colour which is rather more open ended. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Clement, This really isn't an OSG question, or at least answering isn't an OSG question, it's really one of how to teach you how to program. You have a for loop with a constant r,g,b value and varying i value and you are stuck on how to vary r,g,b. How about using arrays for them? There are so many ways you can do but only YOU can answer how you want to provide the colours and how you want to map them. This type of problem really is a pretty basic programming issue that isn't anything todo with the OSG, and something I would have expect most engineers to know how to do quite early in their careers. I have to ask are you new to programming? It might be we that can suggest some general background reading to help you on your way. Robert. On 14 May 2012 14:00, clement@csiro.au wrote: Hi Robert, I would like to know how to generate colour map. Except rgb, the alpha is very important, so each colour I would like to use much alpha. If there is 1 colour, I can do like this. osg::TransferFunction1D::ColorMap colorMap; for (int i=0; i255; i++) colorMap[i] = osg::Vec4((float)r/255, (float)g/255, (float)b/255, (float)i/255); If the colour are more than 10, what the colour map looks like? Currently, I am using osgVolume without created colour map, but I believe there is somewhere defined the colour map. Do you know where I can find the code? Thanks again. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Monday, 14 May 2012 9:07 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, On 8 May 2012 08:44, clement@csiro.au wrote: Thanks for your help. The colour map in the osgvolume.cpp example contains specific colour. I would like to implement full range of colours as possible supported by osg. Any idea what I can do to create a colour map of full range colours. Thanks. I don't know what you actually mean by a colour map of full range colours, so can't answer your question. What are you intending here, to map the intensity values from the 3d image data to a specific colour, which is what the TransferFunction1D is for, or from colour to colour which is rather more open ended. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Robert, I am not new in programming but I am new in doing 3D work. I tried to generate a hugh colour map as 65535 colours and assign into osg::TransferFunction1D::ColorMap, but the colour display is not much better than I don't create colour map. I am thinking how osg to generate default colour map. Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Monday, 14 May 2012 11:22 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, This really isn't an OSG question, or at least answering isn't an OSG question, it's really one of how to teach you how to program. You have a for loop with a constant r,g,b value and varying i value and you are stuck on how to vary r,g,b. How about using arrays for them? There are so many ways you can do but only YOU can answer how you want to provide the colours and how you want to map them. This type of problem really is a pretty basic programming issue that isn't anything todo with the OSG, and something I would have expect most engineers to know how to do quite early in their careers. I have to ask are you new to programming? It might be we that can suggest some general background reading to help you on your way. Robert. On 14 May 2012 14:00, clement@csiro.au wrote: Hi Robert, I would like to know how to generate colour map. Except rgb, the alpha is very important, so each colour I would like to use much alpha. If there is 1 colour, I can do like this. osg::TransferFunction1D::ColorMap colorMap; for (int i=0; i255; i++) colorMap[i] = osg::Vec4((float)r/255, (float)g/255, (float)b/255, (float)i/255); If the colour are more than 10, what the colour map looks like? Currently, I am using osgVolume without created colour map, but I believe there is somewhere defined the colour map. Do you know where I can find the code? Thanks again. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Monday, 14 May 2012 9:07 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, On 8 May 2012 08:44, clement@csiro.au wrote: Thanks for your help. The colour map in the osgvolume.cpp example contains specific colour. I would like to implement full range of colours as possible supported by osg. Any idea what I can do to create a colour map of full range colours. Thanks. I don't know what you actually mean by a colour map of full range colours, so can't answer your question. What are you intending here, to map the intensity values from the 3d image data to a specific colour, which is what the TransferFunction1D is for, or from colour to colour which is rather more open ended. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Clement, On 14 May 2012 17:47, clement@csiro.au wrote: I am not new in programming but I am new in doing 3D work. I tried to generate a hugh colour map as 65535 colours and assign into osg::TransferFunction1D::ColorMap, but the colour display is not much better than I don't create colour map. I am thinking how osg to generate default colour map. I can't understand why you'd want to create a 65535 colour map for volume rendering. For volume rendering you typically either have intensity data that you want to map to greyscale or a RGBA colour using a transfer function, or you directly use RGBA. When mapping intensity data to RGBA you should never need a 655535 colour map. The fact you are trying suggests you a confused about how you want to achieve something, but unless you say what you are actually wanting to achieve rather than saying how you trying to achieve something unspecified, and trying to achieve it what looks to be a inappropriate way. Might I suggest you spend some time doing some background reading on OpenGL, volume rendering techniques like ray casting. You can't really expect the community to teach you how to program 3D graphics as well as the OSG API - this community is focused on the OSG API and what to do with it, we can help a bit with general learning but there is limit to how much time we can spend teach people the basics. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Robert, Thanks for your help. The colour map in the osgvolume.cpp example contains specific colour. I would like to implement full range of colours as possible supported by osg. Any idea what I can do to create a colour map of full range colours. Thanks. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Saturday, 5 May 2012 5:01 AM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density HI Clement, On 4 May 2012 19:30, clement@csiro.au wrote: Thanks again for your reply. I am a bit confused on using color map. I would like my program to support at least 8 bit color, so how should I create the color map? Where can I find more information? osgvolume.cpp does not have much details related to color map. You just assign colours to the TransferFunction1D. Go have a look at the API, the osgvolume.cpp provides code that does it. This stuff should be realtively straightforward to infer from the code you have in front of you. If you are struggling then perhaps it's time you went back to basics a bit more w.r.t OpenGL and C++ as none of this is particular advanced. I'm happy to point you in the right direction, but it's really not my place to teach you how to program computer graphics applications. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Robert, Sorry, I just saw your reply. Is TransferFunctionProperty used for defined colour map? osg::ref_ptrosg::TransferFunction1D transferFunction = new osg::TransferFunction1D; transferFunction-setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); transferFunction-setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); transferFunction-setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); transferFunction-assign(transferFunction-getColorMap()); osg::ref_ptrosgVolume::TransferFunctionProperty tfp = new osgVolume::TransferFunctionProperty(transferFunction.get()); osg::ref_ptrosgVolume::CompositeProperty cp = new osgVolume::CompositeProperty; layer-addProperty(cp.get()); cp-addProperty(tfp.get()); If I don't use TransferFunctionProperty, I guess osg will use default colour map. Then I no need to create another colour map. Is that correct? For example, the size of my volume cube is 100 * 100 * 50. If I show the first layer (100 * 100 * 1), the colour from the back view is more brightness than from the front view. I am not understand why it is related to TransferFunctionProperty. The colour brightness is affected by adjusting the SampleDensityProperty value. I have more question about performance. If the image is showed the first layer, the performance is the same as showing all layers (100 * 100 * 50). Is any possible way to increase the rendering speeding when only first layer is shown? Many thanks. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Wednesday, 25 April 2012 2:30 AM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, You simply need to attach a TransferFunctionProperty to the Layer assigned VolumeTile and set up this to map floating point intensity value to the colour/alpha value required. The osgvolume has example of it's setup. Robert. On 12 April 2012 03:52, clement@csiro.au wrote: Hi, I am using osgVolume to display my CT data. If I set the value of SampleDensityProperty lower, I can get more details, but the brightness will become darker or dull. Does any method that allow to use smaller value of SampleDensityProperty and keep image colour brighter. I tried to use LightingProperty, but I don't know why I got an error to have this property. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Clement, On 4 May 2012 08:46, clement@csiro.au wrote: Hi Robert, Sorry, I just saw your reply. Is TransferFunctionProperty used for defined colour map? osg::ref_ptrosg::TransferFunction1D transferFunction = new osg::TransferFunction1D; transferFunction-setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); transferFunction-setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); transferFunction-setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); transferFunction-assign(transferFunction-getColorMap()); osg::ref_ptrosgVolume::TransferFunctionProperty tfp = new osgVolume::TransferFunctionProperty(transferFunction.get()); osg::ref_ptrosgVolume::CompositeProperty cp = new osgVolume::CompositeProperty; layer-addProperty(cp.get()); cp-addProperty(tfp.get()); If I don't use TransferFunctionProperty, I guess osg will use default colour map. Then I no need to create another colour map. Is that correct? If you don't use a TransferFunctionProperty then the intensity or colours coming from the Texture3D (sourced from the osgVolume::ImageLayer) will be used directly, there isn't any default colour map. For example, the size of my volume cube is 100 * 100 * 50. If I show the first layer (100 * 100 * 1), the colour from the back view is more brightness than from the front view. I am not understand why it is related to TransferFunctionProperty. The colour brightness is affected by adjusting the SampleDensityProperty value. If your data is undersampled then it won't be as bright as it would be if the ray casting take sufficient samples to properly map your volume. I have more question about performance. If the image is showed the first layer, the performance is the same as showing all layers (100 * 100 * 50). Is any possible way to increase the rendering speeding when only first layer is shown? Many thanks. When you say layer, do you simply mean a slice of an 3D osg:Image? In osgVolume the Layer class represent as whole 3D image. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Robert, Thanks again for your reply. I am a bit confused on using color map. I would like my program to support at least 8 bit color, so how should I create the color map? Where can I find more information? osgvolume.cpp does not have much details related to color map. All layers are undersampled. I think I need to adjust the sample density if only first layer display. Regards, Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Friday, 4 May 2012 7:09 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgvolume brightness and sample density Hi Clement, On 4 May 2012 08:46, clement@csiro.au wrote: Hi Robert, Sorry, I just saw your reply. Is TransferFunctionProperty used for defined colour map? osg::ref_ptrosg::TransferFunction1D transferFunction = new osg::TransferFunction1D; transferFunction-setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); transferFunction-setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); transferFunction-setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); transferFunction-assign(transferFunction-getColorMap()); osg::ref_ptrosgVolume::TransferFunctionProperty tfp = new osgVolume::TransferFunctionProperty(transferFunction.get()); osg::ref_ptrosgVolume::CompositeProperty cp = new osgVolume::CompositeProperty; layer-addProperty(cp.get()); cp-addProperty(tfp.get()); If I don't use TransferFunctionProperty, I guess osg will use default colour map. Then I no need to create another colour map. Is that correct? If you don't use a TransferFunctionProperty then the intensity or colours coming from the Texture3D (sourced from the osgVolume::ImageLayer) will be used directly, there isn't any default colour map. For example, the size of my volume cube is 100 * 100 * 50. If I show the first layer (100 * 100 * 1), the colour from the back view is more brightness than from the front view. I am not understand why it is related to TransferFunctionProperty. The colour brightness is affected by adjusting the SampleDensityProperty value. If your data is undersampled then it won't be as bright as it would be if the ray casting take sufficient samples to properly map your volume. I have more question about performance. If the image is showed the first layer, the performance is the same as showing all layers (100 * 100 * 50). Is any possible way to increase the rendering speeding when only first layer is shown? Many thanks. When you say layer, do you simply mean a slice of an 3D osg:Image? In osgVolume the Layer class represent as whole 3D image. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
HI Clement, On 4 May 2012 19:30, clement@csiro.au wrote: Thanks again for your reply. I am a bit confused on using color map. I would like my program to support at least 8 bit color, so how should I create the color map? Where can I find more information? osgvolume.cpp does not have much details related to color map. You just assign colours to the TransferFunction1D. Go have a look at the API, the osgvolume.cpp provides code that does it. This stuff should be realtively straightforward to infer from the code you have in front of you. If you are struggling then perhaps it's time you went back to basics a bit more w.r.t OpenGL and C++ as none of this is particular advanced. I'm happy to point you in the right direction, but it's really not my place to teach you how to program computer graphics applications. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgvolume brightness and sample density
Hi Clement, You simply need to attach a TransferFunctionProperty to the Layer assigned VolumeTile and set up this to map floating point intensity value to the colour/alpha value required. The osgvolume has example of it's setup. Robert. On 12 April 2012 03:52, clement@csiro.au wrote: Hi, I am using osgVolume to display my CT data. If I set the value of SampleDensityProperty lower, I can get more details, but the brightness will become darker or dull. Does any method that allow to use smaller value of SampleDensityProperty and keep image colour brighter. I tried to use LightingProperty, but I don't know why I got an error to have this property. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgvolume brightness and sample density
Hi, I am using osgVolume to display my CT data. If I set the value of SampleDensityProperty lower, I can get more details, but the brightness will become darker or dull. Does any method that allow to use smaller value of SampleDensityProperty and keep image colour brighter. I tried to use LightingProperty, but I don't know why I got an error to have this property. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org