Beispiel #1
0
void rtEPDataObject::maxSliceChanged(int val) {

  if (val == m_optionsWidget.maxSliceSlider->minimum()) {
    m_optionsWidget.maxSliceSlider->setValue(val+1);
    return;
  }

  m_optionsWidget.maxSliceLabel->setText(QString::number(val));
  if (m_optionsWidget.minSliceSlider->value() >= val)
    m_optionsWidget.minSliceSlider->setValue(val-1);

  setModifyFlagForAll();
  Modified();
}
Beispiel #2
0
void mitk::VtkPropRenderer::InitSize(int w, int h)
{
  m_RenderWindow->SetSize(w,h);
  Superclass::InitSize(w, h);
  Modified();
  Update();
  if(m_VtkRenderer!=NULL)
  {
    int w=vtkObject::GetGlobalWarningDisplay();
    vtkObject::GlobalWarningDisplayOff();
    m_VtkRenderer->ResetCamera();
    vtkObject::SetGlobalWarningDisplay(w);
  }
}
Beispiel #3
0
bool LayerSurface::LoadVectorFromFile( )
{
  if ( m_sVectorFilename.size() == 0 || !m_surfaceSource->MRISReadVectors( m_sVectorFilename ) )
  {
    return false;
  }

  UpdateVectorActor2D();
  emit Modified();
  emit SurfaceVectorLoaded();
  emit ActorUpdated();

  return true;
}
Beispiel #4
0
bool rtEPDataObject::setTransform(vtkTransform* t) {
  if (!t) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("The new transform t is NULL."));
    return false;
  }
  if (!m_objTransform) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("The object transform m_objTransform is NULL."));
    return false;
  }

  m_objTransform->DeepCopy(t);
  Modified();
  return true;
}
void mitk::PlanesPerpendicularToLinesFilter::SetPlane(const mitk::PlaneGeometry* aPlane)
{
  if(aPlane!=NULL)
  {
    m_Plane = static_cast<mitk::PlaneGeometry*>(aPlane->Clone().GetPointer());
  }
  else
  {
    if(m_Plane.IsNull())
      return;
    m_Plane=NULL;
  }
  Modified();
}
Beispiel #6
0
void cStructLoader::DelItem(cStructItem *d, bool keep)
{
  if(d) {
    d->Delete();
    if(keep) {
      cStructItem *n=new cCommentItem;
      n->SetComment(cString::sprintf(";%s%s",*d->ToString(false),d->Comment()?d->Comment():""));
      ListLock(true);
      Add(n,d);
      ListUnlock();
      }
    Modified();
    }
}
Beispiel #7
0
void mitk::BaseData::ConnectSource(itk::ProcessObject *arg, unsigned int idx) const
{
#ifdef MITK_WEAKPOINTER_PROBLEM_WORKAROUND_ENABLED
  itkDebugMacro( "connecting source  " << arg
    << ", source output index " << idx);

  if ( GetSource().GetPointer() != arg || m_SourceOutputIndexDuplicate != idx)
  {
    m_SmartSourcePointer = dynamic_cast<mitk::BaseProcess*>(arg);
    m_SourceOutputIndexDuplicate = idx;
    Modified();
  }
#endif
}
Beispiel #8
0
//________________________________________________________________
void KVCanvas::DynamicZoom(Int_t Sign, Int_t px, Int_t py)
{
   // Zoom in or out of histogram with mouse wheel

   //    Info("DynamicZoom","px=%d py=%d",px,py);

   if (!fSelected) return;
   TH2* TheHisto = (TH2*) FindHisto();//fSelected;

   Double_t percent = 0.15 - Sign * 0.05;

   Int_t dX = 0;
   Int_t dY = 0;

   Double_t ppx = AbsPixeltoX(px);
   Double_t ppy = AbsPixeltoY(py);

   TAxis* ax = TheHisto->GetXaxis();
   Int_t NbinsXtmp = ax->GetNbins();
   Int_t X0tmp = ax->GetFirst();
   Int_t X1tmp = ax->GetLast();
   Int_t step = TMath::Min(TMath::Max(1, (Int_t)(percent * (X1tmp - X0tmp))), NbinsXtmp / 2);
   step *= Sign;
   X0tmp = TMath::Min(TMath::Max(X0tmp + step, 1), X1tmp - step);
   X1tmp = TMath::Max(TMath::Min(X1tmp - step, NbinsXtmp), X0tmp);
   if (X0tmp >= X1tmp) X0tmp = X1tmp - 1;
   if (Sign > 0) dX = (Int_t)(X0tmp + (X1tmp - X0tmp) * 0.5 - ax->FindBin(ppx));
   if ((X0tmp - dX) < 0) ax->SetRange(0, X1tmp - X0tmp);
   else if ((X1tmp - dX) > ax->GetNbins()) ax->SetRange(ax->GetNbins() - (X1tmp - X0tmp), ax->GetNbins());
   else ax->SetRange(X0tmp - dX, X1tmp - dX);

   ax = TheHisto->GetYaxis();
   Int_t NbinsYtmp = ax->GetNbins();
   Int_t Y0tmp = ax->GetFirst();
   Int_t Y1tmp = ax->GetLast();
   step = TMath::Min(TMath::Max(1, (Int_t)(percent * (Y1tmp - Y0tmp))), NbinsYtmp / 2);
   step *= Sign;
   Y0tmp = TMath::Min(TMath::Max(Y0tmp + step, 1), Y1tmp - step);
   Y1tmp = TMath::Max(TMath::Min(Y1tmp - step, NbinsYtmp), Y0tmp);
   if (Y0tmp >= Y1tmp) Y0tmp = Y1tmp - 1;
   if (Sign > 0) dY = (Int_t)(Y0tmp + (Y1tmp - Y0tmp) * 0.5 - ax->FindBin(ppy));
   if ((Y0tmp - dY) < 0) ax->SetRange(0, Y1tmp - Y0tmp);
   else if ((Y1tmp - dY) > ax->GetNbins()) ax->SetRange(ax->GetNbins() - (Y1tmp - Y0tmp), ax->GetNbins());
   else ax->SetRange(Y0tmp - dY, Y1tmp - dY);

   Modified();
   Update();
   return;
}
Beispiel #9
0
void rtEPDataObject::triggerChanged(int trig) {
  QList<int> k = m_phaseDataList.keys();
  QList<PhaseData> v = m_phaseDataList.values();

  int dist = abs(trig-v[0].triggerDelay);
  int phase = k[0];
  for (int ix1=1; ix1<v.size(); ix1++) {
    if (abs(trig-v[ix1].triggerDelay) < dist) {
      dist = abs(trig-v[ix1].triggerDelay);
      phase = k[ix1];
    }
  }
  setCurrPhase(phase);
  Modified();
}
Beispiel #10
0
void
DataFieldEnum::Dec()
{
    if (entries.empty()) {
        assert(value == 0);
        return;
    }

    assert(value < entries.size());

    if (value > 0) {
        value--;
        Modified();
    }
}
Beispiel #11
0
void
DataFieldEnum::Inc()
{
    if (entries.empty()) {
        assert(value == 0);
        return;
    }

    assert(value < entries.size());

    if (value < entries.size() - 1) {
        value++;
        Modified();
    }
}
Beispiel #12
0
/**
 * Consider the list as changed when any of the properties has changed recently.
 */
unsigned long mitk::PropertyList::GetMTime() const
{
  for (auto it = m_Properties.cbegin(); it != m_Properties.cend(); ++it)
  {
    if (it->second.IsNull())
    {
      itkWarningMacro(<< "Property '" << it->first << "' contains nothing (nullptr).");
      continue;
    }
    if (Superclass::GetMTime() < it->second->GetMTime())
    {
      Modified();
      break;
    }
  }
Beispiel #13
0
void rtCathDataObject::colorChanged(int index)
{
    if (m_cathGuiSetup.colorBox->currentText() == "None")
        m_currColor = NULL;
    else
    {
        int id = m_colorIDs.value(index);
        rtRenderObject *rObj = rtApplication::instance().getObjectManager()->getObjectWithID(id);
        if (!rObj) return;
        m_currColor = static_cast<rtColorFuncDataObject*>(rObj->getDataObject());
        connect(m_currColor, SIGNAL(objectChanged(int)), this, SLOT(Modified()));
    }
    Modified();

}
Beispiel #14
0
void mitk::BaseGeometry::SetIndexToWorldTransform(mitk::AffineTransform3D* transform)
{
  mitk::ModifiedLock lock(this);

  PreSetIndexToWorldTransform(transform);

  m_IndexToWorldTransform = transform;
  CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing);
  vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
  TransferItkToVtkTransform();
  Modified();

  PostSetIndexToWorldTransform(transform);

}
Beispiel #15
0
void KVCanvas::ProfileY(TH2* hh)
{
   TObject* obj = 0;
   if ((obj = gROOT->FindObject(Form("%s_pfy", hh->GetName())))) obj->Delete();
   TProfile* pfy = hh->ProfileY("_pfy", 1, -1, "i");
   TGraphErrors* gr = gHistoManipulator->MakeGraphFrom(pfy);
   pfy->Delete();
   TGraph* gg = gHistoManipulator->PermuteAxis(gr);
   gr->Delete();
   gg->SetName(Form("%s_pfy", hh->GetName()));
   gg->SetLineColor(kBlack);
   gg->Draw("PEZ");
   Modified();
   Update();
}
Beispiel #16
0
bool rtEPDataObject::setCurrPhase(int phase) {
  if(phase < 0) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("Cannot set a negative phase."));
    return false;
  }

  if(!m_phaseDataList.contains(phase)) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("Phase list does not contain this phase."));
    return false;
  }

  m_currentPhase = phase;
  Modified();
  return true;
}
Beispiel #17
0
void cStructLoader::Save(void)
{
  if(CheckDoSave()) {
    cSafeFile f(path);
    if(f.Open()) {
      ListLock(false);
      for(cStructItem *it=First(); it; it=Next(it))
        if(!it->Deleted() && !it->Save(f)) break;
      f.Close();
      mtime=MTime(true);
      Modified(false);
      ListUnlock();
      PRINTF(L_CORE_LOAD,"saved %s to %s",type,path);
      }
    }
}
Beispiel #18
0
// TODO Parameter as Smartpointer
void mitk::LabelSet::AddLabel(mitk::Label *label)
{
  unsigned int max_size = mitk::Label::MAX_LABEL_VALUE + 1;
  if (m_LabelContainer.size() >= max_size)
    return;

  mitk::Label::Pointer newLabel(label->Clone());

  // TODO use layer of label parameter
  newLabel->SetLayer(m_Layer);

  PixelType pixelValue;
  if (m_LabelContainer.empty())
  {
    pixelValue = newLabel->GetValue();
  }
  else
  {
    pixelValue = m_LabelContainer.rbegin()->first;

    if (pixelValue >= newLabel->GetValue() && m_LabelContainer.find(newLabel->GetValue()) != m_LabelContainer.end())
    {
      ++pixelValue;
      newLabel->SetValue(pixelValue);
    }
    else
    {
      pixelValue = newLabel->GetValue();
    }
  }

  // new map entry
  m_LabelContainer[pixelValue] = newLabel;
  UpdateLookupTable(pixelValue);

  // add DICOM information of the label
  DICOMSegmentationPropertyHandler::SetDICOMSegmentProperties(newLabel);

  itk::SimpleMemberCommand<LabelSet>::Pointer command = itk::SimpleMemberCommand<LabelSet>::New();
  command->SetCallbackFunction(this, &LabelSet::OnLabelModified);
  newLabel->AddObserver(itk::ModifiedEvent(), command);
  // newLabel->AddObserver(itk::ModifiedEvent(),command);

  SetActiveLabel(newLabel->GetValue());
  AddLabelEvent.Send();
  Modified();
}
Beispiel #19
0
LPCSTR CSHGameMtlTools::AppendItem(LPCSTR folder_name, LPCSTR parent_name)
{
    LPCSTR M=0;
	SGameMtl* parent 	= FindItem(parent_name);
    if (!parent){
	    if (!TfrmChoseItem::SelectItem(smCustom,M,1,0,fastdelegate::bind<TOnChooseFillItems>(this,&CSHGameMtlTools::FillChooseMtlType))||!M) return 0;
    }
    AnsiString pref		= parent_name?AnsiString(parent_name):AnsiString(folder_name)+M;
    m_LastSelection		= FHelper.GenerateName(pref.c_str(),2,fastdelegate::bind<TFindObjectByName>(this,&CSHGameMtlTools::ItemExist),false,true);
    SGameMtl* S 		= GMLib.AppendMaterial(parent);
    S->m_Name			= m_LastSelection.c_str();
    if (!parent)		S->Flags.set (SGameMtl::flDynamic,0==strcmp(M,"Dynamic"));
    ExecCommand			(COMMAND_UPDATE_LIST);
    ExecCommand			(COMMAND_UPDATE_PROPERTIES);
	Modified			();
    return *S->m_Name;
}
Beispiel #20
0
bool CodeEditor::SaveFile()
{
	// Return if no change
	if (!Modified()) return true;

	// Get file name
	if (!mFileName)
	{
		wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"),
			wxSAVE | wxOVERWRITE_PROMPT);
		if (dlg.ShowModal() != wxID_OK) return false;
		mFileName = dlg.GetPath();
	}

	// Save file
	return SaveFile(mFileName);
}
Beispiel #21
0
void WrappingTextView::RedoChange() {
	if (m_curr_undo_index >= m_max_undo_index)
		return;
	UndoInfo info = m_undo_vect[m_curr_undo_index++];
	m_in_undo_redo = true;
	if (info.isInsertion) {
		BTextView::Insert( info.offset, info.text.String(), info.text.Length(), info.text_runs);
		Select( info.offset+info.text.Length(), info.offset+info.text.Length());
	} else {
		BTextView::Delete( info.offset, info.offset+info.text.Length());
		Select( info.offset, info.offset);
	}
	ScrollToSelection();
	m_in_undo_redo = false;
	if(!m_modified_disabled)
		Modified();
}
Beispiel #22
0
void mitk::PropertyList::ReplaceProperty(const std::string& propertyKey, BaseProperty* property)
{
  if (!property) return;

  PropertyMap::iterator it( m_Properties.find( propertyKey ) );

  // Is a property with key @a propertyKey contained in the list?
  if( it != m_Properties.end() )
  {
    it->second=NULL;
    m_Properties.erase(it);
  }

  //no? add/replace it.
  m_Properties.insert( PropertyMap::value_type(propertyKey, property) );
  Modified();
}
Beispiel #23
0
void
FileDataField::ForceModify(const TCHAR *path)
{
  EnsureLoaded();

  auto i = Find(path);
  if (i >= 0) {
    if (unsigned(i) == current_index)
      return;
  } else {
    auto &item = files.full() ? files.back() : files.append();
    item.Set(path);
    i = files.size() - 1;
  }

  current_index = i;
  Modified();
}
Beispiel #24
0
bool LayerSurface::LoadGenericOverlayFromFile( const QString& filename )
{
  if ( !m_surfaceSource->LoadOverlay( filename ) )
  {
    return false;
  }

  // create overlay
  SurfaceOverlay* overlay = new SurfaceOverlay( this );
  overlay->SetName( QFileInfo(filename).fileName() );
  overlay->SetFileName( filename );
  m_overlays.push_back( overlay );
  SetActiveOverlay( m_overlays.size() - 1 );

  emit Modified();
  emit SurfaceOverlayAdded( overlay );
  return true;
}
Beispiel #25
0
unsigned long mitk::BaseData::GetMTime() const
{
  unsigned long time = Superclass::GetMTime();
  if(m_TimeSlicedGeometry.IsNotNull())
  {
    if((time < m_TimeSlicedGeometry->GetMTime()))
    {
      Modified();
      return Superclass::GetMTime();
    }
    //unsigned long geometryTime = m_TimeSlicedGeometry->GetMTime();
    //if(time < geometryTime)
    //{
    //  return geometryTime;
    //}
  }
  return time;
}
Beispiel #26
0
bool rtEPDataObject::setTriggerDelay(int phase, int trigger) {
  if(phase < 0) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("Phase is negative."));
    return false;
  }

  if(trigger < 0) {
    rtApplication::instance().getMessageHandle()->error(__LINE__, __FILE__, QString("Trigger is negative."));
    return false;
  }

  // Create the phase if it does not exist.
  if (!phaseExists(phase)) createPhase(phase);
  m_phaseDataList[phase].triggerDelay = trigger;
  m_cineWidget.addTrigger(trigger);
  Modified();
  return true;
}
  void GetImageStatisticsWithImageConnected()
  {
    //create rules connection
    auto statisticsNode = mitk::CreateImageStatisticsNode(m_statisticsContainer, "testStatistics");
    CreateNodeRelationImage(m_statisticsContainer.GetPointer(), m_image.GetPointer());
    auto standaloneDataStorage = mitk::StandaloneDataStorage::New();
    standaloneDataStorage->Add(statisticsNode);

    //rule: (image-->statistics), 1 connected image --> test return image statistics
    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImage;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImage = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImage->GetUID(), m_statisticsContainer->GetUID());

    //new rule: (image2-->statistics2 AND mask --> statistics2)
    CreateNodeRelationImage(m_statisticsContainer2.GetPointer(), m_image2.GetPointer());
    CreateNodeRelationMask(m_statisticsContainer2.GetPointer(), m_mask.GetPointer());

    auto statisticsNode2 = mitk::CreateImageStatisticsNode(m_statisticsContainer2, "testStatistics2");
    standaloneDataStorage->Add(statisticsNode2);

    //--> test return (still) image statistics (!= statistics2)
    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImageAgain;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageAgain = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID(), m_statisticsContainer->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID() != m_statisticsContainer2->GetUID(), true);

    //--> test return image statistics 2
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageAgain = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image2.GetPointer(), m_mask.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID(), m_statisticsContainer2->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID() != m_statisticsContainer->GetUID(), true);

    //add another newer statistic: should return this newer one
    auto statisticsContainerNew = mitk::ImageStatisticsContainer::New();
    CreateNodeRelationImage(statisticsContainerNew.GetPointer(), m_image.GetPointer());

    auto statisticsNodeNew = mitk::CreateImageStatisticsNode(statisticsContainerNew, "testStatisticsNew");
    standaloneDataStorage->Add(statisticsNodeNew);
    statisticsContainerNew->Modified();

    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImageNew;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageNew = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageNew->GetUID(), statisticsContainerNew->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageNew->GetUID() != m_statisticsContainer->GetUID(), true);
  }
