C++
ericohe
AI工程师
展开
-
C++11 / C++14 禁止copy
【代码】C++11 / C++14 禁止copy。原创 2022-08-31 13:47:21 · 401 阅读 · 0 评论 -
std::thread join的用法
C++ std::thread join的用法。原创 2022-08-18 15:54:02 · 293 阅读 · 0 评论 -
RabbitMQ C++客户端 (Windows系统)
https://github.com/RPG-18/rabbitmq-cpp-tutorials3rdparty/AMQP-CPP-2.1.4amqpcpp:x64-windows 4.3.15#1 AMQP-CPP is a C++ library for communicating withboost-asio:x64-windows 1.78.0 B原创 2022-07-13 15:21:56 · 696 阅读 · 0 评论 -
RabbitMQ Client (C/C++)
GitHub - RPG-18/rabbitmq-cpp-tutorials: C++ code for RabbitMQ tutorialsC++ code for RabbitMQ tutorials. Contribute to RPG-18/rabbitmq-cpp-tutorials development by creating an account on GitHub.https://github.com/RPG-18/rabbitmq-cpp-tutorials此为官方C++教程,不知为何从原创 2022-07-04 14:42:11 · 760 阅读 · 0 评论 -
解决VS2019编译Qt报错:C3615 constexpr 函数“qCountLeadingZeroBits”不能生成常量表达式
下载qalgorithms.h 替换库里面的文件https://codereview.qt-project.org/changes/qt%2Fqtbase~236948/revisions/2/files/src%2Fcorelib%2Ftools%2Fqalgorithms.h/download原创 2022-04-28 16:29:33 · 1210 阅读 · 0 评论 -
vcpkg+windows+cmake+环境变量
使用vcpkg+cmake的时候需要添加参数:DCMAKE_TOOLCHAIN_FILE=C:/work/code/vcpkg/scripts/buildsystems/vcpkg.cmake命令行:cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=C:/work/code/vcpkg/scripts/buildsystems/vcpkg.cmakecmake --build buildCMake GUI添加环境变量:echo %vcpkg_d原创 2022-03-29 14:56:07 · 2032 阅读 · 0 评论 -
vs2019 编译调试Linux代码
CMakeSettings.json{ "configurations": [ { "buildCommandArgs": "", "cmakeCommandArgs": "", "cmakeExecutable": "/usr/bin/cmake", "configurationType": "Release", "ctestCommandArgs": "", "generator": "..原创 2022-01-26 13:36:45 · 1245 阅读 · 0 评论 -
PlaneSourceDemo & conanfile.txt
step 1conanfile.txt[requires]VTK/8.2.0@imaging/stable[generators]cmakestep 2mkdir buildcd buildconan install ../conanfile.txt -s arch=x86 -r cloud --updatestep 3CMakeLists.txtcmake_minimum_required(VERSION 3.3 FATAL_ERROR)set(TAR..原创 2022-01-26 13:24:10 · 181 阅读 · 0 评论 -
vtkAxisActor2D 设置单位cm/mm
double range[2] = {0, 10.0}; ScaleActor->SetRange(range); ScaleActor= vtkSmartPointer<vtkAxisActor2D>::New(); ScaleActor->SetLabelVisibility(true); ScaleActor->SetLabelFormat("%g cm"); //%g ScaleActor->SetLabelFactor(0.5...原创 2022-01-25 14:17:17 · 950 阅读 · 0 评论 -
C++ Debug版本中越界异常
现象:Release版本正常,Debug版本报错:原因:越界或是堆栈溢出定位问题:通过二分查找法,放置检查点_ASSERTE(_CrtCheckMemory());vtkSmartPointer<vtkImageData> grtBlkPicture(int size[3]) { vtkSmartPointer<vtkImageData> img = vtkSmartPointer<vtkImageData>::New()...原创 2022-01-14 16:04:54 · 537 阅读 · 0 评论 -
vtkDistanceWidget 单位cm和mm转换
bool useMMUnit = false; if (useMMUnit) { distanceActor->GetDistanceRepresentation()->SetLabelFormat( "%-#6.2f mm"); } else { distanceActor->GetDistanceRepresentation()->SetLabelFormat( "%-#6.2f cm"); newDi...原创 2022-01-12 15:00:05 · 651 阅读 · 0 评论 -
vtkDistanceWidget修改文本颜色
vtkSmartPointer<vtkDistanceWidget> distanceActor; vtkAxisActor2D *axis = static_cast<vtkDistanceRepresentation2D *>( _disMeasureList[i]->distanceActor->GetDistanceRepresentation()) ->GetAxis();...原创 2021-12-15 15:27:09 · 747 阅读 · 4 评论 -
Log4cplus 配置
#log4cplus.appender.logfile = log4cplus::RollingFileAppenderlog4cplus.appender.logfile = log4cplus::DailyRollingFileAppenderlog4cplus.appender.logfile.File=../log/app.loglog4cplus.appender.logfile.Schedule=HOURLY#log4cplus.appender.logfile.Schedul...原创 2021-12-06 13:46:26 · 680 阅读 · 0 评论 -
vtkParametricSpline示例 & 修改控制点大小
#include <vtkAutoInit.h>VTK_MODULE_INIT(vtkInteractionStyle)VTK_MODULE_INIT(vtkRenderingFreeType)VTK_MODULE_INIT(vtkRenderingOpenGL2)VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2)#include <vtkActor.h>#include <vtkCamera.h>#include ...原创 2021-11-26 16:31:54 · 954 阅读 · 2 评论 -
Surface reconstruction (CPR) with VTK
Surface reconstruction (CPR) with VTK - 文章整合原创 2021-11-26 16:01:44 · 532 阅读 · 0 评论 -
vtk实现鼠标双击功能
#include <vtkActor.h>#include <vtkCamera.h>#include <vtkInteractorStyleTrackballCamera.h>#include <vtkNamedColors.h>#include <vtkNew.h>#include <vtkPointPicker.h>#include <vtkPolyDataMapper.h>#include <...原创 2021-11-16 15:28:14 · 1228 阅读 · 2 评论 -
C++ double to string带精度
std::string doubleToStringWithPrecision(double value, int precision) {#include <iomanip>#include <sstream> std::stringstream stream; stream << std::fixed << std::setpre...原创 2021-11-16 11:25:02 · 1479 阅读 · 0 评论 -
平滑曲线(基于均值)
void smooth(std::vector<std::vector<double>>& centerLine, std::vector<std::vector<double>>& smoothedCenterLine){ smoothedCenterLine.resize(centerLine.size()); int step = 2; for (int i = 0; i < centerLine.s...原创 2021-11-12 11:08:36 · 820 阅读 · 0 评论 -
Windows fork进程尝试(TODO)
/************************************************************************//* 父进程源码实现 *//************************************************************************/#include <Windows.h>#include <string>#include <iostream>#define ...原创 2021-11-11 14:50:11 · 1700 阅读 · 0 评论 -
Windows版本fock(TODO)
// ConsoleApplication.cpp : This file contains the 'main' function. Program// execution begins and ends there.////TODO from dcmtk#pragma once#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <winsock2.h> /* for SO_EXCLUSIVE...原创 2021-11-08 16:28:20 · 457 阅读 · 0 评论 -
storescp 和 storescu使用
storescpstorescp 104 -aet myaet -d --fork -od .\datastorescustorescu 127.0.0.1 104 --scan-directories D:\data\Dicom\原创 2021-11-05 17:26:29 · 2323 阅读 · 5 评论 -
C++11 判断文件或者文件夹
// Linux., UNIX and Windows as wellkEnumCheckFile CheckFile(const char* path) { kEnumCheckFile check = kEnumCheckFile::RC_NOT_EXIST; struct stat s; if (stat(path, &s) == 0) { if (s.st_mode & S_IFDIR) { check = kEnumCheckFile::RC_.原创 2021-11-03 15:57:59 · 1075 阅读 · 0 评论 -
两个vtkLineWidget2重合显示z-index的问题
需求:两个vtkLineWidget2颜色不一样,需要将选中的vtkLineWidget2显示在上层,默认按照vtkLineWidget2创建顺序显示,即后创建的覆盖在先创建的上面。#include <vtkActor.h>#include <vtkCamera.h>#include <vtkCommand.h>#include <vtkLineRepresentation.h>#include <vtkLineWidget2...原创 2021-10-19 13:09:25 · 556 阅读 · 0 评论 -
C++ 测试函数速度
#include <chrono>std::time_t GetTimeStamp() { std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> tp = std::chrono::time_point_cast<std::chrono::milliseconds>( std::chrono::system_clock::no...原创 2021-09-07 10:13:01 · 548 阅读 · 0 评论 -
vtkSplineWidget2 vtkSplineRepresentation 样条曲线分别控制线和控制点
样条曲线分别控制线和控制点的显示和影藏 auto splineRep = vtkCustomSplineRepresentation::SafeDownCast( _splineWidget->GetRepresentation()); //splineRep->SetVisibility(_showSpline); splineRep->GetLineProperty()->SetOpacity(_showSpline ? 1.0 : ..原创 2021-08-30 16:31:59 · 507 阅读 · 0 评论 -
C++ string 去掉两头的空格
//C++ 11#include <algorithm> #include <cctype>#include <locale>// trim from start (in place)static inline void ltrim(std::string &s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { r...原创 2021-08-20 13:41:10 · 741 阅读 · 0 评论 -
VTK数据类型强制转换(VTK_FLOAT to VTK_SHORT)
vtkSmartPointer<vtkImageData>imageData;... //loadint scalarType = imageData->GetScalarType();std::cout << "scalarType=" << scalarType << "\n"; if (imageData->GetScalarType() != VTK_SHORT) { vtkSmartPointer&l...原创 2021-08-03 10:02:59 · 710 阅读 · 0 评论 -
ITK生成mhd文件(附加额外Tag信息)
bool writeMhdFile(const char* dicomPath, const char *mhdFileName, bool useCompression){ typedef itk::Image<short, 3> ImageType; ImageType::Pointer image; if (!dicomSeriesToITKImage(dicomPath, image)) { return false; }...原创 2021-07-28 13:47:54 · 449 阅读 · 0 评论 -
ITK_non_uniform_sampling_deviation(ITK bug)
现象zspacing 些许误差虽然只是 1 与0.99999995617647042之间的差异左边ITK 4.13,右边ITK5.1.0万一,有二货,float类型直接判断相等的话,会导致问题问题发现https://github.com/InsightSoftwareConsortium/ITK/issues/1607https://github.com/InsightSoftwareConsortium/ITK/pull/1616/files解决要么降级到...原创 2021-07-27 18:14:51 · 583 阅读 · 0 评论 -
vtkLineWidget2自定义鼠标右键
1. 继承vtkLineWidget2class myLineWidget2 : public vtkLineWidget2 static void ScaleAction(vtkAbstractWidget*);2.override the default event bindings auto eventTranslator = this->GetEventTranslator(); // override the default event bindin...原创 2021-07-21 10:51:09 · 499 阅读 · 0 评论 -
VTK缩放图像与提取ROI(vtkImageChangeInformation与vtkExtractVOI)
code:#include <vtkAutoInit.h>VTK_MODULE_INIT(vtkInteractionStyle)VTK_MODULE_INIT(vtkRenderingFreeType)VTK_MODULE_INIT(vtkRenderingOpenGL2)VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2)///****************************************************//...原创 2021-06-17 11:26:45 · 1224 阅读 · 0 评论 -
C++ 判断文件夹并创建文件夹(支持Windows和Linux)
bool createFolder(std::string folderPath){ struct stat info; if (stat(folderPath.c_str(), &info) != 0) { printf("cannot access %s\n", folderPath.c_str()); _mkdir(folderPath.c_str()); return true; } el...原创 2021-04-28 16:42:24 · 475 阅读 · 0 评论 -
VTK曲面重建技术(CPR)
#include <vtkAutoInit.h>VTK_MODULE_INIT(vtkInteractionStyle)VTK_MODULE_INIT(vtkRenderingFreeType)VTK_MODULE_INIT(vtkRenderingOpenGL2)VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2)#include <vtkActor.h>#include <vtkCamera.h>#includ...原创 2021-04-27 09:08:08 · 2809 阅读 · 0 评论 -
VTK 合并mask(指定label)
void mergeMasks(Mask2Merged mask, vtkSmartPointer<vtkImageData>& mergedMask){ mergedMask = vtkSmartPointer<vtkImageData>::New(); int dimensions[3] = { 0 }; int fullsize = 0; unsigned char c = mask.label; for (int i ...原创 2021-04-23 17:13:00 · 551 阅读 · 0 评论 -
ITK图像分割(PNG图像)
/*========================================================================= * * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may o.原创 2021-04-02 16:02:49 · 430 阅读 · 0 评论 -
VTK 灰度图像转彩色图像
//gray image to color image vtkSmartPointer<vtkLookupTable> colorTable = vtkSmartPointer<vtkLookupTable>::New(); colorTable->SetRange(0, 255); colorTable->SetValueRange(0.0, 1.0); colorTable->SetSaturat...原创 2021-03-24 17:45:02 · 502 阅读 · 0 评论 -
VTK 实现DICOM 窗宽窗位调节,图像缩放,翻页功能
代码如下:#include <vtkSmartPointer.h>#include <vtkObjectFactory.h>#include <vtkRenderWindow.h>#include <vtkRenderWindowInteractor.h>#include <vtkRenderer.h>#include <vtkActor.h>#include <vtkImageViewer2.h>...原创 2021-01-21 16:25:22 · 2442 阅读 · 0 评论 -
VTK DICOM离屏生成png图片
//#include <vtkTextActor.h>#include <vtkTextProperty.h>#include <vtkRenderWindow.h>#include <vtkRenderWindowInteractor.h>#include <vtkRenderer.h>#include <vtkJPEGReader.h>#include <vtkPNGReader.h>#inc...原创 2021-03-23 17:42:50 · 451 阅读 · 0 评论 -
VTK 画箭头带长度测量
思路:vtkDistanceWidget可以实现测量功能,本来以为在此基础上改一改就可以变成箭头带长度测量功能,可以两个端点的十字线始终找不到隐藏的办法,不知道底层在哪里绘制的。后来找到了绘制箭头的功能vtkLineWidget2,but,令人恼火的是,这个画箭头的widget和vtkDistanceWidget不一样,不支持鼠标点选取,上来就绘制了一个箭头,然后让你改位置。两个方案:(1)vtkLineWidget2基础上增加鼠标交互功能(2)利用vtkDistanceWidg原创 2021-03-22 09:54:28 · 1879 阅读 · 2 评论 -
VTK画直线带箭头和长度文字vtkLineWidget2
#include <vtkActor.h>#include <vtkCamera.h>#include <vtkCommand.h>#include <vtkLineRepresentation.h>#include <vtkLineWidget2.h>#include <vtkNamedColors.h>#include <vtkNew.h>#include <vtkPolyData.h>...原创 2021-03-17 14:54:20 · 1695 阅读 · 7 评论