classdef Slicer < handle
%GUI for exploration of 3D images, using Object Oriented Programming.
%
% SLICER is an graphical interface to explore slices of a 3D image.
% Index of the current slice is given under the slider, mouse position as
% well as cursor value are indicated when mouse is moved over image, and
% scrollbars allow to navigate within image.
%
% SLICER should work with any kind of 3D images: binary, gray scale
% (integer or floating-point) or color RGB.
%
% slicer(IMG);
% where IMG is a preloaded M*N*P matrix, opens the slicer GUI,
% initialized with image IMG.
% User can change current slice with the slider to the left, X and Y
% position with the two corresponding sliders, and change the zoom in the
% View menu.
%
% Slicer(IMGNAME, ...);
% Load the stack specified by IMGNAME. It can be either a tif bundle, the
% first file of a series, or a 3D image stored in one of the medical
% image format:
% * DICOM (*.dcm)
% * Analyze (*.hdr)
% * MetaImage (*.mhd, *.mha)
% It is also possible to import a raw data file, from the File->Import
% menu.
%
% Slicer
% without argument opens with an empty interface, and allows to open an
% image through the menu.
%
% Slicer(..., PARAM, VALUE);
% Specifies one or more display options as name-value parameter pairs.
% Available parameter names are:
%
% * 'Slice' the display uses slice given by VALUE as current slice
%
% * 'Name' gives a name to the image (for display in title bar)
%
% * 'Spacing' specifies the size of voxel elements. VALUE is a 1-by-3
% row vector containing spacing in x, y and z direction.
%
% * 'Origin' specifies coordinate of first voxel in user space
%
% * 'UnitName' the name of the unit used for spatial calibration (can
% be any string, default is empty).
%
% * 'DisplayRange' the values of min and max gray values to display. The
% default behaviour is to use [0 255] for uint8 images, or to
% compute bounds such as 95% of the voxels are converted to visible
% gray levels for other image types.
%
% * 'ColorMap' The colormap used for displaying grayscale images
% (default is gray). Should be a N-by-3 array of double, with N=256
% for grayscale or intensity images, as N=the number of labels for
% label images, and N=2 for binary images.
%
% * 'BackgroundColor' the color used as background for label images.
%
% * 'ImageType' The type of image, used for adapting display. Can be
% one of 'binary', 'grayscale', 'intensity', 'label', 'color',
% 'vector', 'none'. Default value is assessed from data type and
% size.
%
% * 'Parent' another instance of Slicer, that is used to initialize
% several parameters like spatial resolution, display range, LUT
% for display...
%
%
% Example
% % Explore human brain MRI
% metadata = analyze75info('brainMRI.hdr');
% I = analyze75read(metadata);
% Slicer(I);
%
% % show the 10-th slice, and add some setup
% Slicer(I, 'Slice', 10, 'Spacing', [1 1 2.5], 'Name', 'Brain', 'DisplayRange', [0 90]);
%
% See also
% imStacks, imscrollpanel
%
% Requires
% GUI Layout Toolbox version 2.0, or 1.17 (try to switch depending on
% Matlab version)
%
% ------
% Author: David Legland
% e-mail: david.legland@inrae.fr
% Created: 2011-04-12, using Matlab 7.9.0.529 (R2009b)
% https://github.com/mattools/matImage
% Copyright 2011 INRAE - BIA - BIBS
%% Properties
properties
% Image data stored as a 3D or 4D array, in YX(C)Z order.
ImageData;
% type of image. Can be one of:
% 'binary'
% 'grayscale'
% 'intensity'
% 'label'
% 'color'
% 'vector'
% 'none'
ImageType;
% size of the reference image (1-by-3 row vector, in XYZ order)
ImageSize;
% extra info for image, such as the result of imfinfo
ImageInfo;
% extra info for image, such as the result of imfinfo
ImageName;
% displayed data (2D image)
Slice;
% z-index of slice within 3D image
SliceIndex;
% used to adjust constrast of the slice
DisplayRange;
% Look-up table for display of uint8, label and binary images.
% can be empty, in obj case gray colormap is assumed
ColorMap = [];
% background color for label to RGB conversion. Given as RGB triplet of
% values bewteen 0 and 1. Default is white = (1,1,1).
BgColor = [1 1 1];
% calibration information for image
VoxelOrigin;
VoxelSize;
VoxelSizeUnit;
% shortcut for avoiding many tests. Should be set to true when either
% voxelOrigin, voxelsize or voxelSizeUnit is different from its default
% value.
Calibrated = false;
% keep last path for opening new images
LastPath = pwd;
% list of handles to the widgets.
% Structure with following fields:
% * Figure: the main figure
% * SubFigures: a list of figures that can be closed when the main
% figure is closed
% * Image: the image display
% * ImageAxis: the axis containing the image
% * ZSlider: the slider used to change the slice index
% * ZEdit: the edit uicontrol used to change slice index
% * ZProfileFigure used to display the profile along z
% * ZProfileAxis used to display the profile along z
Handles;
% the last position of mouse click, in user coordinates.
LastClickedPoint = [];
end
%% Constructor
methods
function obj = Slicer(varargin)
% call parent constructor
obj = obj@handle();
% initialize structure containing handles
obj.Handles = struct();
% keep pointer to current path
obj.LastPath = pwd;
% initialize using image given as argument
if ~isempty(varargin)
var = varargin{1};
if isa(var, 'Image')
setupImageFromClass(obj, var);
elseif ischar(var)
setupImageFromFile(obj, var);
else
if ndims(var) < 3 %#ok<ISMAT>
error('Requires input image with at least 3 dimensions');
end
setupImageData(obj, var, inputname(1));
end
varargin(1) = [];
if isempty(obj.ImageData)
return;
end
else
obj.ImageData = [];
obj.ImageType = 'none';
end
% parses input arguments, given as list of name-value pairs
parsesInputArguments();
% add checkup on visible image slice
if ~isempty(obj.ImageData)
obj.SliceIndex = min(obj.SliceIndex, obj.ImageSize(3));
end
updateCalibrationFlag(obj);
% create default figure
fig = figure();
set(fig, 'Menubar', 'none');
set(fig, 'NumberTitle', 'off');
set(fig, 'Name', 'Slicer');
obj.Handles.Figure = fig;
obj.Handles.SubFigures = [];
% create main figure menu and layout
setupMenuBar(obj);
setupLayout(fig);
% setup new image display
if ismember(obj.ImageType, {'label', 'binary'})
maxi = max(obj.ImageData(:));
obj.DisplayRange = [0 maxi];
if isempty(obj.ColorMap)
obj.ColorMap = jet(double(maxi));
end
colormap([obj.BgColor ; obj.ColorMap]);
end
updateSlice(obj);
displayNewImage(obj);
updateTitle(obj);
% setup listeners
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。 Matlab(Matrix Laboratory)是一种专为数值计算和科学与工程应用而设计的高级编程语言和环境。在算法开发和实现方面,Matlab具有以下一些好处: 1. 丰富的数学和科学函数库:Matlab提供了广泛的数学、信号处理、图像处理、优化、统计等领域的函数库,这些函数库可以帮助开发者快速实现各种复杂的数值计算算法。这些函数库提供了许多常用的算法和工具,可以大大简化算法开发的过程。 2. 易于学习和使用:Matlab具有简单易用的语法和直观的编程环境,使得算法开发者可以更快速地实现和测试他们的算法。Matlab的语法与数学表达式和矩阵操作非常相似,这使得算法的表达更加简洁、清晰。 3. 快速原型开发:Matlab提供了一个交互式的开发环境,可以快速进行算法的原型开发和测试。开发者可以实时查看和修改变量、绘制图形、调试代码等,从而加快了算法的迭代和优化过程。这种快速原型开发的特性使得算法开发者可以更快地验证和修改他们的想法。 4. 可视化和绘图功能:Matlab具有强大的可视化和绘图功能,可以帮助开发者直观地展示和分析算法的结果。开发者可以使用Matlab绘制各种图形、曲线、图像,以及创建动画和交互式界面,从而更好地理解和传达算法的工作原理和效果。 5. 并行计算和加速:Matlab提供了并行计算和加速工具,如并行计算工具箱和GPU计算功能。这些工具可以帮助开发者利用多核处理器和图形处理器(GPU)来加速算法的计算过程,提高算法的性能和效率
资源推荐
资源详情
资源评论
收起资源包目录
用于Matlab的图像处理库.zip (916个子文件)
matImage-manual.bib 26KB
img2.bmp 26KB
img1.bmp 26KB
blobs-intensity-measurements.csv 2KB
demoMeshShapes3d.html 19KB
demoShapes3d.html 19KB
demoShapes2d.html 11KB
demoImGeodesicDistanceMap.html 9KB
demoImMaxFeretDiameter.html 9KB
demoImOrientedBox.html 8KB
demoImGeodesicPath.html 8KB
demoImEquivalentEllipse.html 8KB
demoImMaxGeodesicPath.html 7KB
demoImBoxFilter_3d.html 7KB
demoImJointHistogram.html 7KB
demoWatSobel.html 5KB
demoImRAG.html 5KB
16c_Col0_607.lsm 26.52MB
matImage-manual.lyx 148KB
Slicer.m 90KB
cellularComplex.m 41KB
sphericalCapsAreaC26.m 31KB
sphericalCapsAreaC6.m 25KB
SlicerHistogramDialog.m 24KB
imHistogramDialog.m 21KB
imEuler3d.m 21KB
OrthoSlicer3d.m 20KB
test_imOverlay.m 16KB
epc.m 13KB
orthoSlices.m 12KB
readstack.m 12KB
imChamferDistance.m 11KB
imMeanBreadthLut.m 11KB
imRAG.m 10KB
imGeodesicDistanceMap.m 10KB
slice3d.m 10KB
imChamferDistance5x5.m 9KB
Contents.m 9KB
imMeanBreadth.m 9KB
LabelIsosurfacesOptionsDialog.m 9KB
imChamferDistance3d.m 9KB
IsosurfaceOptionsDialog.m 9KB
complexNormalAngle.m 9KB
imOverlay.m 8KB
imGeodesicDistanceMap3d.m 8KB
metaImageInfo.m 8KB
imDistanceMap.m 8KB
test_metaImageRead.m 8KB
imInertiaEllipsoid.m 8KB
imEquivalentEllipsoid.m 8KB
CropStackDialog.m 8KB
savestack.m 8KB
imFeretDiameter.m 7KB
metaImageWrite.m 7KB
imSurfaceArea.m 7KB
OrthoSlicer3dOptionsDialog.m 7KB
imGeodesicDiameter.m 7KB
test_imGeodesicDiameter.m 7KB
imBoundaryIndices.m 7KB
Contents.m 7KB
imConvexImage.m 7KB
imSurface.m 7KB
imHistogram.m 6KB
computeDirectionWeights3d13.m 6KB
imSurfaceLut.m 6KB
metaImageRead.m 6KB
demoShapes3d.m 6KB
imSurfaceAreaLut.m 6KB
imJointSurface.m 5KB
imGeodesicDiameter3d.m 5KB
imJointSurfaceArea.m 5KB
demoMeshShapes3d.m 5KB
imGradientFilter.m 5KB
imRotate90.m 5KB
imDownSample.m 5KB
createDemoShapes3d.m 5KB
imOrientedBox.m 5KB
imDistance3d.m 5KB
imGranulo.m 5KB
imEvaluate.m 5KB
subsample.m 5KB
imMultiOtsuThreshold.m 5KB
imEnclosingCircle.m 5KB
imDistance.m 5KB
imGradient.m 5KB
imPerimeter.m 5KB
tpl.m 5KB
perimeter.m 5KB
imCentroid.m 4KB
Contents.m 4KB
imColorHistogram.m 4KB
test_imFeretDiameter.m 4KB
imInertiaEllipse.m 4KB
imEquivalentEllipse.m 4KB
imGeodesicPath.m 4KB
imBinaryConfigHisto.m 4KB
createLine.m 4KB
imKillBorders.m 4KB
imJointHistogram.m 4KB
test_stackRotate90.m 4KB
共 916 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 273
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功