Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
427729d0
Commit
427729d0
authored
Jan 12, 2015
by
Christian Schulte zu Berge
Browse files
Cleaned up GenericImageReader and fixed some bugs.
parent
fc26d1ca
Changes
14
Show whitespace changes
Inline
Side-by-side
application/gui/datacontainerfileloaderwidget.cpp
View file @
427729d0
...
...
@@ -24,6 +24,8 @@
#include
"datacontainerfileloaderwidget.h"
#include
<QScrollBar>
namespace
campvis
{
const
std
::
string
DataContainerFileLoaderWidget
::
loggerCat_
=
"CAMPVis.application.DataContainerFileLoaderWidget"
;
...
...
@@ -36,21 +38,20 @@ namespace campvis {
,
_fileName
(
"fileName"
,
"Image URL"
,
""
)
,
_propCollectionWidget
(
0
)
{
this
->
_parent
=
parentDataInspector
;
this
->
_dataContainer
=
this
->
_parent
->
getDataContainer
();
this
->
_imgReader
=
new
GenericImageReader
();
this
->
_imgReader
->
setVisibibility
(
".mhd"
,
true
);
_parent
=
parentDataInspector
;
_dataContainer
=
_parent
->
getDataContainer
();
_imgReader
=
new
GenericImageReader
();
setupGUI
();
}
DataContainerFileLoaderWidget
::~
DataContainerFileLoaderWidget
()
{
if
(
this
->
_dataContainer
!=
0
)
{
this
->
_dataContainer
->
s_dataAdded
.
disconnect
(
this
);
if
(
_dataContainer
!=
0
)
{
_dataContainer
->
s_dataAdded
.
disconnect
(
this
);
}
}
void
DataContainerFileLoaderWidget
::
setDataContainer
(
DataContainer
*
dataContainer
)
{
this
->
_dataContainer
=
dataContainer
;
_dataContainer
=
dataContainer
;
}
QSize
DataContainerFileLoaderWidget
::
sizeHint
()
const
{
...
...
@@ -61,33 +62,39 @@ namespace campvis {
void
DataContainerFileLoaderWidget
::
setupGUI
()
{
setWindowTitle
(
tr
(
"Browse File"
));
this
->
_layout
=
new
QGridLayout
();
this
->
_layout
->
setSpacing
(
2
);
_layout
=
new
QGridLayout
();
_layout
->
setSpacing
(
2
);
setLayout
(
_layout
);
this
->
_pipelinePropertiesScrollArea
=
new
QScrollArea
(
this
);
this
->
_pipelinePropertiesScrollArea
->
setWidgetResizable
(
true
);
this
->
_pipelinePropertiesScrollArea
->
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
this
->
_pipelinePropertiesScrollArea
->
setFrameStyle
(
QScrollArea
::
NoFrame
);
this
->
installEventFilter
(
this
);
_pipelinePropertiesScrollArea
=
new
QScrollArea
(
this
);
_pipelinePropertiesScrollArea
->
setWidgetResizable
(
true
);
_pipelinePropertiesScrollArea
->
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
_pipelinePropertiesScrollArea
->
setFrameStyle
(
QScrollArea
::
NoFrame
);
this
->
_propCollectionWidget
=
new
PropertyCollectionWidget
(
this
->
_pipelinePropertiesScrollArea
);
this
->
_layout
->
addWidget
(
this
->
_propCollectionWidget
,
0
,
0
,
1
,
2
);
this
->
_propCollectionWidget
->
updatePropCollection
(
this
->
_imgReader
,
this
->
_dataContainer
);
_propCollectionWidget
=
new
PropertyCollectionWidget
(
_pipelinePropertiesScrollArea
);
_propCollectionWidget
->
installEventFilter
(
this
);
_pipelinePropertiesScrollArea
->
setWidget
(
_propCollectionWidget
);
_propCollectionWidget
->
updatePropCollection
(
_imgReader
,
_dataContainer
);
_layout
->
addWidget
(
_pipelinePropertiesScrollArea
,
0
,
0
,
1
,
2
);
this
->
_btnLoadFile
=
new
QPushButton
(
tr
(
"Load"
),
this
);
this
->
_layout
->
addWidget
(
this
->
_btnLoadFile
,
1
,
0
,
1
,
1
);
this
->
_btnCancel
=
new
QPushButton
(
tr
(
"Cancel"
),
this
);
this
->
_layout
->
addWidget
(
this
->
_btnCancel
,
1
,
1
,
1
,
1
);
_btnLoadFile
=
new
QPushButton
(
tr
(
"Load"
),
this
);
_layout
->
addWidget
(
_btnLoadFile
,
1
,
0
,
1
,
1
);
_btnCancel
=
new
QPushButton
(
tr
(
"Cancel"
),
this
);
_layout
->
addWidget
(
_btnCancel
,
1
,
1
,
1
,
1
);
qRegisterMetaType
<
QtDataHandle
>
(
"QtDataHandle"
);
connect
(
this
->
_btnCancel
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnCancelClicked
()));
connect
(
this
->
_btnLoadFile
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnLoadFileClicked
()));
connect
(
_btnCancel
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnCancelClicked
()));
connect
(
_btnLoadFile
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnLoadFileClicked
()));
}
bool
DataContainerFileLoaderWidget
::
eventFilter
(
QObject
*
watched
,
QEvent
*
event
)
{
if
(
watched
==
_propCollectionWidget
&&
event
->
type
()
==
QEvent
::
Resize
)
{
_pipelinePropertiesScrollArea
->
setMinimumWidth
(
_propCollectionWidget
->
minimumSizeHint
().
width
()
+
_pipelinePropertiesScrollArea
->
verticalScrollBar
()
->
width
());
}
return
false
;
}
void
DataContainerFileLoaderWidget
::
init
()
{
...
...
@@ -95,19 +102,19 @@ namespace campvis {
void
DataContainerFileLoaderWidget
::
deinit
()
{
delete
_imgReader
;
this
->
_imgReader
=
nullptr
;
_imgReader
=
nullptr
;
}
void
DataContainerFileLoaderWidget
::
onBtnCancelClicked
()
{
delete
_imgReader
;
this
->
_imgReader
=
nullptr
;
this
->
close
();
_imgReader
=
nullptr
;
close
();
}
void
DataContainerFileLoaderWidget
::
onBtnLoadFileClicked
()
{
this
->
_imgReader
->
process
(
*
_dataContainer
);
this
->
_parent
->
setDataContainer
(
_dataContainer
);
this
->
close
();
_imgReader
->
process
(
*
_dataContainer
);
_parent
->
setDataContainer
(
_dataContainer
);
close
();
}
}
application/gui/datacontainerfileloaderwidget.h
View file @
427729d0
...
...
@@ -94,6 +94,14 @@ namespace campvis {
*/
void
setupGUI
();
/**
* Listens to resize events on _pipelinePropertiesWidget and resizes _pipelinePropertiesScrollArea accordingly
* \param watched the object that caused the event
* \param event the event to be filtered
*/
bool
eventFilter
(
QObject
*
watched
,
QEvent
*
event
);
protected:
DataContainer
*
_dataContainer
;
///< The DataContainer this widget is inspecting
...
...
modules/devil/processors/devilimagereader.cpp
View file @
427729d0
...
...
@@ -59,10 +59,10 @@ namespace campvis {
,
p_importSimilar
(
"ImportSimilar"
,
"Import All Similar Files"
,
false
)
,
_shader
(
nullptr
)
{
this
->
_ext
.
push_back
(
"
.
bmp"
);
this
->
_ext
.
push_back
(
"
.
jpg"
);
this
->
_ext
.
push_back
(
"
.
png"
);
this
->
_ext
.
push_back
(
"
.
tif"
);
this
->
_ext
.
push_back
(
"bmp"
);
this
->
_ext
.
push_back
(
"jpg"
);
this
->
_ext
.
push_back
(
"png"
);
this
->
_ext
.
push_back
(
"tif"
);
this
->
p_targetImageID
.
setValue
(
"DevilImageReader.output"
);
addProperty
(
p_url
);
...
...
modules/io/processors/abstractimagereader.cpp
View file @
427729d0
...
...
@@ -36,7 +36,7 @@ namespace campvis {
}
bool
AbstractImageReader
::
acceptsExtension
(
const
std
::
string
&
extension
)
const
{
for
(
std
::
vector
<
std
::
string
>::
const_iter
ato
r
it
=
this
->
_ext
.
begin
();
it
!=
this
->
_ext
.
end
();
++
it
)
{
for
(
a
u
to
it
=
this
->
_ext
.
begin
();
it
!=
this
->
_ext
.
end
();
++
it
)
{
if
(
*
it
==
extension
)
{
return
true
;
}
...
...
modules/io/processors/csvdimagereader.cpp
View file @
427729d0
...
...
@@ -43,7 +43,7 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
csv"
);
this
->
_ext
.
push_back
(
"csv"
);
this
->
p_targetImageID
.
setValue
(
"CsvdImageReader.output"
);
addProperty
(
p_url
);
...
...
modules/io/processors/genericimagereader.cpp
View file @
427729d0
...
...
@@ -40,34 +40,45 @@
#include
"modules/io/processors/vtkimagereader.h"
namespace
campvis
{
namespace
{
struct
checkExtension
{
checkExtension
(
const
std
::
string
&
str
)
:
_str
(
str
)
{}
bool
operator
()(
const
std
::
pair
<
AbstractImageReader
*
,
MetaProperty
*>&
v
)
const
{
return
v
.
first
->
acceptsExtension
(
this
->
_str
);
}
private:
std
::
string
_str
;
};
}
const
std
::
string
GenericImageReader
::
loggerCat_
=
"CAMPVis.modules.io.GenericImageReader"
;
GenericImageReader
::
GenericImageReader
()
:
AbstractProcessor
()
,
p_url
(
"Url"
,
"Image URL"
,
""
,
StringProperty
::
OPEN_FILENAME
)
,
p_targetImageID
(
"TargetImageName"
,
"Target Image ID"
,
"AbstractImageReader.output"
,
DataNameProperty
::
WRITE
)
,
_currentlyVisible
(
nullptr
)
{
addProperty
(
p_url
);
addProperty
(
p_targetImageID
);
p_url
.
s_changed
.
connect
(
this
,
&
GenericImageReader
::
onUrlPropertyChanged
);
this
->
addReader
(
new
CsvdImageReader
());
this
->
addReader
(
new
LtfImageReader
());
this
->
addReader
(
new
MhdImageReader
());
this
->
addReader
(
new
NiftiImageReader
());
this
->
addReader
(
new
RawImageReader
());
this
->
addReader
(
new
VtkImageReader
());
addReader
(
new
CsvdImageReader
());
addReader
(
new
LtfImageReader
());
addReader
(
new
MhdImageReader
());
addReader
(
new
NiftiImageReader
());
addReader
(
new
RawImageReader
());
addReader
(
new
VtkImageReader
());
#ifdef CAMPVIS_HAS_MODULE_DEVIL
this
->
addReader
(
new
DevilImageReader
());
addReader
(
new
DevilImageReader
());
#endif
this
->
_ext
=
""
;
this
->
_currentlyVisible
=
nullptr
;
}
GenericImageReader
::~
GenericImageReader
()
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
itera
to
r
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
++
it
)
{
for
(
au
to
it
=
_readers
.
begin
();
it
!=
_readers
.
end
();
++
it
)
{
delete
it
->
second
;
delete
it
->
first
;
}
...
...
@@ -78,7 +89,7 @@ namespace campvis {
}
void
GenericImageReader
::
deinit
()
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
++
it
)
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
_readers
.
begin
();
it
!=
_readers
.
end
();
++
it
)
{
// deinit MetaProperty first!
if
(
nullptr
!=
it
->
second
)
{
it
->
second
->
deinit
();
...
...
@@ -91,33 +102,28 @@ namespace campvis {
}
void
GenericImageReader
::
updateResult
(
DataContainer
&
data
)
{
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
if
(
this
->
_currentlyVisible
!=
it
->
second
)
{
if
(
nullptr
!=
this
->
_currentlyVisible
)
{
this
->
_currentlyVisible
->
setVisible
(
false
);
}
(
it
->
second
)
->
setVisible
(
true
);
this
->
_currentlyVisible
=
it
->
second
;
}
const
std
::
string
extension
=
cgt
::
FileSystem
::
fileExtension
(
p_url
.
getValue
());
auto
it
=
findReader
(
extension
);
if
(
it
!=
this
->
_readers
.
end
())
{
it
->
first
->
process
(
data
);
}
}
void
GenericImageReader
::
setVisibibility
(
const
std
::
string
&
extention
,
bool
visibility
)
{
std
::
string
_ext
=
extention
;
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
if
(
nullptr
!=
this
->
_currentlyVisible
)
{
this
->
_currentlyVisible
->
setVisible
(
!
visibility
);
void
GenericImageReader
::
updateVisibility
(
const
std
::
string
&
extension
)
{
if
(
_currentlyVisible
!=
nullptr
)
{
_currentlyVisible
->
setVisible
(
false
);
_currentlyVisible
=
nullptr
;
}
(
it
->
second
)
->
setVisible
(
visibility
);
auto
it
=
findReader
(
extension
);
if
(
it
!=
this
->
_readers
.
end
())
{
it
->
second
->
setVisible
(
true
);
this
->
_currentlyVisible
=
it
->
second
;
//(it->first)->process(data);
}
}
int
GenericImageReader
::
addReader
(
AbstractImageReader
*
reader
)
{
void
GenericImageReader
::
addReader
(
AbstractImageReader
*
reader
)
{
MetaProperty
*
meta
=
new
MetaProperty
(
reader
->
getName
()
+
"MetaProp"
,
reader
->
getName
());
meta
->
addPropertyCollection
(
*
reader
);
meta
->
setVisible
(
false
);
...
...
@@ -128,28 +134,21 @@ namespace campvis {
p_targetImageID
.
addSharedProperty
(
&
reader
->
p_targetImageID
);
reader
->
p_targetImageID
.
setVisible
(
false
);
this
->
_readers
.
insert
(
std
::
pair
<
AbstractImageReader
*
,
MetaProperty
*>
(
reader
,
meta
));
return
0
;
_readers
.
insert
(
std
::
pair
<
AbstractImageReader
*
,
MetaProperty
*>
(
reader
,
meta
));
}
void
GenericImageReader
::
onUrlPropertyChanged
(
const
AbstractProperty
*
prop
)
{
// first set visibility of old extension to false
setVisibibility
(
_ext
,
false
);
// now update extension
const
std
::
string
&
url
=
this
->
p_url
.
getValue
();
size_t
extPos
=
url
.
rfind
(
'.'
);
if
(
extPos
!=
std
::
string
::
npos
)
{
this
->
_ext
=
url
.
substr
(
extPos
);
}
// set visibility of new extension's properties to true
setVisibibility
(
_ext
,
true
);
std
::
string
extension
=
cgt
::
FileSystem
::
fileExtension
(
p_url
.
getValue
());
updateVisibility
(
extension
);
}
void
GenericImageReader
::
adjustToNewExtension
()
{
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
const_iterator
GenericImageReader
::
findReader
(
const
std
::
string
&
extension
)
const
{
auto
it
=
std
::
find_if
(
_readers
.
begin
(),
_readers
.
end
(),
checkExtension
(
extension
));
if
(
it
==
_readers
.
end
())
it
=
std
::
find_if
(
_readers
.
begin
(),
_readers
.
end
(),
checkExtension
(
"raw"
));
return
it
;
}
}
\ No newline at end of file
modules/io/processors/genericimagereader.h
View file @
427729d0
...
...
@@ -72,7 +72,7 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual
ProcessorState
getProcessorState
()
const
{
return
AbstractProcessor
::
TESTING
;
};
void
set
Visibi
bi
lity
(
const
std
::
string
&
exten
t
ion
,
bool
visibility
);
void
update
Visibility
(
const
std
::
string
&
exten
s
ion
);
StringProperty
p_url
;
///< URL for file to read
DataNameProperty
p_targetImageID
;
///< image ID for read image
...
...
@@ -86,10 +86,7 @@ namespace campvis {
private:
void
onUrlPropertyChanged
(
const
AbstractProperty
*
prop
);
void
adjustToNewExtension
();
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>
_readers
;
std
::
string
_ext
;
MetaProperty
*
_currentlyVisible
;
/**
...
...
@@ -99,19 +96,18 @@ namespace campvis {
*
* /param reader pointer to the reader to be added
*/
int
addReader
(
AbstractImageReader
*
reader
);
};
void
addReader
(
AbstractImageReader
*
reader
);
/**
* Returns an iterator to the corresponding reader-property pair that can read a file with
* the given extension. If there is no matching reader found, the RawImageReader is returned.
* \param extension Extension to look for.
* \return An iterator to the corresponding reader-property pair.
*/
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
const_iterator
findReader
(
const
std
::
string
&
extension
)
const
;
struct
checkExt
{
checkExt
(
std
::
string
str
)
:
_str
(
str
)
{}
bool
operator
()(
const
std
::
pair
<
AbstractImageReader
*
,
MetaProperty
*>&
v
)
const
{
return
v
.
first
->
acceptsExtension
(
this
->
_str
);
}
private:
std
::
string
_str
;
};
}
#endif // GENERICIMAGEREADER_H__
modules/io/processors/ltfimagereader.cpp
View file @
427729d0
...
...
@@ -53,7 +53,7 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
ltf"
);
this
->
_ext
.
push_back
(
"ltf"
);
this
->
p_targetImageID
.
setValue
(
"LtfImageReader.output"
);
addProperty
(
p_url
);
...
...
modules/io/processors/mhdimagereader.cpp
View file @
427729d0
...
...
@@ -44,7 +44,7 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
mhd"
);
this
->
_ext
.
push_back
(
"mhd"
);
this
->
p_targetImageID
.
setValue
(
"MhdImageReader.output"
);
addProperty
(
p_url
);
addProperty
(
p_targetImageID
);
...
...
modules/io/processors/niftiimagereader.cpp
View file @
427729d0
...
...
@@ -362,8 +362,8 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
hdr"
);
this
->
_ext
.
push_back
(
"
.
nii"
);
this
->
_ext
.
push_back
(
"hdr"
);
this
->
_ext
.
push_back
(
"nii"
);
this
->
p_targetImageID
.
setValue
(
"NiftiImageReader.output"
);
addProperty
(
p_url
);
addProperty
(
p_targetImageID
);
...
...
modules/io/processors/rawimagereader.cpp
View file @
427729d0
...
...
@@ -58,7 +58,7 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
raw"
);
this
->
_ext
.
push_back
(
"raw"
);
this
->
p_targetImageID
.
setValue
(
"RawImageReader.output"
);
addProperty
(
p_url
);
...
...
modules/io/processors/vtkimagereader.cpp
View file @
427729d0
...
...
@@ -48,7 +48,7 @@ namespace campvis {
,
p_imageOffset
(
"ImageOffset"
,
"Image Offset in mm"
,
cgt
::
vec3
(
0.
f
),
cgt
::
vec3
(
-
10000.
f
),
cgt
::
vec3
(
10000.
f
),
cgt
::
vec3
(
0.1
f
))
,
p_voxelSize
(
"VoxelSize"
,
"Voxel Size in mm"
,
cgt
::
vec3
(
1.
f
),
cgt
::
vec3
(
-
100.
f
),
cgt
::
vec3
(
100.
f
),
cgt
::
vec3
(
0.1
f
))
{
this
->
_ext
.
push_back
(
"
.
vtk"
);
this
->
_ext
.
push_back
(
"vtk"
);
this
->
p_targetImageID
.
setValue
(
"VtkImageReader.output"
);
addProperty
(
p_url
);
...
...
modules/vis/pipelines/advdvrvis.cpp
View file @
427729d0
...
...
@@ -36,18 +36,15 @@ namespace campvis {
AdvDVRVis
::
AdvDVRVis
(
DataContainer
*
dc
)
:
AutoEvaluationPipeline
(
dc
)
,
_tcp
(
&
_canvasSize
)
,
_lsp
()
,
_imageReader
()
,
_v
r
(
&
_canvasSize
,
new
AdvOptimizedRaycaster
(
&
_canvasSize
))
,
_v
e
(
&
_canvasSize
,
new
SliceExtractor
(
nullptr
),
new
AdvOptimizedRaycaster
(
nullptr
))
{
_tcp
.
addLqModeProcessor
(
&
_vr
);
addEventListenerToBack
(
&
_tcp
);
addEventListenerToBack
(
&
_ve
);
addProcessor
(
&
_tcp
);
addProcessor
(
&
_lsp
);
addProcessor
(
&
_imageReader
);
addProcessor
(
&
_v
r
);
addProcessor
(
&
_v
e
);
}
AdvDVRVis
::~
AdvDVRVis
()
{
...
...
@@ -57,20 +54,19 @@ namespace campvis {
void
AdvDVRVis
::
init
()
{
AutoEvaluationPipeline
::
init
();
_v
r
.
p_outputImage
.
setValue
(
"combine"
);
_v
e
.
p_outputImage
.
setValue
(
"combine"
);
_renderTargetID
.
setValue
(
"combine"
);
_imageReader
.
p_url
.
setValue
(
ShdrMgr
.
completePath
(
"/modules/vis/sampledata/smallHeart.mhd"
));
_imageReader
.
p_targetImageID
.
setValue
(
"reader.output"
);
_imageReader
.
p_targetImageID
.
addSharedProperty
(
&
_vr
.
p_inputVolume
);
_imageReader
.
p_targetImageID
.
addSharedProperty
(
&
_tcp
.
p_image
);
_imageReader
.
p_targetImageID
.
addSharedProperty
(
&
_ve
.
p_inputVolume
);
Geometry1DTransferFunction
*
dvrTF
=
new
Geometry1DTransferFunction
(
128
,
cgt
::
vec2
(
0.
f
,
.05
f
));
dvrTF
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
.12
f
,
.15
f
),
cgt
::
col4
(
85
,
0
,
0
,
128
),
cgt
::
col4
(
255
,
0
,
0
,
128
)));
dvrTF
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
.19
f
,
.28
f
),
cgt
::
col4
(
89
,
89
,
89
,
155
),
cgt
::
col4
(
89
,
89
,
89
,
155
)));
dvrTF
->
addGeometry
(
TFGeometry1D
::
createQuad
(
cgt
::
vec2
(
.41
f
,
.51
f
),
cgt
::
col4
(
170
,
170
,
128
,
64
),
cgt
::
col4
(
192
,
192
,
128
,
64
)));
static_cast
<
TransferFunctionProperty
*>
(
_v
r
.
getNestedProperty
(
"RaycasterProps::TransferFunction"
))
->
replaceTF
(
dvrTF
);
static_cast
<
FloatProperty
*>
(
_v
r
.
getNestedProperty
(
"RaycasterProps::SamplingRate"
))
->
setValue
(
4.
f
);
static_cast
<
TransferFunctionProperty
*>
(
_v
e
.
getNestedProperty
(
"
VolumeRendererProperties::
RaycasterProps::TransferFunction"
))
->
replaceTF
(
dvrTF
);
static_cast
<
FloatProperty
*>
(
_v
e
.
getNestedProperty
(
"
VolumeRendererProperties::
RaycasterProps::SamplingRate"
))
->
setValue
(
4.
f
);
}
}
\ No newline at end of file
modules/vis/pipelines/advdvrvis.h
View file @
427729d0
...
...
@@ -31,9 +31,8 @@
#include
"modules/modulesapi.h"
#include
"modules/pipelinefactory.h"
#include
"modules/base/processors/lightsourceprovider.h"
#include
"modules/base/processors/trackballcameraprovider.h"
#include
"modules/io/processors/mhdimagereader.h"
#include
"modules/vis/processors/volumerenderer.h"
#include
"modules/io/processors/genericimagereader.h"
#include
"modules/vis/processors/volumeexplorer.h"
namespace
campvis
{
class
CAMPVIS_MODULES_API
AdvDVRVis
:
public
AutoEvaluationPipeline
{
...
...
@@ -57,10 +56,9 @@ namespace campvis {
protected:
TrackballCameraProvider
_tcp
;
LightSourceProvider
_lsp
;
Mhd
ImageReader
_imageReader
;
Volume
Rende
rer
_v
r
;
Generic
ImageReader
_imageReader
;
Volume
Explo
rer
_v
e
;
};
// Instantiate template to register the pipelines.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment