Advertisement
Qanar

ml v3

Dec 13th, 2022 (edited)
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.46 KB | None | 0 0
  1.           function UpdatePlots(app)
  2.  
  3.             % Fenstereinstellungen
  4.             W = app.EditFieldWW.Value;
  5.             C = app.EditFieldWC.Value;
  6.  
  7.             %Slider to show current Picture
  8.             sliderValueT = app.SliderTransversal.Value;
  9.             sliderValueS = app.SliderSagittal.Value;
  10.             sliderValueF = app.SliderFrontal.Value;
  11.            
  12.             %Pixel to Hounsfield
  13.             rescaleIntercept=app.MetaData.RescaleIntercept;
  14.             rescaleSlope    =app.MetaData.RescaleSlope;
  15.  
  16.             %Limits
  17.             lowLimit =rescaleSlope*(C-W/2) + abs(rescaleIntercept);
  18.             highLimit=rescaleSlope*(C+W/2) + abs(rescaleIntercept);
  19.             width = app.MetaData.Columns;
  20.             height = app.MetaData.Rows;
  21.             imageSize= size(app.Images,3); %Dritte Spalte in Matrix
  22.  
  23.             %Pixelspacing Vektor2d
  24.             thickness= app.MetaData.SliceThickness;
  25.             spacingX = app.MetaData.PixelSpacing(1);
  26.             spacingY = app.MetaData.PixelSpacing(2);
  27.                    
  28.             %Neuer Pixelabstand
  29.             rx = thickness/spacingX;
  30.             ry = thickness/spacingY;
  31.            
  32.             %Drehstreckungstransformation
  33.             transform = affine2d([rx* cosd(90) ry*sind(90) 0;...
  34.                                   sind(90)     ry*cosd(90) 0;...
  35.                                   0            0           1]);
  36.  
  37. %***********Transversale Schicht*******************************************/
  38.  
  39.             imgTransversal = app.Images(:,:,round(sliderValueT));
  40.  
  41.             imshow(imgTransversal,[lowLimit highLimit],'Parent',app.UITransversal);
  42.            
  43. %***********Sagittale Schicht*******************************************/        
  44.  
  45.             imgSagittal = app.Images(:, round(sliderValueS),:);
  46.            
  47.             sagittal = reshape(imgSagittal,[width imageSize]);
  48.             sagittalTransformation = imwarp(sagittal, transform);
  49.  
  50.             imshow(sagittalTransformation,[lowLimit highLimit],'Parent',app.UISagittal);
  51.  
  52. %***********Frontale Schicht******************************************/
  53.  
  54.             imgFrontal = app.Images(round(sliderValueF),:,:);
  55.  
  56.             frontal = reshape(imgFrontal,[height imageSize]);
  57.             frontalTransformation = imwarp(frontal, transform);
  58.  
  59.             imshow(frontalTransformation,[lowLimit highLimit],'Parent', app.UIFrontal);
  60.                    
  61.        end%*****************************************************/
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement