Code clean and code style error fix.

This commit is contained in:
Krad
2022-04-19 15:40:58 +08:00
parent cba0b17c50
commit 30cdabdc74
8 changed files with 52 additions and 63 deletions

View File

@@ -88,18 +88,18 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
dataset->findAndGetOFString(DcmTagKey(group, element), Name);\
seriesProperty->Set##Name(Name.c_str());
ReadTAGToProperty(PatientID, 0x0010, 0x0020);
ReadTAGToProperty(PatientName, 0x0010, 0x0010);
ReadTAGToProperty(PatientBirthDate, 0x0010, 0x0030);
ReadTAGToProperty(PatientSex, 0x0010, 0x0040);
ReadTAGToProperty(StudyDate, 0x0008, 0x0020);
ReadTAGToProperty(StudyTime, 0x0008, 0x0030);
ReadTAGToProperty(Modality, 0x0008, 0x0060);
ReadTAGToProperty(InstitutionName, 0x0008, 0x0080);
ReadTAGToProperty(StudyDescription, 0x0008, 0x1030);
ReadTAGToProperty(SeriesDescription, 0x0008, 0x103E);
ReadTAGToProperty(StudyUID, 0x0020, 0x000d);
ReadTAGToProperty(StudyID, 0x0020, 0x0010);
ReadTAGToProperty(PatientID, 0x0010, 0x0020)
ReadTAGToProperty(PatientName, 0x0010, 0x0010)
ReadTAGToProperty(PatientBirthDate, 0x0010, 0x0030)
ReadTAGToProperty(PatientSex, 0x0010, 0x0040)
ReadTAGToProperty(StudyDate, 0x0008, 0x0020)
ReadTAGToProperty(StudyTime, 0x0008, 0x0030)
ReadTAGToProperty(Modality, 0x0008, 0x0060)
ReadTAGToProperty(InstitutionName, 0x0008, 0x0080)
ReadTAGToProperty(StudyDescription, 0x0008, 0x1030)
ReadTAGToProperty(SeriesDescription, 0x0008, 0x103E)
ReadTAGToProperty(StudyUID, 0x0020, 0x000d)
ReadTAGToProperty(StudyID, 0x0020, 0x0010)
seriesProperty->SetSeriesUID(SeriesUID.c_str());
seriesProperty->SetSeriesNumber(SeriesNumber);
std::string uniqueID;
@@ -148,7 +148,7 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
char buffer[256] = {0};
sprintf(buffer, "%ld-%ld", AcquisitionNumber, InstanceNumber);
printf("%s\r\n", path.c_str());
result[SeriesUID][buffer] = {std::move(path), SeriesNumber, AcquisitionNumber, InstanceNumber};
result[SeriesUID][buffer] = {path, SeriesNumber, AcquisitionNumber, InstanceNumber};
}
}
@@ -159,7 +159,7 @@ void DICOMDirectoryHelper::Update() {
getDirectoryProperties(this->dirName.c_str(), series);
}
else{
getFileProperty(this->fileName.c_str(), series);
getFileProperty(fileName, series);
}
//sort files
for (auto &pair : series) {

View File

@@ -1,7 +1,5 @@
#include "base/DicomLoader.h"
#include <QObject>
#include <QMainWindow>
#include <QStatusBar>
#include "base/SeriesImageSet.h"
#include "DICOMDirectoryHelper.h"
#include "ExtendMedicalImageProperties.h"
@@ -214,9 +212,9 @@ void DicomLoader::readSeries() {
else {
study->series->insert({series_uid,property});
double *wlww = property->GetNthWindowLevelPreset(0);
int ww = wlww ? ((int) wlww[0]) : (512);
int wl = wlww ? ((int) wlww[1]) : (256);
// double *wlww = property->GetNthWindowLevelPreset(0);
// int ww = wlww ? ((int) wlww[0]) : (512);
// int wl = wlww ? ((int) wlww[1]) : (256);
}
}

View File

@@ -1,6 +1,6 @@
#include "base/SeriesImageSet.h"
#include "base/SeriesImageSet.h"
#include <vtkRendererCollection.h>
#include "view/DicomImageView.h"
#include "view/dicomimageview.h"
#include "base/DicomLoader.h"
#include <QPainter>
#include <QDebug>
@@ -26,11 +26,6 @@ SeriesImageSet::~SeriesImageSet() {
}
void SeriesImageSet::setUpSeriesInstance()
{
}
const char* SeriesImageSet::getCurImageName() const
{

View File

@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "global/include_vitk.h"
#include <memory>
@@ -11,13 +11,10 @@ class SeriesImageSet : public QObject
public:
SeriesImageSet::SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata);
SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata);
~SeriesImageSet() override;
void setUpSeriesInstance();
//UniqueID
//UniqueID
std::string const & getUniqueID() {
return m_pUniqueID;
};
@@ -32,18 +29,13 @@ public:
m_image->Print(std::cout);
return m_image;
};
//image data
//Image Properties
ExtendMedicalImageProperties* GetProperty()
{
return m_property;
};
//camera config
double GetExtent()
{
return m_extent;
}
void getCameraCfg(double *vup, double *camPos)
void getCameraCfg(double *vup, double *camPos)
{
for (int i = 0; i < 3; i++)
{

View File

@@ -21,7 +21,6 @@
#include "measure/MeasureStore.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
#include "ExtendMedicalImageProperties.h"
#include "util/ColorMapReader.h"
#include "vtkMath.h"
#include "vtkImageStack.h"
@@ -98,7 +97,7 @@ void infinitiViewer::SetFusionInputData(vtkImageData* data)
bar->SetLabelFormat("%.0f");
bar->UnconstrainedFontSizeOff();
bar->SetUnconstrainedFontSize(16);
bar->SetUnconstrainedFontSize(true);
bar->SetLabelTextProperty(LabelTextProperty);
this->Renderer->AddActor(bar);
@@ -335,6 +334,9 @@ infinitiViewer::infinitiViewer()
cornerAnnotation->SetNonlinearFontScaleFactor(1);
cornerAnnotation->SetMaximumFontSize(FontSizeHelper::font_size);
OpacityActor = nullptr;
bar = nullptr;
loadedMeasureSlice = 0;
this->Slice = 0;
@@ -346,15 +348,15 @@ infinitiViewer::infinitiViewer()
// Setup the pipeline
vtkRenderWindow* renwin = vtkRenderWindow::New();
this->SetRenderWindow(renwin);
infinitiViewer::SetRenderWindow(renwin);
renwin->Delete();
vtkRenderer* ren = vtkRenderer::New();
this->SetRenderer(ren);
infinitiViewer::SetRenderer(ren);
ren->Delete();
this->InstallPipeline();
infinitiViewer::InstallPipeline();
this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::LoadMeasures);
this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::updateTopLeftCornerInfo);
@@ -1207,10 +1209,10 @@ void infinitiViewer::UpdateOrientation()
void infinitiViewer::updateTopLeftCornerInfo()
{
if (AnnoHelper::IsAnno()) {
int _MaxSlice = this->GetSliceMax();
int _Slice = this->GetSlice();
int maxSlice = this->GetSliceMax();
int currentSlice = this->GetSlice();
std::string msg_const = m_cornerInfo.ConstAnno[TOP_LEFT];
std::string msg_var = StatusMessage::Format(_Slice, _MaxSlice);
std::string msg_var = StatusMessage::Format(maxSlice, currentSlice);
std::string msg_upleft = StatusMessage::Format(msg_var, msg_const);
cornerAnnotation->SetText(TOP_LEFT, msg_upleft.c_str());
}
@@ -1223,11 +1225,11 @@ void infinitiViewer::updateCornerInfo(int index)
if (index == TOP_LEFT)
{
int _MaxSlice = this->GetSliceMax();
int _Slice = this->GetSlice();
int maxSlice = this->GetSliceMax();
int currentSlice = this->GetSlice();
//cout << "MoveSliceForward::Slice = " << _Slice << std::endl;
std::string msg_const = m_cornerInfo.ConstAnno[index];
std::string msg_var = StatusMessage::Format(_Slice, _MaxSlice);
std::string msg_var = StatusMessage::Format(currentSlice, maxSlice);
std::string msg_upleft = StatusMessage::Format(msg_var, msg_const);
//_StatusMapper->SetInput(msg.c_str());
cornerAnnotation->SetText(index, msg_upleft.c_str());
@@ -1360,7 +1362,6 @@ void infinitiViewer::updateOrienInfo()
static const char* dds[6] ={"R","L","A","P","F","H"};
double proj[4] ={0,0,0,1};
Renderer->GetActiveCamera()->GetDirectionOfProjection(proj);
double invertProj[4] ={-proj[0],-proj[1],-proj[2],1};
double viewUp[4]= {0,0,0,1};
this->Renderer->GetActiveCamera()->GetViewUp(viewUp);
double viewRight[4] = {0, 0, 0, 1};
@@ -1369,13 +1370,17 @@ void infinitiViewer::updateOrienInfo()
double viewUpVector[4]= {0,0,0,1};
double viewRightVector[4]= {0,0,0,1};
//top and bottom
matrix->MultiplyPoint(viewUp, viewUpVector);
int flag = getOrientationIndex(viewUpVector);
viewUpIndex = flag;
cornerAnnotation->SetText(TOP_MIDDLE, dds[flag]);
cornerAnnotation->SetText(BOTTOM_MIDDLE, dds[getOppositeOrientation(flag)]);
//left and right
matrix->MultiplyPoint(viewRight, viewRightVector);
flag = getOrientationIndex(viewRightVector);
viewRightIndex = flag;
cornerAnnotation->SetText(RIGHT_MIDDLE, dds[flag]);
cornerAnnotation->SetText(LEFT_MIDDLE, dds[getOppositeOrientation(flag)]);
cornerAnnotation->Modified();

View File

@@ -73,7 +73,7 @@ public:
/**
* Render the resulting image.
*/
virtual void Render(void);
virtual void Render();
//@{
/**
@@ -326,9 +326,10 @@ protected:
infinitiViewer();
~infinitiViewer() override;
virtual void InstallPipeline();
virtual void InstallPipeline();
virtual void UnInstallPipeline();
virtual void PrepareFusionColorTable(vtkScalarsToColors* table, bool reset = false);
void PrepareFusionColorTable(vtkScalarsToColors* table, bool reset = false);
vtkRenderWindow* RenderWindow;
vtkRenderer* Renderer;
@@ -394,7 +395,7 @@ private:
int currentPresetIndex=1;
DicomCornerInfo m_cornerInfo;
char SOP_UID[20];
char SOP_UID[20]={0};
vtkNew<vtkMatrix4x4> matrix;
};

View File

@@ -35,7 +35,6 @@ public:
static DraggableActor *New();
vtkTypeMacro(DraggableActor, vtkProp);
// void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
enum DraggableActorEvents {

View File

@@ -1,7 +1,6 @@
#include "view/dicomimageview.h"
#include "view/dicomimageview.h"
#include <QMessageBox>
#include <QDebug>
#include <QMimeData>
#include "view/thumbnailImage.h"
#include <vtkInteractorStyleImage.h>
#include "vtkImageProperty.h"
@@ -261,7 +260,7 @@ void DicomImageView::resizeEvent(QResizeEvent *event)
int ax = (this->geometry().bottomLeft().x() + this->geometry().bottomRight().x()) / 2 +
VCRHelper::getVCRXOffset();
int ay = (this->geometry().bottomLeft().y() + this->geometry().bottomRight().y()) / 2 +
VCRHelper::getVCRYOffset();;
VCRHelper::getVCRYOffset();
_vcr_toolbar->move(ax, ay);
}
@@ -390,7 +389,7 @@ void DicomImageView::LoadSeries(SeriesImageSet *series)
}
//Callbacks------------------------------------------------------------------------------------
void DicomImageView::updateWindowLevelCb(vtkObject*caller, unsigned long eid, void *calldata)
void DicomImageView::updateWindowLevelCb(vtkObject* caller, unsigned long eid, void *calldata)
{
_ImageViewer->updateCornerInfo(BOTTOM_RIGHT);
emit Signal_WindowLevelEventForFusion(_ImageViewer->GetColorLevel(), _ImageViewer->GetColorWindow());
@@ -421,7 +420,7 @@ void DicomImageView::doubleclickedEventCb(vtkObject* sender, unsigned long event
}
//TODO重新匹配该函数部分逻辑可以直接保留需要注意Endxxx系列事件不是仅仅为了sync设计的
void DicomImageView::syncEventFunc(vtkObject*caller, unsigned long eid, void *calldata)
void DicomImageView::syncEventFunc(vtkObject* caller, unsigned long eid, void *calldata)
{
int* r = (int*)calldata;