vtkLookupTable crashes in release mode. VTK8.1.1

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

vtkLookupTable crashes in release mode. VTK8.1.1

Vipul Pai Raikar
This post was updated on .
Hi,

I am having issues creating a vtkLookupTable. I am encountering a peculiar
issue with lookup tables when in release mode. Whenever I am trying to
SetHueRange (or SaturationRange or ValueRange) I run into an access
violation. But this works as expected in debug mode. Any one run into the
same issue? Any help will be greatly appreciated.

Example Code:
  vtkSmartPointer<vtkLookupTable> bwLut =
vtkSmartPointer<vtkLookupTable>::New();
  bwLut->SetHueRange (0, 0);
  bwLut->SetSaturationRange (0, 0);
  bwLut->SetValueRange (0, 1);
  bwLut->Build();
  bwLut->SetTableRange (0, 255);


EDIT: Forgot to add, using vtkColorTransferFunction is an alternative approach which gives desired results. But I am curious as to why this is an issue with the lookup table.


--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Andras Lasso
Order of operations matter. This works well:

https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Core/vtkMRMLColorTableNode.cxx#L642-L648

Andras

-----Original Message-----
From: vtkusers <[hidden email]> On Behalf Of Vipul Pai Raikar
Sent: Tuesday, September 25, 2018 2:47 PM
To: [hidden email]
Subject: [vtkusers] vtkLookupTable crashes in release mode. VTK8.1.1

Hi,

I am having issues creating a vtkLookupTable. I am encountering a peculiar issue with lookup tables when in release mode. Whenever I am trying to SetHueRange (or SaturationRange or ValueRange) I run into an access violation. But this works as expected in debug mode. Any one run into the same issue? Any help will be greatly appreciated.

Example Code:
  vtkSmartPointer<vtkLookupTable> bwLut = vtkSmartPointer<vtkLookupTable>::New();
  bwLut->SetHueRange (0, 0);
  bwLut->SetSaturationRange (0, 0);
  bwLut->SetValueRange (0, 1);
  bwLut->Build();
  bwLut->SetTableRange (0, 255);



--
Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=vh%2BAIob8RcPNFIKqTXxPFrWag5tpIs%2Fi%2Fv4e7crlL8Y%3D&amp;reserved=0
_______________________________________________
Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=ydqBqIoi0brPwFm2PtZQmxCPsTXBsv62sM3COKW1yzM%3D&amp;reserved=0

Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=Ng7pZ6ohz1J1NkeEVA4tx9sQoIVUZ0ttK9OgYTUstTg%3D&amp;reserved=0

Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=E4utitZcoGaEhPhYmhSgdfz4pyzvAvQbU2dbgfuhXKo%3D&amp;reserved=0

Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=cOg%2FcimwE8fI0HtxljpU8WENsrfRVQy%2FcSs89bPPejo%3D&amp;reserved=0

Follow this link to subscribe/unsubscribe:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7Cfc2fc98579cf487ee08108d623173bf8%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636734980033059634&amp;sdata=TD6xZu3x2nzYtumVwHzxvP92UzqU1DmihzJVS8pfLXA%3D&amp;reserved=0
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Vipul Pai Raikar
Hi Andras,

Thanks for your quick response and suggestion. I tried to change the order
as you pointed out and I am having the same issue in release mode.

  vtkLookupTable *bwLut = vtkLookupTable::New();
  bwLut->SetRampToLinear();
  bwLut->SetTableRange (0, 255);
  bwLut->SetHueRange (0, 0);
  bwLut->SetSaturationRange (0, 0);
  bwLut->SetValueRange (0, 1);
  bwLut->Build();

Exception: 0xC0000005: Access violation writing location 0x00007FF88A593298

Vipul




--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Bill Lorensen
In reply to this post by Vipul Pai Raikar
SetTableRange before Build() 

On Tue, Sep 25, 2018, 11:46 AM Vipul Pai Raikar <[hidden email]> wrote:
Hi,

I am having issues creating a vtkLookupTable. I am encountering a peculiar
issue with lookup tables when in release mode. Whenever I am trying to
SetHueRange (or SaturationRange or ValueRange) I run into an access
violation. But this works as expected in debug mode. Any one run into the
same issue? Any help will be greatly appreciated.

Example Code:
  vtkSmartPointer<vtkLookupTable> bwLut =
vtkSmartPointer<vtkLookupTable>::New();
  bwLut->SetHueRange (0, 0);
  bwLut->SetSaturationRange (0, 0);
  bwLut->SetValueRange (0, 1);
  bwLut->Build();
  bwLut->SetTableRange (0, 255);



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Vipul Pai Raikar
Hi Bill,

I did set it before the build call, still the same issue.

Vipul



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

andyjk
This post was updated on .
Hi

This appears to be the same issue as I was having here:
http://vtk.1045678.n5.nabble.com/Reverse-color-in-vtkScalarsToColors-tp5741412.html

As a minimal example:

vtkSmartPointer<vtkLookupTable> myTable =
vtkSmartPointer<vtkLookupTable>::New();
                myTable->SetRange(0,100);
                //myTable->SetHueRange(0.667, 0); // CRASH! Unless in relwithdebug
                myTable->Build();

It doesn't matter what order you put things. In release mode VTK 8.1.1 will
crash with the above example if you uncomment the SetHueRange. It will run
fine in ReleaseWithDebugInfo mode.

From the other thread, it seems that VTK internally must not be explicitly
setting some variable to '0' (whereas in RelWithDebug the compiler does this
for us).

So I think this is a VTK logical 'bug' in vtkLookUpTable or one of its
subclasses, where a member variable is not explicitly set?

Andy

EDIT: You mentioned that vtkColorTransferFunction works well - do you have a minimal code example. I want to try and reverse the default colour mapping table in VTK 8.1.1 and am happy to use a different method if vtkLookUpTable is not suitable!


--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Vipul Pai Raikar
Hi Andy,

Here is the minimum code that works well in setting up a gray colormap.

vtkSmartPointer<vtkColorTransferFunction> colorTxFn=
    vtkSmartPointer<vtkColorTransferFunction>::New();
  for (auto i = 0; i < 256; ++i) {
    // colorTxFn->AddRGBPoint(i, i/255.0,i/255.0,i/255.0);
    colorTxFn->AddHSVPoint(i, 0, 0, i / 255.0);
  }
  colorTxFn->SetAlpha(1);

HTH

Vipul



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtkLookupTable crashes in release mode. VTK8.1.1

Vipul Pai Raikar
In reply to this post by andyjk
Also, I am curious to know as to what the issue is, but haven't investigated
further. Like Andras suggests in the other thread, maybe trying to use
Appverifier tool could shed some light. I have not used it before and will
try this when I have a little more time.

V



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

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

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers