Cell Classification Notes

本文探讨了免疫细胞(如中性粒细胞、嗜酸性粒细胞、嗜碱性粒细胞、单核细胞、树突状细胞和巨噬细胞)在对抗感染、过敏反应及肿瘤免疫中的作用,重点介绍了它们的特性和在肿瘤微环境中的角色。同时提到了免疫细胞标记和分类,以及它们在Tumor Microenvironment中的关键作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Cells

Immune Cells

Classfication of blood cell
在这里插入图片描述

Granulocytes
They contain enzyme granules, which form in the cytoplasm (a thick, semi-fluid solution that fills each cell). When infection or inflammation enters the body, granulocytes rush to the area, releasing their granules to fight infection.

Neutrophils: The most common type of granulocyte, neutrophils attack bacteria. Each neutrophil cell can consume up to 20 bacteria in its lifetime.
Eosinophils: These granulocytes are present in almost all immune responses, most notably allergies. However, they also fight off parasites.
Basophils: These granulocytes primarily combat allergic reactions. They release histamine (which escorts allergens out of your body) and the blood thinner heparin (which prevents clotting). Example: (Mast Cells is very similar to the basophils since they originate from the same progenitors)


Monocyte
Monocytes are a type of white blood cell (leukocytes) that reside in your blood and tissues to find and destroy germs (viruses, bacteria, fungi and protozoa) and eliminate infected cells.

Dendritic cells: Ask other cells in your immune system for backup to fight germs.
Macrophages: Defend your body from germs on the front lines.


Immune Cell Marker and Classfication
Tumor Microenvironment

