slicer365
(HuoLeifeng)
July 17, 2023, 7:58am
1
Any script will be helpful!
pieper
(Steve Pieper (Isomics, Inc.))
July 17, 2023, 2:45pm
2
I don’t think that is exposed in python. You can have a look at the C++ code to get an idea how the ruler is calculated and what parameters are available.
vtkTextProperty* textProperty = this->RulerTextActor->GetTextProperty();
textProperty->SetFontSize(RULER_BASE_FONT_SIZE);
textProperty->SetFontFamilyToArial();
if (this->External->GetMRMLApplicationLogic())
{
this->External->GetMRMLApplicationLogic()->UseCustomFontFile(textProperty);
}
}
//---------------------------------------------------------------------------
void vtkMRMLRulerDisplayableManager::vtkInternal::UpdateRuler()
{
vtkMRMLAbstractViewNode* viewNode = vtkMRMLAbstractViewNode::SafeDownCast(this->External->GetMRMLDisplayableNode());
if (!viewNode || !viewNode->GetRulerEnabled())
{
vtkErrorWithObjectMacro(this->External, "vtkMRMLRulerDisplayableManager::UpdateMarkerOrientation() failed: view node is invalid");
this->ShowActors(false);
return;
}
if (this->External->RulerScalePresets.empty())
lassoan
(Andras Lasso)
July 17, 2023, 5:40pm
3
The ruler is short to not interfere with corner annotations. The implementation should take the corner annotations into account (only make it wide if there is space; or shift things around the avoid overlap).
1 Like
jay1987
(jiazeyu)
July 18, 2023, 3:04am
4
change to code
double rulerPreferredLengthPixel = double(viewWidthPixel)/4.0;
to
double rulerPreferredLengthPixel = double(viewWidthPixel)/1.4;
will make the ruler longer