/matlab_tools/Converted/kBlobIt.m
Objective C | 206 lines | 203 code | 3 blank | 0 comment | 60 complexity | 8a690e8f1f72fc1aa7c8a5290bfe0662 MD5 | raw file
Possible License(s): BSD-3-Clause
- %kBlobIt 'converts 3D data into blob-File to include in povray '
- % This MatLab function was automatically generated by a converter (KhorosToMatLab) from the Khoros BlobIt.pane file
- %
- % Parameters:
- % Double: t 'Threshhold', default: 100: 'threshhold for blobbing data'
- % Toggle: rel 'relative', default: 0: 'Threshhold given in Percent of 0 .. Maximum'
- % Toggle: v 'Input is Vector file', default: 0: 'input is in vector format'
- % Toggle: noblob 'NoBlob', default: 0: 'do not generate blobs but ordenary spheres'
- % Toggle: polycol 'PolyCol', default: 0: 'for vestors generate a new color at each new vector'
- % Double: dx 'VecSizeX', default: 64: 'Size of Datacube to show in case of vector file usage'
- % Double: dy 'Y', default: 64: 'Size of Datacube to show in case of vector file usage'
- % Double: dz 'Z', default: 64: 'Size of Datacube to show in case of vector file usage'
- % String: titX 'TitleX', default: 'X-axis': 'Text for Axis Title'
- % String: titY 'Y', default: 'Y-axis': 'Text for Axis Title'
- % String: titZ 'Z', default: 'Z-axis': 'Text for Axis Title'
- % Integer: sb 'ScaleBar Units', default: 2000: 'Number of basic units to form length of scalebar'
- % String: unit 'Text', default: '2\mm': 'Text to write at Scale Bar'
- % Toggle: vrml 'Generate VRML', default: 0: 'generate vrml instaed of povray format'
- % Toggle: faces 'Generate Faces', default: 0: 'generate only faces and no cubes'
- % Toggle: nospix 'no subpixel approximations', default: 0: 'do only use full integer pixel coordinates'
- % Double: smoothfac 'Smoothing', default: 2.5: 'this factor can be adjusted for optimal smoothing'
- % Double: pixXY 'Voxelsize XY', default: 77.8: 'Size of a voxel in nm XY-direction'
- % Double: zoom 'Zoom', default: 1: 'Zooms every coordinate'
- % Double: sr 'Sphere Radius', default: 2.2: 'Radius of blobs'
- % Double: pixZ 'Voxelsize Z', default: 162.1: 'Size of a voxel in nm Z-direction'
- % Double: mx 'Midpoint X', default: 0.5: 'view is centered on this point'
- % Double: my 'Y', default: 0.5: 'view is centered on this point'
- % Double: mz 'Z', default: 0.5: 'view is centered on this point'
- % InputFile: i 'Input ', required: 'First Input data object'
- % OutputFile: ao 'OutputBlobFile', required: 'Resulting ascii output data object'
- % InputFile: bf 'StartFile', optional: 'Povray file for the start declarations'
- % InputFile: tf 'Texture-File-Begin', optional: 'Filename will be +#Elem.txb and +#Elem.txe'
- % InputFile: ef 'EndFile', optional: 'File to be included at the end'
- %
- % Example: ao = kBlobIt({i, bf, tf, ef}, {'t',100;'rel',0;'v',0;'noblob',0;'polycol',0;'dx',64;'dy',64;'dz',64;'titX','X-axis';'titY','Y-axis';'titZ','Z-axis';'sb',2000;'unit','2\mm';'vrml',0;'faces',0;'nospix',0;'smoothfac',2.5;'pixXY',77.8;'zoom',1;'sr',2.2;'pixZ',162.1;'mx',0.5;'my',0.5;'mz',0.5;'i','';'ao','';'bf','';'tf','';'ef',''})
- %
- % Khoros helpfile follows below:
- %
- % PROGRAM
- % BlobIt - converts 3D data into blob-File to include in povray
- %
- % DESCRIPTION
- %
- %
- %
- % EXAMPLES
- %
- % "SEE ALSO"
- %
- % RESTRICTIONS
- %
- % REFERENCES
- %
- % COPYRIGHT
- % Copyright (C) 1996-2003, Rainer Heintzmann, All rights reserved.
- %
- function varargout = kBlobIt(varargin)
- if nargin ==0
- Inputs={};arglist={'',''};
- elseif nargin ==1
- Inputs=varargin{1};arglist={'',''};
- elseif nargin ==2
- Inputs=varargin{1}; arglist=varargin{2};
- else error('Usage: [out1,..] = kBlobIt(Inputs,arglist).');
- end
- if size(arglist,2)~=2
- error('arglist must be of form {''ParameterTag1'',value1;''ParameterTag2'',value2}')
- end
- narglist={'t', 100;'rel', 0;'v', 0;'noblob', 0;'polycol', 0;'dx', 64;'dy', 64;'dz', 64;'titX', 'X-axis';'titY', 'Y-axis';'titZ', 'Z-axis';'sb', 2000;'unit', '2\mm';'vrml', 0;'faces', 0;'nospix', 0;'smoothfac', 2.5;'pixXY', 77.8;'zoom', 1;'sr', 2.2;'pixZ', 162.1;'mx', 0.5;'my', 0.5;'mz', 0.5;'i', '__input';'ao', '__output';'bf', '__input';'tf', '__input';'ef', '__input'};
- maxval={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,1,1};
- minval={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,1,1};
- istoggle=[0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1];
- was_set=istoggle * 0;
- paramtype={'Double','Toggle','Toggle','Toggle','Toggle','Double','Double','Double','String','String','String','Integer','String','Toggle','Toggle','Toggle','Double','Double','Double','Double','Double','Double','Double','Double','InputFile','OutputFile','InputFile','InputFile','InputFile'};
- % identify the input arrays and assign them to the arguments as stated by the user
- if ~iscell(Inputs)
- Inputs = {Inputs};
- end
- NumReqOutputs=1; nextinput=1; nextoutput=1;
- for ii=1:size(arglist,1)
- wasmatched=0;
- for jj=1:size(narglist,1)
- if strcmp(arglist{ii,1},narglist{jj,1}) % a given argument was matched to the possible arguments
- wasmatched = 1;
- was_set(jj) = 1;
- if strcmp(narglist{jj,2}, '__input')
- if (nextinput > length(Inputs))
- error(['Input ' narglist{jj,1} ' has no corresponding input!']);
- end
- narglist{jj,2} = 'OK_in';
- nextinput = nextinput + 1;
- elseif strcmp(narglist{jj,2}, '__output')
- if (nextoutput > nargout)
- error(['Output nr. ' narglist{jj,1} ' is not present in the assignment list of outputs !']);
- end
- if (isempty(arglist{ii,2}))
- narglist{jj,2} = 'OK_out';
- else
- narglist{jj,2} = arglist{ii,2};
- end
- nextoutput = nextoutput + 1;
- if (minval{jj} == 0)
- NumReqOutputs = NumReqOutputs - 1;
- end
- elseif isstr(arglist{ii,2})
- narglist{jj,2} = arglist{ii,2};
- else
- if strcmp(paramtype{jj}, 'Integer') & (round(arglist{ii,2}) ~= arglist{ii,2})
- error(['Argument ' arglist{ii,1} ' is of integer type but non-integer number ' arglist{ii,2} ' was supplied']);
- end
- if (minval{jj} ~= 0 | maxval{jj} ~= 0)
- if (minval{jj} == 1 & maxval{jj} == 1 & arglist{ii,2} < 0)
- error(['Argument ' arglist{ii,1} ' must be bigger or equal to zero!']);
- elseif (minval{jj} == -1 & maxval{jj} == -1 & arglist{ii,2} > 0)
- error(['Argument ' arglist{ii,1} ' must be smaller or equal to zero!']);
- elseif (minval{jj} == 2 & maxval{jj} == 2 & arglist{ii,2} <= 0)
- error(['Argument ' arglist{ii,1} ' must be bigger than zero!']);
- elseif (minval{jj} == -2 & maxval{jj} == -2 & arglist{ii,2} >= 0)
- error(['Argument ' arglist{ii,1} ' must be smaller than zero!']);
- elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} < minval{jj})
- error(['Argument ' arglist{ii,1} ' must be bigger than ' num2str(minval{jj})]);
- elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} > maxval{jj})
- error(['Argument ' arglist{ii,1} ' must be smaller than ' num2str(maxval{jj})]);
- end
- end
- end
- if ~strcmp(narglist{jj,2},'OK_out') & ~strcmp(narglist{jj,2},'OK_in')
- narglist{jj,2} = arglist{ii,2};
- end
- end
- end
- if (wasmatched == 0 & ~strcmp(arglist{ii,1},''))
- error(['Argument ' arglist{ii,1} ' is not a valid argument for this function']);
- end
- end
- % match the remaining inputs/outputs to the unused arguments and test for missing required inputs
- for jj=1:size(narglist,1)
- if strcmp(paramtype{jj}, 'Toggle')
- if (narglist{jj,2} ==0)
- narglist{jj,1} = '';
- end;
- narglist{jj,2} = '';
- end;
- if ~strcmp(narglist{jj,2},'__input') && ~strcmp(narglist{jj,2},'__output') && istoggle(jj) && ~ was_set(jj)
- narglist{jj,1} = '';
- narglist{jj,2} = '';
- end;
- if strcmp(narglist{jj,2}, '__input')
- if (minval{jj} == 0) % meaning this input is required
- if (nextinput > size(Inputs))
- error(['Required input ' narglist{jj,1} ' has no corresponding input in the list!']);
- else
- narglist{jj,2} = 'OK_in';
- nextinput = nextinput + 1;
- end
- else % this is an optional input
- if (nextinput <= length(Inputs))
- narglist{jj,2} = 'OK_in';
- nextinput = nextinput + 1;
- else
- narglist{jj,1} = '';
- narglist{jj,2} = '';
- end;
- end;
- else
- if strcmp(narglist{jj,2}, '__output')
- if (minval{jj} == 0) % this is a required output
- if (nextoutput > nargout & nargout > 1)
- error(['Required output ' narglist{jj,1} ' is not stated in the assignment list!']);
- else
- narglist{jj,2} = 'OK_out';
- nextoutput = nextoutput + 1;
- NumReqOutputs = NumReqOutputs-1;
- end
- else % this is an optional output
- if (nargout - nextoutput >= NumReqOutputs)
- narglist{jj,2} = 'OK_out';
- nextoutput = nextoutput + 1;
- else
- narglist{jj,1} = '';
- narglist{jj,2} = '';
- end;
- end
- end
- end
- end
- if nargout
- varargout = cell(1,nargout);
- else
- varargout = cell(1,1);
- end
- global KhorosRoot
- if exist('KhorosRoot') && ~isempty(KhorosRoot)
- w=['"' KhorosRoot];
- else
- if ispc
- w='"C:\Program Files\dip\khorosBin\';
- else
- [s,w] = system('which cantata');
- w=['"' w(1:end-8)];
- end
- end
- [varargout{:}]=callKhoros([w 'blobit" -k'],Inputs,narglist);