MCPcopy Create free account
hub / github.com/Kitware/VTK / InvertTable

Method InvertTable

Interaction/Widgets/vtkImagePlaneWidget.cxx:1205–1225  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1203
1204//------------------------------------------------------------------------------
1205void vtkImagePlaneWidget::InvertTable()
1206{
1207 int index = this->LookupTable->GetNumberOfTableValues();
1208 unsigned char swap[4];
1209 size_t num = 4 * sizeof(unsigned char);
1210 vtkUnsignedCharArray* table = this->LookupTable->GetTable();
1211 for (int count = 0; count < --index; count++)
1212 {
1213 unsigned char* rgba1 = table->GetPointer(4 * count);
1214 unsigned char* rgba2 = table->GetPointer(4 * index);
1215 memcpy(swap, rgba1, num);
1216 memcpy(rgba1, rgba2, num);
1217 memcpy(rgba2, swap, num);
1218 }
1219
1220 // force the lookuptable to update its InsertTime to avoid
1221 // rebuilding the array
1222 double temp[4];
1223 this->LookupTable->GetTableValue(0, temp);
1224 this->LookupTable->SetTableValue(0, temp);
1225}
1226
1227//------------------------------------------------------------------------------
1228void vtkImagePlaneWidget::SetWindowLevel(double window, double level, int copy)

Callers 2

WindowLevelMethod · 0.95
SetWindowLevelMethod · 0.95

Calls 4

GetTableValueMethod · 0.80
SetTableValueMethod · 0.80
GetTableMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected