- 博客(312)
- 资源 (3)
- 问答 (2)
- 收藏
- 关注
原创 使用SimpleITK工具进行脑部MRI图像放缩
例:对(32, 32, 32)的图片放缩到(256, 256, 256),原始图片空间为(1.0, 1.0, 1.0)。对图片进行空间设置:放缩后图片空间(1.0, 1.0, 1.0);不对空间进行设置:放缩后的图片空间(0.125, 0.125, 0.125)。需要对MRI图像进行裁剪、放缩,但是要求放缩之后的影像空间必须与原图片的影像空间一致。至此,图片已经完成了放缩,并且放缩后图片的空间与原图片空间大小是同一的。
2022-11-14 10:55:47
644
2
原创 【科研绘图】琴图 +箱型图混合 matplotlib库和seabsorn库的使用
箱型图是用于看数据分布情况。琴图+箱型图的组合也越来越多的应用于论文绘图中。这里使用matplotlib库。logging进行写入日志。上面这张图是琴图+箱型图。
2022-08-06 12:28:34
1090
原创 使用python将爬取到的大容量图片写入本地
大图片进行传输时,可能会时间比较长,这里有一个解决办法,使用contextlib库的closing方法进行request.get() ---- 以.tif为例子。
2022-08-04 10:27:22
286
原创 正确解决libstdc++.so.6: version `GLIBCXX_3.4.26‘ not found问题
找了一些博客,有的说是linux内核版本过高,有些说的是需要下载3.4.26的包但是下载链接却打不开,实测下面一种方法可以完美解决。先看一眼有哪些GLIBCXX版本:结果:发现到3.4.25就截止了解决:(安装libstdc++6 和 gcc-9)之后再使用就可以看到了......
2022-07-09 18:56:52
33799
17
原创 fsl左右海马体分割+freesurfer合并
文章目录背景bash直接运行python+nipype实现背景需要分割出海马体。可借鉴方法:深度学习(UNet分割),形态学上的开闭,fsl中的分割。使用fsl种的分割时需要注意,fsl分割分为左海马和右海马方法:使用fsl中的first命令进行分割。先在终端输入first查看需要输入的参数:可以看到-i 要从哪个文件进行提取, -k输出分割文件名称,-m 分割的标准文件(*.bmv),-l 做flirt时的变换矩阵。关于*.bmv文件:fsl自带的,在fsl安装目录data/first下面
2022-04-27 16:31:22
3101
13
转载 远程调试 qt.qpa.xcb: could not connect to display, echo DISPLAY为空[已解决]
问题:以服务器作为远程解释器,本地pycharm或vscode调试时出现如下错误:qt.qpa.xcb: could not connect to displayqt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/xx/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.This application fail
2022-04-27 13:52:54
4609
4
原创 python远程使用ants中的配准命令和N4biasfiledcorrection注意点
文章目录背景配准N4biasfiledcorrection背景项目需求:对脑影像T1结构像进行配准和偏差矫正。采用方法:调用远程linux的ants包+使用nipype进行配准和N4矫正(本项目中有pyqt5的需求,至于怎么在pycharm下配置自行百度。)Note:nipype提供了安装的docker,同组的师兄说可以直接下载docker就不用非得在linux上运行ants这些,但是本人对docker不熟悉(师兄也没用)就不打算这么做了。先安排个坑:docker的配置与使用,之后项目需要打包成do
2022-04-26 13:04:08
3287
转载 【转载】python 调用shell脚本并将输出重定向到文件
相关博客连接: python调用shell脚本+输出重定向https://stackoverflow.com/questions/4760215/running-shell-command-and-capturing-the-outputhttps://linuxhandbook.com/execute-shell-command-python/python执行shell脚本并且重定向输出到文件目的:有一些shell脚本的参数需要调整,在shell中处理有些麻烦,就用python控制参数,然后调用s
2022-04-21 22:37:13
1670
原创 【分类】DWI将每个个体处理到链接矩阵之后做组分析的几个方法
注:本博客仅记录与分类相关的DWI分析方法,内容来源于阅读的论文,每个方法介绍时会把论文链接放在开头。文章目录使用矩阵计算得出新的加权强度使用矩阵计算得出新的加权强度【指导论文】:A weighted communicability measure applied to complex brain networks背景:DWI非侵入式检测很适用于衡量微观结构的变化并且已经取得很好的效果。问题:脑部两个节点之间的连接的权重应该怎么计算?脑部连接与现实通信的相同点与不同之处:(这也是文章提出新的权重
2022-04-09 23:35:01
1167
4
原创 力扣【动态规划】-中等题-买卖股票含手续费
题目链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/只需要在卖出的时候扣除手续费即可。#include<bits/stdc++.h>using namespace std;class Solution {public: int maxProfit(vector<int>& prices, int fee) { in
2022-01-27 16:00:38
691
原创 力扣【动态规划】买卖股票含有冷冻期
题目链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/注意是卖掉之后有一天的冷冻期。换句话说就是,如果想买股票,那么得提前两天把股票卖出去。#include<bits/stdc++.h>using namespace std;class Solution {public: int maxProfit(vector<int>& prices) {
2022-01-27 15:51:07
616
原创 力扣【动态规划】-中等题-122买卖股票时期
题目链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/不要收到题目交易次数的影响题目分析:代码:#include<bits/stdc++.h>using namespace std;class Solution {public: int maxProfit(vector<int>& prices) { int len = prices.size(
2022-01-27 11:26:56
702
原创 力扣【动态规划】121题. 买卖股票时期
题目连接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/这道题有个关键问题需要明白:就是交易次数由于本题中K要么是0,要么是1。0表示没有进行过交易,1表示进行过交易。那么当持有股票的时候,要么是上一次持有股票,要么是第一次持有股票。代码:#include<bits/stdc++.h>using namespace std;class Solution {public: int maxPro
2022-01-26 23:15:51
364
原创 力扣【动态规划】-中等题-乘积最大子数组
题目链接:https://leetcode-cn.com/problems/maximum-product-subarray/为了解决负号带来的影响,在寻找最大乘积的时候需要用到另外一个数组存放遇到的最小值(当前最小值不一定负数,但是如果当前最小值为负数的话一定可以放进最小数组中,那么如果下一个值也为负数的话最小数组存放的就是结果)。所以本题最大乘积有三个来源:1、前一个最大乘积2、前一个最大当前数值3、前一个最小当前数值代码:#include<bits/stdc++.h>usi
2022-01-23 15:29:49
242
原创 力扣【动态规划】-中等题-跳跃游戏
题目链接:https://leetcode-cn.com/problems/jump-game/这道题有两种解题思路,一种是官方给出的解答方案 通过整个数组能够跳跃的最大距离进行判断,另一种是我个人的解答方案 根据下一步能够跳跃的最大距离。方案一:按照官方解题思路,只需要在最后一个数之前找到大于等于整个数组长度的数即可。代码:#include <bits/stdc++.h>using namespace std;class Solution {public: bool
2022-01-19 12:47:06
2167
原创 力扣【动态规划】-中等题-删除并获得点数
题目连接:https://leetcode-cn.com/problems/delete-and-earn/数组类型的子问题考虑dp[i]和dp[i-1],dp[i-2]的关系代码:#include<bits/stdc++.h>#include <iostream>using namespace std;class Solution {public: int deleteAndEarn(vector<int>& nums) {
2022-01-17 20:01:11
428
原创 力扣【动态规划】-简单题-70. Climbing Stairs
You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Example 1:Input: n = 2Output: 2Explanation: There are two ways to climb to the top.1 step
2021-11-20 19:41:00
263
原创 创建一个适用于BrainNet Viewer的.node文件---AAL2.node
BrainNet Viewer 下载地址:https://www.nitrc.org/projects/bnv/surface文件使用自带的surface即可。位置在安装目录/DATA/下自定义.node文件有时候我们想使用别的模板,比如aal系列,但是BrainNet Viewer上面并没有这些模板自带的.node文件,这个时候就需要我们自己进行.node文件的创作。首先看manual中对.node文件的操作:第二张图详细介绍了.node文件的组成。1、一共6列2、前三列为node坐标
2021-11-20 16:57:39
4830
17
原创 力扣【动态规划】-简单-1137. N-th Tribonacci Number
The Tribonacci sequence Tn is defined as follows:T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.Given n, return the value of Tn.Example 1:Input: n = 4Output: 4Explanation:T_3 = 0 + 1 + 1 = 2T_4 = 1 + 1 + 2 = 4Example 2:Input: n
2021-11-15 15:24:20
249
原创 力扣【动态规划】-简单-509. Fibonacci Number
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,F(0) = 0, F(1) = 1F(n) = F(n - 1) + F(n - 2), for n > 1.Given n, c
2021-11-15 11:25:57
609
原创 力扣------环形子数组最大和
给定一个由整数数组 A 表示的环形数组 C,求 C 的非空子数组的最大可能和。在此处,环形数组意味着数组的末端将会与开头相连呈环状。(形式上,当0 <= i < A.length 时 C[i] = A[i],且当 i >= 0 时 C[i+A.length] = C[i])此外,子数组最多只能包含固定缓冲区 A 中的每个元素一次。(形式上,对于子数组 C[i], C[i+1], …, C[j],不存在 i <= k1, k2 <= j 其中 k1 % A.length =
2021-10-14 14:58:50
241
1
原创 力扣---罗马数字转整数
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 500M 1000For example, 2 is written as II i
2021-10-01 16:35:05
164
原创 力扣 --- 打家劫舍
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatica
2021-09-30 18:06:08
194
原创 经典深度学习模型----VGG
VGG模型网络图:VGG为什么比较经典?证明了使用小的卷积核也可以达到比较高的精度。网络结构:卷积层、池化层、全连接层由于网络中1)卷积层的步长均为2,填充方式均为same,激活函数为relu2)池化层的核大小为2,步长为2,填充方式为same3)x个卷积层后面搭配上一个池化层,并且这x个卷积通道数均一致所以将卷积层和池化层并称为一个VGG块。所以VGG是由很多个VGG块组成的。VGG块编写:def vgg_block(num_conv, num_fliters): '''
2021-09-28 20:41:43
1018
原创 win10安装cuda cudnn和tensorflow-gpu 踩坑与正确的出坑姿势
文章目录环境介绍踩坑记录环境介绍GPU:NVIDIA GeForce RTX 3060操作系统:windows10家庭版踩坑记录
2021-09-13 14:11:03
496
原创 深度学习入门demo mnist
环境:python3.7gpu: RTX3060CUDA: 11.4cudnn: 8.6tensorflow-gpu: 2.5.0所有的网络层使用全连接层,有BN和dropout,无卷积部分。流程:额外实现:one-hot编码、搭建顺序模型主函数:读取数据----->图片变为向量、label变为one-hot------->训练------>画图代码:import keras.layersimport tensorflow as tffrom tensorfl
2021-09-07 14:53:54
650
原创 【入门】深度学习优化算法
文章目录优化算法局部最优鞍点与海森矩阵海森矩阵梯度消失批梯度下降Mini-Batch 梯度下降mini-banch大小选择动量梯度下降指数加权平均怎么解决鞍点问题逐参数适应学习率方法学习目标:- 知道局部最优问题、鞍点与海森矩阵- 说明批梯度下降算法的优化- 说明三种类型的优化算法- 知道学习率退火策略- 知道参数初始化策略与输入归一化策略- 应用完成梯度下降算法的优化1、为什么深度学习需要进行优化?虽然硬件水平的提升,让我们可以很方便的构建大型神经网络,但是构建神经网络的算法,还是需要我
2021-08-22 19:04:29
3440
原创 力扣 旋转链表
题目链接https://leetcode-cn.com/leetbook/read/linked-list/f00a2/思路比较简单 要么在原有链表上进行操作,要么重新建立一个链表。注意K的大小和链表长度之间的关系,小心超时/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* rota
2021-08-03 21:16:16
98
原创 力扣 两数相加
题目链接:https://leetcode-cn.com/leetbook/read/linked-list/fv6w7/这道题就是基本的大整数相加,只不过换成了链表的形式代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* addTwoNumbers(struct List
2021-07-29 13:51:01
133
原创 力扣 回文链表
题目链接:https://leetcode-cn.com/leetbook/read/linked-list/fov6t/时间复杂度:o(n),空间复杂度o(1)思想:1、遍历链表,获取链表总长度2、将链表前半段进行反转,这里记住一点:链表长度为偶数时,前半段和后半段长度相等;链表长度为奇数时,前半段要比后半段少一(这里选择了少一,其实前半段比后半段多一可以解答)3、如果链表长度是奇数,那么将多一的那个链表取next,保持两个链表长度相等。因为如果是奇数,那么中间的数不影响奇偶性代码:/**
2021-07-27 22:06:41
151
原创 力扣 奇偶链表
题目链接:https://leetcode-cn.com/leetbook/read/linked-list/fe0kj/这道题意思说是第i个链表结点,如果i是奇数,那么i位于前面的链表,如果i是偶数则位于后面的链表,代码如下:/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* od
2021-07-25 21:02:55
106
原创 力扣 移除元素
题目链接:https://leetcode-cn.com/leetbook/read/linked-list/f9izv/思路并不难:重新建立新的链表代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* removeElements(struct ListNode* head,
2021-07-25 20:34:57
90
原创 将.rmp转化为.deb软件包
随手记一下,以防忘记~sudo apt-get install aliensudo alien xxx.rmp注意一点:.rmp的转化并不是100%成功的,能找到.deb最好用.deb的程序文件包
2021-07-25 17:17:54
209
原创 力扣 反转链表 人生苦短,我用python
这是一道很简单的链表题目,却让我开始反省自己对于c++的掌握程度。题目链接:https://leetcode-cn.com/leetbook/read/linked-list/f58sg/下面是c艹代码,一直报错却找不到报错的原因。以及关于改算法是否正确,特意去参考了408上是怎么写的,发现无误后依旧在力扣上面报错,开始怀疑人生。#include <bits/stdc++.h>/** * Definition for singly-linked list. * struct Lis
2021-07-25 16:23:29
135
原创 力扣 删除链表的倒数第N个结点
Given the head of a linked list, remove the nth node from the end of the list and return its head.Example 1:Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]Example 2:Input: head = [1], n = 1Output: []Example 3:Input: head = [1,2], n = 1Output: [
2021-07-24 18:05:18
135
原创 力扣 相交链表
题目链接:https://leetcode-cn.com/leetbook/read/linked-list/jjbj2/这道题不难思考到的一点是:只要两个链表相交那么之后的节点都是相同的。所以A和B链表在公共区域之前的长度,就是个问题。这道题的突破点在于,A+B的长度和B+A的长度是一致的。有句话说的很好,我走过你走的路,那么我们会不会相交。/** * Definition for singly-linked list. * struct ListNode { * int val;
2021-07-24 17:46:12
123
原创 力扣---环形链表Ⅱ
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is use
2021-07-23 09:14:38
196
1
1027. 打印沙漏(20) 两个测试数据没有通过
2018-04-09
02-线性结构2 一元多项式的乘法与加法运算,这道题的代码上的问题
2018-03-17
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