Beispiel #28
0
void mitk::BaseGeometry::SetIndexToWorldTransformWithoutChangingSpacing(mitk::AffineTransform3D *transform)
{
  // security check
  mitk::Vector3D originalSpacing = this->GetSpacing();

  mitk::ModifiedLock lock(this);

  CheckIndexToWorldTransform(transform);

  m_GeometryTransform->SetIndexToWorldTransformWithoutChangingSpacing(transform);
  Modified();

  // Security check. Spacig must not have changed
  if (!mitk::Equal(originalSpacing, this->GetSpacing()))
  {
    MITK_WARN << "Spacing has changed in a method, where the spacing must not change.";
    assert(false);
  }
}
Beispiel #29
0
void LayerVolumeBase::Redo()
{
  if ( m_bufferRedo.size() > 0 )
  {
    UndoRedoBufferItem item = m_bufferRedo[m_bufferRedo.size()-1];
    m_bufferRedo.pop_back();

    UndoRedoBufferItem item2;
    SaveBufferItem( item2, item.plane, item.slice );
    m_bufferUndo.push_back( item2 );

    LoadBufferItem( item );
    item.Clear();

    SetModified();
    emit ActorUpdated();
    emit Modified();
  }
}
Beispiel #30
0
void mitk::DataNode::SetData(mitk::BaseData* baseData)
{
  if(m_Data!=baseData)
  {
    m_Data=baseData;

    m_Mappers.clear();
    m_Mappers.resize(10);

    mitk::CoreObjectFactory::GetInstance()->SetDefaultProperties(this);

    m_DataReferenceChangedTime.Modified();
    Modified();

    //inform the interactor about the change
    if (m_Interactor.IsNotNull())
      m_Interactor->DataChanged();
  }
}