Returns the image stack. The stack may have only one slice. After adding or removing slices, call setStack() to update the image and the window that is displaying it. @see #setStack
()
| 1877 | @see #setStack |
| 1878 | */ |
| 1879 | public ImageStack getStack() { |
| 1880 | ImageStack s; |
| 1881 | if (stack==null) { |
| 1882 | s = createEmptyStack(); |
| 1883 | ImageProcessor ip2 = getProcessor(); |
| 1884 | if (ip2==null) |
| 1885 | return s; |
| 1886 | String label = getProp("Slice_Label"); |
| 1887 | if (label==null) { |
| 1888 | String info = (String)getProperty("Info"); |
| 1889 | label = info!=null?getTitle()+"\n"+info:null; // DICOM metadata |
| 1890 | } |
| 1891 | s.addSlice(label, ip2); |
| 1892 | s.update(ip2); |
| 1893 | this.stack = s; |
| 1894 | ip = ip2; |
| 1895 | oneSliceStack = true; |
| 1896 | setCurrentSlice(1); |
| 1897 | } else { |
| 1898 | s = stack; |
| 1899 | if (ip!=null) { |
| 1900 | Calibration cal = getCalibration(); |
| 1901 | if (cal.calibrated()) |
| 1902 | ip.setCalibrationTable(cal.getCTable()); |
| 1903 | else |
| 1904 | ip.setCalibrationTable(null); |
| 1905 | } |
| 1906 | s.update(ip); |
| 1907 | } |
| 1908 | if (roi!=null) |
| 1909 | s.setRoi(roi.getBounds()); |
| 1910 | else |
| 1911 | s.setRoi(null); |
| 1912 | return s; |
| 1913 | } |
| 1914 | |
| 1915 | /** Returns the base image stack. */ |
| 1916 | public ImageStack getImageStack() { |
no test coverage detected