Closed simon-gunacker closed 6 years ago
@simon-gunacker it is very strange. Please, open the windows explorer (the software you use to browser your files and folder), go to "%USERPROFILE%.invesalius" (copy what is between "" and paste in the windows explorer address bar and ENTER). Remove the files config.cfg and config.backup. Before remove the config.cfg, please copy and paste here the content of that file here.
I have the same issue under Windows 8.1
@tfmoraes: Thanks for your hint. I found the error now. My configfile contained a property called last_dicom_folder
. The problem is, that our folder contained whitespaces. When erasing the line, I was finally able to open invesalius again.
thx, worked for me too!
@simon-gunacker I have installed Invesalius 3.1-64-bit on Windows 10. Right after installation, I am receiving the same fatal error (Failed to execute script app). I tried erasing the line "last_dicom_folder =", but it still shows the same error when I try to open the software and the config files gets updated again with the "last_dicom_folder =" property. How to get the software working ?
@v27jain Can you test new pre-release version? https://github.com/invesalius/invesalius3/releases/download/v3.1.99991/invesalius-3.1.99991-win64.exe
@paulojamorim Hi there, I tried this. This time there's no fatal error but the program doesn't run. All it does is asks for language preference and then that's it. Nothing runs after that.
@v27jain Thank you for test.
Can you try delete ".invesalius" in your user folder?
See the log:
1 - Open command prompt 2 - cd C:\Program Files (x86)\InVesalius 3.1\dist 3 - "InVesalius 3.1.exe"
Paste the output log here.
@paulojamorim Here is the output log.
@v27jain
What is your Windows language? It seems to me that InVesalius is not able to verify which language.
Are you deleted .invesalius folder and runned again, right? Another question, your username in Windows do have special characters or space?
Before provide this installer, I tested it on a clean installation of Windows 10 x64 in Portuguese.
Update:
I updated the executable to show more information, you can download and send-me the new log?
The link is the same: https://github.com/invesalius/invesalius3/releases/download/v3.1.99991/invesalius-3.1.99991-win64.exe
@paulojamorim get the same error. My locale is ru_ru.
Hi @lcfm1 and @v27jain,
I generated a new release, please try to install and tell me if it worked or not.
Regards, Paulo Amorim
I install invesalius in windows but failed to execute app. RAM 12 GB and CPU 2.0GHz Intel Core i3 and 64-bit. I try to install invesalius and %USERPROFILE%.invesalius but the folder is doesn't exist.
Dear @rosung ,
Are you tried this version? https://github.com/invesalius/invesalius3/releases/download/v3.1.99992/invesalius-3.1.99992-win64.exe
Regards, Paulo Amorim
Okay, I will try using this version. But I want to clarify that there is "%USERPROFILE%.invesalius" with invesalius 3.1 (I didn't install yet your suggestion) and remove config.cfg + config.backup, but didn't work". Before I install your suggestion version, my free space of local disk C: is only 25 GB. Is that the problem?
@rosung ,
"%USERPROFILE%.invesalius" is only one for all version. Not problem, is possible install InVesalius with 25 GB of free space. Please try to install and tell me if it worked or not.
I already install your suggestion, and it's work. Thank you very much for your fast respond. 😊😊
Hi paulojamorim , This is arun From India, How Many Members are Worked in this invesalius Project, Can you pls tell me How Much Time taken to Complete Invesalius Project for First Version, And is it possible to Include New Concepts in Your Git Hub Code of Invesalius Project...
Hi @ArunKumarMahi ,
How Many Members are Worked in this invesalius Project? People who contributed significantly to version 1, 2 and 3 of the project I would say it was a 7~10 peoples.
Can you pls tell me How Much Time taken to Complete Invesalius Project for First Version? I didn't work on the first version, I started working in the middle of the second. I can say about the third version, it took 3 people it took us about 1 year to have a stable version. Of course, we already had enough experience.
It possible to Include New Concepts in Your Git Hub Code of Invesalius Project? Of course!
Hi paulojamorim, This is karthi from India. I added one button in the top navigation bar. Through that button click I need to know how to load one image in the axial slice. Kindly help me to solve this. Thanks in advance.
Hi @karthikeyanbalan ,
I created this patch that apply a gaussian filter to the image.
It is in the Menu Bar. Tools > Image > Apply Filter. If you click the second time it will restore to the original image.
Save the part of code below to a file (filter.patch) in invesalius3 folder and apply the patch with git apply filter.patch
Please, create another topic next time.
Good luck!
diff --git a/invesalius/constants.py b/invesalius/constants.py
index 95b814cd..4edf7072 100644
--- a/invesalius/constants.py
+++ b/invesalius/constants.py
@@ -534,6 +534,9 @@ STATE_MEASURE_ANGLE = 1008
STATE_MEASURE_DENSITY = 1009
STATE_MEASURE_DENSITY_ELLIPSE = 1010
STATE_MEASURE_DENSITY_POLYGON = 1011
+STATE_APPLY_FILTER = 1022
+
+ACTIVATED_FILTER = False
SLICE_STATE_CROSS = 3006
SLICE_STATE_SCROLL = 3007
diff --git a/invesalius/data/slice_.py b/invesalius/data/slice_.py
index 0e8ac7e4..29995f2b 100644
--- a/invesalius/data/slice_.py
+++ b/invesalius/data/slice_.py
@@ -35,6 +35,8 @@ from invesalius.data.mask import Mask
from invesalius.project import Project
from invesalius_cy import mips, transforms
+from scipy.ndimage import gaussian_filter
+
OTHER = 0
PLIST = 1
WIDGET = 2
@@ -118,6 +120,7 @@ class Slice(metaclass=utils.Singleton):
self.from_ = OTHER
self.__bind_events()
self.opacity = 0.8
+ self.img_copy = None
@property
def matrix(self):
@@ -209,6 +212,7 @@ class Slice(metaclass=utils.Singleton):
Publisher.subscribe(self.OnFlipVolume, "Flip volume")
Publisher.subscribe(self.OnSwapVolumeAxes, "Swap volume axes")
+ Publisher.subscribe(self.OnApplyFilter, "Apply filter")
Publisher.subscribe(self.__undo_edition, "Undo edition")
Publisher.subscribe(self.__redo_edition, "Redo edition")
@@ -1716,6 +1720,35 @@ class Slice(metaclass=utils.Singleton):
self.matrix_filename = filename
self.matrix = np.memmap(filename, shape=shape, dtype=dtype, mode="r+")
+ def OnApplyFilter(self):
+
+ if (const.ACTIVATED_FILTER):
+ self.matrix[:] = self.img_copy
+ const.ACTIVATED_FILTER = False
+ else:
+ shape = self.matrix.shape
+
+ #copy original image array
+ self.img_copy = np.zeros(shape, dtype=self.matrix.dtype)
+ self.img_copy[:,:,:] = self.matrix[:,:,:]
+
+ #your filter array
+ img_copy_filter = np.zeros(shape, dtype=self.matrix.dtype)
+
+ #------- implement your filter and save in img_copy_filter array ------------
+
+ gaussian_filter(self.matrix, 2, output = img_copy_filter)
+
+ #----------------------------------------------------------------------------
+
+ self.matrix[:] = img_copy_filter
+ const.ACTIVATED_FILTER = True
+
+ for buffer_ in self.buffer_slices.values():
+ buffer_.discard_buffer()
+
+ Publisher.sendMessage("Reload actual slice")
+
def OnFlipVolume(self, axis):
if axis == 0:
self.matrix[:] = self.matrix[::-1]
diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py
index 29a8919b..8946ffb2 100644
--- a/invesalius/gui/frame.py
+++ b/invesalius/gui/frame.py
@@ -544,6 +544,8 @@ class Frame(wx.Frame):
elif id == const.ID_PLUGINS_SHOW_PATH:
self.ShowPluginsFolder()
+ elif id == const.STATE_APPLY_FILTER:
+ Publisher.sendMessage('Apply filter')
def OnDbsMode(self):
st = self.actived_dbs_mode.IsChecked()
@@ -988,6 +990,8 @@ class MenuBar(wx.MenuBar):
reorient_menu = image_menu.Append(const.ID_REORIENT_IMG, _(u'Reorient image\tCtrl+Shift+R'))
image_menu.Append(const.ID_MANUAL_WWWL, _("Set WW&&WL manually"))
+ image_menu.Append(const.STATE_APPLY_FILTER, _("Apply filter"))
+
reorient_menu.Enable(False)
tools_menu.Append(-1, _(u'Image'), image_menu)
tools_menu.Append(-1, _(u"Mask"), mask_menu)
Hi paulojamorim, Thanks for the reply. I already have one image in my local folder and I created one menu in the top navigation bar (Filter Menu). When I click that menu OnClickMenuFilter() method is called. Can you please tell how to show that image in axial slice when I click that menu. Where I need to mention that image path. Kindly help me to solve this. Thanks in advance
customize_menu = wx.Menu() customize_menu.Append(const.ID_FILTER_SHOW_PATHONE, ("Filter1"))
# Add all menus to menubar
self.Append(file_menu, _("File"))
self.Append(file_edit, _("Edit"))
self.Append(view_menu, _(u"View"))
self.Append(tools_menu, _(u"Tools"))
self.Append(plugins_menu, _(u"Plugins"))
#self.Append(tools_menu, "Tools")
self.Append(options_menu, _("Options"))
self.Append(mode_menu, _("Mode"))
self.Append(help_menu, _("Help"))
self.Append(customize_menu, _("Filter Menu"))
plugins_menu.Bind(wx.EVT_MENU, self.OnPluginMenu)
customize_menu.Bind(wx.EVT_MENU, self.OnClickMenuFilter)
def OnClickMenuFilter(self,evt):
###
Hi @karthikeyanbalan ,
What is the image format? Is it DICOM? Is it volumetric?
Hi paulojamorim, Image format is DICOM
@karthikeyanbalan ,
Why can't you import into InVesalius? File -> "Import DICOM" ?
Hi paulojamorim, Thanks for reply. Could you tell how to apply binomial filter in below code using itk package. I'm having binomial filter matrix value. where I need to pass that value for apply binomial filter. Thanks is advance
def Gaussian_Filter(self): if (const.ACTIVATED_FILTER): self.matrix[:] = self.img_copy const.ACTIVATED_FILTER = False else: shape = self.matrix.shape
self.img_copy = np.zeros(shape, dtype=self.matrix.dtype)
self.img_copy[:, :, :] = self.matrix[:, :, :]
# your filter array
img_copy_filter = np.zeros(shape, dtype=self.matrix.dtype)
# ------- implement your filter and save in img_copy_filter array ------------
gaussian_filter(self.matrix,2, output=img_copy_filter)
# ----------------------------------------------------------------------------
self.matrix[:] = img_copy_filter
const.ACTIVATED_FILTER = True
for buffer_ in self.buffer_slices.values():
buffer_.discard_buffer()
Publisher.sendMessage("Reload actual slice")
Hi @karthikeyanbalan ,
I recommend you to use scipy. See the code below.
# your filter array
img_copy_filter = np.zeros(shape, dtype=self.matrix.dtype)
# ------- implement your filter and save in img_copy_filter array ------------
from scipy import signal
#binomial kernel
kernel = np.array([[1,2,1],[2,4,2],[1,2,1]])/16
for z in range(img_copy_filter.shape[-1]):
img_copy_filter[:,:,z] = signal.convolve2d(self.matrix[:,:,z], kernel, boundary='symm', mode='same')
# ----------------------------------------------------------------------------
self.matrix[:] = img_copy_filter
const.ACTIVATED_FILTER = True
for buffer_ in self.buffer_slices.values():
buffer_.discard_buffer()
Publisher.sendMessage("Reload actual slice")
Hi paulojamorim, I have used above mentioned code and got the actual result report , I need to get the result as given in the attachment . Kindly help me to solve the code. Thanks in advance.
Actual Result : Expected Result :
Hi @karthikeyanbalan ,
The binomial filter has a tendency to blur the image, it is what it is doing in its first image.
The 3x3 kernel used in the implementation was the default:
I recommend you look for the book "Digital Image Processing" 5th edition, by Bernd Jähne, in chapter 3 he explains about binomial filter.
What you showed in the second image is more like histogram equalization, that's another topic.
Good luck!
Hi paulojamorim, I have used above mentioned code and got the actual result report , I need to get the result as given in the attachment . Kindly help me to solve the code. Thanks in advance.
Actual Result : Expected Result :
Hi @tfmoraes
Just installed version 3.1.1 (x64) on Windows 10, I am still having the issue "Failed to execute script app". I do not have any space in the username, everything is default. I don't get anything in the console when running "InVesalius 3.1.exe".
Software looks great, let me know if I can help and provide more information.
Thanks
@rsahli, try to install this version https://github.com/invesalius/invesalius3/releases/download/v3.1.99994/invesalius-3.1.99994-win64.exe
@rsahli, try to install this version https://github.com/invesalius/invesalius3/releases/download/v3.1.99994/invesalius-3.1.99994-win64.exe
ok sorry. I thought the fix was already part of a release since the time of the initial post. Thank you, it is working fine. Application is really nice, great job to you and the team.
Hi paulojamorim, I have applied GradientMagnitudeImageFilter. While applying below code it's working fine
step1: imagedata_utils.py
def read_dcm_slice_as_np2(filename,resolution_percentage=1.0): reader = gdcm.ImageReader() reader.SetFileName(filename) reader.Read() image = reader.GetImage() output = converters.gdcm_to_numpy(image)
if resolution_percentage < 1.0:
output = zoom(output, resolution_percentage)
imageio.imwrite('D:\invesalius3-master\output.jpg',output)
image = itk.imread(filename)
gradient = itk.GradientMagnitudeImageFilter.New(image)
itk.imwrite(gradient, r"gradient.dcm")
ds = dicom.read_file(r"gradient.dcm")
output = ds.pixel_array
return output
Result
Actual Image
While Click Import Button Image is load and displayed in front end with GradientMagnitudeImageFilter
stpe2:
But I need to apply filter while clicking filter menu
Once I click that menu I'm getting below output. I have attached code and screenshot here. Kindly help me to solve this
I have created one method in slice_.py
def GradientMagnitudeImageFilter(self):
if (const.ACTIVATED_FILTER):
self.matrix[:] = self.img_copy
const.ACTIVATED_FILTER = False
else:
shape = self.matrix.shape
self.img_copy = np.zeros(shape, dtype=self.matrix.dtype)
self.img_copy[:, :, :] = self.matrix[:, :, :]
reader = gdcm.ImageReader()
reader.SetFileName(r"D:\image\data1.dcm")
reader.Read()
image = reader.GetImage()
output = converters.gdcm_to_numpy(image)
imageio.imwrite('D:\invesalius3-master\output.jpg', output)
image = itk.imread('D:\invesalius3-master\output.jpg')
gradient = itk.GradientMagnitudeImageFilter.New(image)
itk.imwrite(gradient, r"gradient.dcm")
import pydicom as dicom
ds = dicom.read_file(r"gradient.dcm")
img_copy_filter = ds.pixel_array
# ----------------------------------------------------------------------------
self.matrix[:] = img_copy_filter
const.ACTIVATED_FILTER = True
for buffer_ in self.buffer_slices.values():
buffer_.discard_buffer()
Publisher.sendMessage("Reload actual slice")
Actual Result
Expected Result
Hi @karthikeyanbalan ,
Here is an example of using the ITK (simpleITK). He applies the filter to each slice.
You do not need to read the images, InVesalius already loads (if it is 3D).
def OnApplyFilter(self):
if (const.ACTIVATED_FILTER):
self.matrix[:] = self.img_copy
const.ACTIVATED_FILTER = False
else:
shape = self.matrix.shape
#copy original image array
self.img_copy = np.zeros(shape, dtype=self.matrix.dtype)
self.img_copy[:,:,:] = self.matrix[:,:,:]
#your filter array
img_copy_filter = np.zeros(shape, dtype=self.matrix.dtype)
import SimpleITK as sitk
for z in range(img_copy_filter.shape[-1]):
img_as_itk = sitk.GetImageFromArray(self.matrix[:,:,z])
gradient = sitk.GradientMagnitudeImageFilter()
filtered_img = gradient.Execute(img_as_itk)
img_copy_filter[:,:,z] = sitk.GetArrayFromImage(filtered_img)
self.matrix[:] = img_copy_filter
const.ACTIVATED_FILTER = True
for buffer_ in self.buffer_slices.values():
buffer_.discard_buffer()
Publisher.sendMessage("Reload actual slice")
To install simpleITK: pip install SimpleITK
Hi paulojamorim, I created exe file for InVesalius application. When run that exe fiile below error is showing. Can you help me to solve this. Thanks in advance
Olá, tudo bem? Eu instalei a versão mais recente do Invesalius (Invesalius 3.1.1), e a principio consegui executar normalmente, tentei fazer uma superficie, deu certo, e quando fui fazer uma superficie para sobrescrever a ultima, o aplicativo estava demorando muito para criar a superficie, deve ter travado, e tive que forçar parada do aplicativo. Desde então, sempre que eu tento abrir o aplicativo, recebo a mensagem de fatal error script app. Tentei encontrar a pasta que mencionaram "%USERPROFILE%.invesalius", mas não funcionou. Tentei também instalar essa versão https://github.com/invesalius/invesalius3/releases/download/v3.1.99994/invesalius-3.1.99994-win64.exe e não deu certo também. Poderiam me ajudar?
Oi @Gabrielamcosta ,
Nas novas versões a pasta de configuração no Windows está ficando em: C:\Users\NOME_DO_USUARIO\.config\invesalius
Entre nela, apague a pasta "invesalius" e tente executar o InVesalius.
I tried to install Invesalius on Windows. After the setup had finished, I was able to start the program once. However, after closing it, I was not able to re-open it again. Whenever I tried to, a message saying "Failed to execute script app" pops up. Even reinstalling the program did not solve the issue. I even tried different versions of the program - the error remains. I couldn't find out anything else about it. I am using Windows 10.