function dual_side_fragment_classification() % 初始化 clc; clear; close all; warning off; % 选择文件夹 folder_path = uigetdir('', '选择包含双面碎片的文件夹(附件5)'); if folder_path == 0 error('用户取消选择'); end %% 1. 加载并配对正反面文件 [pairs, unmatched] = load_and_pair_fragments(folder_path); fprintf('已加载 %d 对有效碎片,%d 个未匹配碎片\n', size(pairs,1), length(unmatched)); %% 2. 提取行特征(仅使用正面) features = zeros(size(pairs,1), 100); % 100维特征 parfor i = 1:size(pairs,1) img = preprocess_image(fullfile(folder_path, pairs{i,1})); features(i,:) = extract_row_features(img); end %% 3. 行分类(22行) row_labels = classify_rows(features, 14); %% 4. 生成分类结果表 create_result_table(folder_path, pairs, row_labels, unmatched); fprintf('分类完成!结果已保存到:%s\n', fullfile(folder_path, 'classification_results.xlsx')); end %% 文件加载与配对函数(修改版) function [pairs, unmatched] = load_and_pair_fragments(folder) % 获取所有.bmp文件 file_list = dir(fullfile(folder, '*.bmp')); if isempty(file_list) file_list = dir(fullfile(folder, '*.BMP')); end % 使用结构数组替代Map all_files = struct('id', {}, 'a', '', 'b', ''); % 先索引所有文件 for i = 1:length(file_list) [~, name, ~] = fileparts(file_list(i).name); id_str = name(1:end-1); % 去掉最后一位a/b id_num = str2double(id_str); % 查找或创建条目 found = false; for j = 1:length(all_files) if all_files(j).id == id_num if endsWith(name, 'a') all_files(j).a = file_list(i).name; else all_files(j).b = file_list(i).name; end found = true; break; end end if ~found new_entry.id = id_num; if endsWith(name, 'a') new_entry.a = file_list(i).name; new_entry.b = ''; else new_entry.a = ''; new_entry.b = file_list(i).name; end all_files(end+1) = new_entry; end end % 配对正反面 pairs = cell(0,2); unmatched = {}; for i = 1:length(all_files) if ~isempty(all_files(i).a) && ~isempty(all_files(i).b) pairs(end+1,:) = {all_files(i).a, all_files(i).b}; elseif ~isempty(all_files(i).a) unmatched{end+1} = all_files(i).a; else unmatched{end+1} = all_files(i).b; end end % 按编号排序 [~, idx] = sort([all_files.id]); all_files = all_files(idx); % 重新组织已排序的数据 pairs = cell(0,2); unmatched = {}; for i = 1:length(all_files) if ~isempty(all_files(i).a) && ~isempty(all_files(i).b) pairs(end+1,:) = {all_files (i).a, all_files(i).b}; elseif ~isempty(all_files(i).a) unmatched{end+1} = all_files(i).a; else unmatched{end+1} = all_files(i).b; end end end %% 图像预处理(适配.bmp) function img = preprocess_image(filepath) img = imread(filepath); if size(img,3) == 3 img = rgb2gray(img); end img = imbinarize(img, 'adaptive'); img = bwareaopen(img, 20); end %% 行特征提取(保持不变) function features = extract_row_features(bw_img) h_proj = sum(~bw_img, 2); features = imresize(h_proj, [100, 1])'; end %% 行分类函数(保持不变) function labels = classify_rows(features, k) [~, score] = pca(features); [labels, ~] = kmeans(score(:,1:10), k, 'Replicates', 5); end %% 创建结果表格(修改版) function create_result_table(folder, pairs, row_labels, unmatched) % 初始化22x19的cell数组 result_front = cell(22, 19); result_back = cell(22, 19); % 按行组织碎片 for row = 1:max(row_labels) idx = find(row_labels == row); row_pairs = pairs(idx,:); % 填充到表格(最多19列) for col = 1:min(19, size(row_pairs,1)) % 正面碎片(去掉扩展名) [~, name_front, ~] = fileparts(row_pairs{col,1}); result_front{row, col} = name_front; % 对应背面碎片 [~, name_back, ~] = fileparts(row_pairs{col,2}); result_back{row, col} = name_back; end end % 写入Excel文件 output_file = fullfile(folder, 'classification_results.xlsx'); % 正面碎片分类 writecell({'正面碎片分类结果(22行×19列)'}, output_file, 'Sheet', '正面', 'Range', 'A1'); writecell(result_front, output_file, 'Sheet', '正面', 'Range', 'A2'); % 背面碎片分类 writecell({'背面碎片分类(对应正面位置)'}, output_file, 'Sheet', '背面', 'Range', 'A1'); writecell(result_back, output_file, 'Sheet', '背面', 'Range', 'A2'); % 未匹配碎片 if ~isempty(unmatched) unmatched_names = cellfun(@(x) x(1:end-4), unmatched, 'UniformOutput', false); writecell({'未匹配碎片(缺少对应面)'}, output_file, 'Sheet', '未匹配', 'Range', 'A1'); writecell(unmatched_names, output_file, 'Sheet', '未匹配', 'Range', 'A2'); end % 添加说明 notes = { '说明:'; '1. 文件格式要求:000a.bmp, 000b.bmp,...,208a.bmp,208b.bmp'; '2. 每行最多显示19个碎片,实际数量可能不同'; '3. 未匹配碎片可能缺少对应正反面文件'; '4. 需要人工验证跨行分类准确性'}; writecell(notes, output_file, 'Sheet', '说明', 'Range', 'A1'); end这个代码有的图片的正反面分不出来请修改以解决这个问题 回答 向我提问的人太多了。正在努力扩容中,请稍后再试。 function dual_side_fragment_classification() % 初始化 clc; clear; close all; warning off; % 选择文件夹 folder_path = uigetdir(‘’, ‘选择包含双面碎片的文件夹(附件5)’); if folder_path == 0 error(‘用户取消选择’); end %% 1. 加载并配对正反面文件 [pairs, unmatched] = load_and_pair_fragments(folder_path); fprintf(‘已加载 %d 对有效碎片,%d 个未匹配碎片\n’, size(pairs,1), length(unmatched)); %% 2. 提取行特征(仅使用正面) features = zeros(size(pairs,1), 100); % 100维特征 parfor i = 1:size(pairs,1) img = preprocess_image(fullfile(folder_path, pairs{i,1})); features(i,:) = extract_row_features(img); end %% 3. 行分类(22行) row_labels = classify_rows(features, 14); %% 4. 生成分类结果表 create_result_table(folder_path, pairs, row_labels, unmatched); fprintf(‘分类完成!结果已保存到:%s\n’, fullfile(folder_path, ‘classification_results.xlsx’)); end %% 文件加载与配对函数(修改版) function [pairs, unmatched] = load_and_pair_fragments(folder) % 获取所有.bmp文件 file_list = dir(fullfile(folder, ‘.bmp’)); if isempty(file_list) file_list = dir(fullfile(folder, '.BMP’)); end % 使用结构数组替代Map all_files = struct(‘id’, {}, ‘a’, ‘’, ‘b’, ‘’); % 先索引所有文件 for i = 1:length(file_list) [~, name, ~] = fileparts(file_list(i).name); id_str = name(1:end-1); % 去掉最后一位a/b id_num = str2double(id_str); % 查找或创建条目 found = false; for j = 1:length(all_files) if all_files(j).id == id_num if endsWith(name, ‘a’) all_files(j).a = file_list(i).name; else all_files(j).b = file_list(i).name; end found = true; break; end end if ~found new_entry.id = id_num; if endsWith(name, ‘a’) new_entry.a = file_list(i).name; new_entry.b = ‘’; else new_entry.a = ‘’; new_entry.b = file_list(i).name; end all_files(end+1) = new_entry; end end % 配对正反面 pairs = cell(0,2); unmatched = {}; for i = 1:length(all_files) if ~isempty(all_files(i).a) && ~isempty(all_files(i).b) pairs(end+1,:) = {all_files(i).a, all_files(i).b}; elseif ~isempty(all_files(i).a) unmatched{end+1} = all_files(i).a; else unmatched{end+1} = all_files(i).b; end end % 按编号排序 [~, idx] = sort([all_files.id]); all_files = all_files(idx); % 重新组织已排序的数据 pairs = cell(0,2); unmatched = {}; for i = 1:length(all_files) if ~isempty(all_files(i).a) && ~isempty(all_files(i).b) pairs(end+1,:) = {all_files (i).a, all_files(i).b}; elseif ~isempty(all_files(i).a) unmatched{end+1} = all_files(i).a; else unmatched{end+1} = all_files(i).b; end end end %% 图像预处理(适配.bmp) function img = preprocess_image(filepath) img = imread(filepath); if size(img,3) == 3 img = rgb2gray(img); end img = imbinarize(img, ‘adaptive’); img = bwareaopen(img, 20); end %% 行特征提取(保持不变) function features = extract_row_features(bw_img) h_proj = sum(~bw_img, 2); features = imresize(h_proj, [100, 1])'; end %% 行分类函数(保持不变) function labels = classify_rows(features, k) [~, score] = pca(features); [labels, ~] = kmeans(score(:,1:10), k, ‘Replicates’, 5); end %% 创建结果表格(修改版) function create_result_table(folder, pairs, row_labels, unmatched) % 初始化22x19的cell数组 result_front = cell(22, 19); result_back = cell(22, 19); % 按行组织碎片 for row = 1:max(row_labels) idx = find(row_labels == row); row_pairs = pairs(idx,:); % 填充到表格(最多19列) for col = 1:min(19, size(row_pairs,1)) % 正面碎片(去掉扩展名) [~, name_front, ~] = fileparts(row_pairs{col,1}); result_front{row, col} = name_front; % 对应背面碎片 [~, name_back, ~] = fileparts(row_pairs{col,2}); result_back{row, col} = name_back; end end % 写入Excel文件 output_file = fullfile(folder, ‘classification_results.xlsx’); % 正面碎片分类 writecell({‘正面碎片分类结果(22行×19列)’}, output_file, ‘Sheet’, ‘正面’, ‘Range’, ‘A1’); writecell(result_front, output_file, ‘Sheet’, ‘正面’, ‘Range’, ‘A2’); % 背面碎片分类 writecell({‘背面碎片分类(对应正面位置)’}, output_file, ‘Sheet’, ‘背面’, ‘Range’, ‘A1’); writecell(result_back, output_file, ‘Sheet’, ‘背面’, ‘Range’, ‘A2’); % 未匹配碎片 if ~isempty(unmatched) unmatched_names = cellfun(@(x) x(1:end-4), unmatched, ‘UniformOutput’, false); writecell({‘未匹配碎片(缺少对应面)’}, output_file, ‘Sheet’, ‘未匹配’, ‘Range’, ‘A1’); writecell(unmatched_names, output_file, ‘Sheet’, ‘未匹配’, ‘Range’, ‘A2’); end % 添加说明 notes = { ‘说明:’; ‘1. 文件格式要求:000a.bmp, 000b.bmp,…,208a.bmp,208b.bmp’; ‘2. 每行最多显示19个碎片,实际数量可能不同’; ‘3. 未匹配碎片可能缺少对应正反面文件’; ‘4. 需要人工验证跨行分类准确性’}; writecell(notes, output_file, ‘Sheet’, ‘说明’, ‘Range’, ‘A1’); end这个代码有的图片的正反面分不出来请修改以解决这个问题,我的代码是对于碎片拼接的,我的碎片地址是D:\BaiduNetdiskDownload\MATLAB R2024a\bin\project\附件5
07-13
### 关于 DeepPap 的代码实现 DeepPap 是一种基于深度卷积神经网络的方法,用于宫颈细胞分类的任务。该方法通过利用先进的图像处理技术和机器学习模型来提高诊断的准确性[^1]。 对于 DeepPap 的具体代码实现,通常可以从以下几个方面入手: #### 官方资源 如果存在官方发布的源码仓库,则优先推荐访问作者维护的 GitHub 项目页面或其他公开平台上的存储库链接。然而,在当前可获取的信息范围内,并未明确提及《DeepPap: Deep Convolutional Networks for Cervical Cell Classification》一文中提供了专门的开源代码托管地址。 #### 替代方案 当无法找到原始研究团队分享的具体实现细节时,可以尝试以下途径: - **GitHub 搜索**: 使用关键词如 `DeepPap`, `cervical cell classification` 或者其他相关术语在 GitHub 上执行高级搜索操作。 - **学术社区交流**: 访问像 ResearchGate、Google Scholar 这样的网站联系原作者询问是否有补充材料可用。 - **第三方复现版本**: 社区内可能存在由独立开发者完成的研究成果重现工作实例;这些可能不会完全一致但有助于理解核心算法逻辑结构。 以下是假设的一个简单框架示例展示如何构建类似的 CNN 架构来进行此类任务: ```python import tensorflow as tf from tensorflow.keras import layers, models def create_cnn_model(input_shape=(28, 28, 3)): model = models.Sequential() # 添加第一个卷积层与池化层 model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=input_shape)) model.add(layers.MaxPooling2D((2, 2))) # 第二个卷积层与池化层 model.add(layers.Conv2D(64, (3, 3), activation='relu')) model.add(layers.MaxPooling2D((2, 2))) # 展平层 model.add(layers.Flatten()) # 全连接层 model.add(layers.Dense(64, activation='relu')) # 输出层 model.add(layers.Dense(10)) return model model = create_cnn_model() print(model.summary()) ``` 此代码仅为示意用途,实际应用需依据数据集特点调整参数设置并训练验证效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值