Skip to content

Commit

Permalink
Fixed bug with >1024 pixel images and snake mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pyushkevich committed Mar 25, 2024
1 parent 5822c01 commit 5f5bb02
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions Logic/Framework/GenericImageData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ ::AddOverlay(GuidedNativeImageIO *io)
this->AddOverlayInternal(wrapper);
}

void GenericImageData::AddOverlay(ImageWrapperBase *new_layer)
{
// Additional configuration for the wrapper (normally called in CreateAnatomicImageWrapper)
for(int i = 0; i < 3; i++)
new_layer->SetDisplayViewportGeometry(i, m_DisplayViewportGeometry[i]);

this->AddOverlayInternal(new_layer, true);
}



void
GenericImageData
::AddCoregOverlay(GuidedNativeImageIO *io, ITKTransformType *transform)
Expand Down Expand Up @@ -714,6 +725,11 @@ LabelImageWrapper *GenericImageData::GetFirstSegmentationLayer()
void GenericImageData::PushBackImageWrapper(LayerRole role,
ImageWrapperBase *wrapper)
{
// TODO: this is being called in too many places, but for now this is a band-aid bug
// fix to avoid crash when the viewport geometry is not set in a wrapper
for(int i = 0; i < 3; i++)
wrapper->SetDisplayViewportGeometry(i, m_DisplayViewportGeometry[i]);

// Append the wrapper
m_Wrappers[role].push_back(wrapper);

Expand Down Expand Up @@ -777,6 +793,13 @@ void GenericImageData::SetSingleImageWrapper(LayerRole role,
ImageWrapperBase *wrapper)
{
assert(m_Wrappers[role].size() == 1);

// TODO: this is being called in too many places, but for now this is a band-aid bug
// fix to avoid crash when the viewport geometry is not set in a wrapper
for(int i = 0; i < 3; i++)
wrapper->SetDisplayViewportGeometry(i, m_DisplayViewportGeometry[i]);

// Assign the first wrapper in role
m_Wrappers[role].front() = wrapper;

// Rebroadcast the wrapper-related events as our own events
Expand Down Expand Up @@ -841,11 +864,6 @@ std::string GenericImageData::GenerateNickname(LayerRole role)
}


void GenericImageData::AddOverlay(ImageWrapperBase *new_layer)
{
this->AddOverlayInternal(new_layer, true);
}

ImageMeshLayers *
GenericImageData::GetMeshLayers()
{
Expand Down

0 comments on commit 5f5bb02

Please sign in to comment.